HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Swap.h File Reference
#include <SYS/SYS_Inline.h>
#include <utility>
#include <stddef.h>
+ Include dependency graph for UT_Swap.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UT_SWAPPER_CLASS(T)   SYS_FORCE_INLINE void UTswap(T &a, T &b) { a.swap(b); }
 
#define UT_SWAPPER_TEMPLATE(T)
 

Functions

template<typename T >
void UTswap (T &a, T &b)
 
template<typename T , size_t N>
void UTswap (T(&a)[N], T(&b)[N])
 
template<typename T , size_t S>
void UTswap (T(&a)[S], T(&b)[S], size_t at_most)
 

Macro Definition Documentation

#define UT_SWAPPER_CLASS (   T)    SYS_FORCE_INLINE void UTswap(T &a, T &b) { a.swap(b); }

Macro for specializing std::swap() and UTswap() for classes that have a swap method.

Definition at line 60 of file UT_Swap.h.

#define UT_SWAPPER_TEMPLATE (   T)
Value:
template< typename TA > \
SYS_FORCE_INLINE void UTswap(T<TA> &a, T<TA> &b) { a.swap(b); }
void UTswap(T &a, T &b)
Definition: UT_Swap.h:35
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222

Macro for specializing std::swap() and UTswap() for classes that have a swap method.

Definition at line 62 of file UT_Swap.h.

Function Documentation

template<typename T >
void UTswap ( T &  a,
T &  b 
)

Generic swap so that it will always work for specializations that use argument-dependent lookup (ADL).

Contrived specialization example: (note that this is not necessary if MyClass obeys rule of zero)

class MyClass
{
friend void swap(MyClass& a, Myclass &b)
{
UTswap(a.myFirstDataMember, b.myFirstDataMember);
UTswap(a.mySecondDataMember, b.mySecondDataMember);
}
};

Definition at line 35 of file UT_Swap.h.

template<typename T , size_t N>
void UTswap ( T(&)  a[N],
T(&)  b[N] 
)

Generic swap so that it will always work for specializations that use argument-dependent lookup (ADL).

Contrived specialization example: (note that this is not necessary if MyClass obeys rule of zero)

class MyClass
{
friend void swap(MyClass& a, Myclass &b)
{
UTswap(a.myFirstDataMember, b.myFirstDataMember);
UTswap(a.mySecondDataMember, b.mySecondDataMember);
}
};

Definition at line 41 of file UT_Swap.h.

template<typename T , size_t S>
void UTswap ( T(&)  a[S],
T(&)  b[S],
size_t  at_most 
)
inline

Generic swap so that it will always work for specializations that use argument-dependent lookup (ADL).

Contrived specialization example: (note that this is not necessary if MyClass obeys rule of zero)

class MyClass
{
friend void swap(MyClass& a, Myclass &b)
{
UTswap(a.myFirstDataMember, b.myFirstDataMember);
UTswap(a.mySecondDataMember, b.mySecondDataMember);
}
};

Definition at line 48 of file UT_Swap.h.