SUNphi  1.0
CRTP.hpp File Reference

Support for Curiously Recurring Template Pattern. More...

Go to the source code of this file.

Macros

#define PROVIDE_CRTP_CAST_OPERATOR(CLASS)
 
#define CRTP_THIS   (~*this)
 Access to the inheriting class.
 

Detailed Description

Support for Curiously Recurring Template Pattern.

Definition in file CRTP.hpp.

Macro Definition Documentation

#define PROVIDE_CRTP_CAST_OPERATOR (   CLASS)
Value:
\
CLASS& operator~() \
{ \
return \
*static_cast<CLASS*>(this); \
} \
\ \
const CLASS& operator~() const \
{ \
return \
*static_cast<const CLASS*>(this); \
}

Perform the cast to base class needed for CRTP

Overload the ~ operator to implement cast to the basic class of a CRTP class

Definition at line 16 of file CRTP.hpp.