IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
swap_macros.h File Reference

Macros to help with swapping two objects. More...

#include <IMP/kernel_config.h>
Include dependency graph for swap_macros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IMP_SWAP_MEMBER(var_name)
 Swap two member variables assuming the other object is called o.

Swap helpers

Use the swap_with member function to swap two objects. The two objects must be of the same type (Name) and define the method swap_with(). The number suffix is the number of template arguments, all of which must be of class type.

#define IMP_SWAP(Name)
#define IMP_SWAP_1(Name)
#define IMP_SWAP_2(Name)
#define IMP_SWAP_3(Name)

Detailed Description

Macros to help with swapping two objects.

Copyright 2007-2022 IMP Inventors. All rights reserved.

Definition in file swap_macros.h.

Macro Definition Documentation

◆ IMP_SWAP

#define IMP_SWAP ( Name)
Value:
inline void swap(Name& a, Name& b) { a.swap_with(b); } \
IMP_REQUIRE_SEMICOLON_NAMESPACE

Definition at line 22 of file swap_macros.h.

◆ IMP_SWAP_1

#define IMP_SWAP_1 ( Name)

Definition at line 26 of file swap_macros.h.

◆ IMP_SWAP_2

#define IMP_SWAP_2 ( Name)

Definition at line 33 of file swap_macros.h.

◆ IMP_SWAP_3

#define IMP_SWAP_3 ( Name)

Definition at line 40 of file swap_macros.h.

◆ IMP_SWAP_MEMBER

#define IMP_SWAP_MEMBER ( var_name)
Value:
swap(var_name, o.var_name)

Swap two member variables assuming the other object is called o.

Swap the member var_name of the two objects (this and o).

Definition at line 61 of file swap_macros.h.