SPH
Public Types | Public Member Functions | List of all members
ExtendedEnum< TBase > Class Template Reference

Helper type allowing to "derive" from enum class. More...

#include <ExtendedEnum.h>

Public Types

using BaseType = TBase
 

Public Member Functions

 ExtendedEnum ()=default
 
 ExtendedEnum (const TBase value)
 Implicit constructor from base. More...
 
template<typename TDerived , typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
 ExtendedEnum (const TDerived value)
 Implicit constructor from derived. More...
 
 operator TBase () const
 Implicit conversion to base. More...
 
template<typename TDerived , typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
 operator TDerived () const
 Explicit conversion to derived. More...
 
bool operator< (const ExtendedEnum &other) const
 
bool operator== (const ExtendedEnum &other) const
 
bool operator== (const TBase &other) const
 
template<typename TDerived , typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
bool operator== (const TDerived &other) const
 
bool operator!= (const ExtendedEnum &other) const
 

Detailed Description

template<typename TBase>
class ExtendedEnum< TBase >

Helper type allowing to "derive" from enum class.

To derive an enum, it is necessary to specialize IsExtended trait. Consider using SPH_EXTEND_ENUM macro.

Definition at line 24 of file ExtendedEnum.h.

Member Typedef Documentation

◆ BaseType

template<typename TBase >
using ExtendedEnum< TBase >::BaseType = TBase

Definition at line 30 of file ExtendedEnum.h.

Constructor & Destructor Documentation

◆ ExtendedEnum() [1/3]

template<typename TBase >
ExtendedEnum< TBase >::ExtendedEnum ( )
default

◆ ExtendedEnum() [2/3]

template<typename TBase >
ExtendedEnum< TBase >::ExtendedEnum ( const TBase  value)
inline

Implicit constructor from base.

Definition at line 35 of file ExtendedEnum.h.

◆ ExtendedEnum() [3/3]

template<typename TBase >
template<typename TDerived , typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
ExtendedEnum< TBase >::ExtendedEnum ( const TDerived  value)
inline

Implicit constructor from derived.

Definition at line 40 of file ExtendedEnum.h.

Member Function Documentation

◆ operator TBase()

template<typename TBase >
ExtendedEnum< TBase >::operator TBase ( ) const
inline

Implicit conversion to base.

Definition at line 44 of file ExtendedEnum.h.

◆ operator TDerived()

template<typename TBase >
template<typename TDerived , typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
ExtendedEnum< TBase >::operator TDerived ( ) const
inlineexplicit

Explicit conversion to derived.

Definition at line 50 of file ExtendedEnum.h.

◆ operator!=()

template<typename TBase >
bool ExtendedEnum< TBase >::operator!= ( const ExtendedEnum< TBase > &  other) const
inline

Definition at line 71 of file ExtendedEnum.h.

◆ operator<()

template<typename TBase >
bool ExtendedEnum< TBase >::operator< ( const ExtendedEnum< TBase > &  other) const
inline

Definition at line 54 of file ExtendedEnum.h.

◆ operator==() [1/3]

template<typename TBase >
bool ExtendedEnum< TBase >::operator== ( const ExtendedEnum< TBase > &  other) const
inline

Definition at line 58 of file ExtendedEnum.h.

◆ operator==() [2/3]

template<typename TBase >
bool ExtendedEnum< TBase >::operator== ( const TBase &  other) const
inline

Definition at line 62 of file ExtendedEnum.h.

◆ operator==() [3/3]

template<typename TBase >
template<typename TDerived , typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
bool ExtendedEnum< TBase >::operator== ( const TDerived &  other) const
inline

Definition at line 67 of file ExtendedEnum.h.


The documentation for this class was generated from the following file: