Evo C++ Library v0.5.1
|
Evo metaprogramming types and helpers. More...
Classes | |
struct | AddConst< T > |
Add const to type. More... | |
struct | EvoContainer< T > |
Trait to identify Evo container types. More... | |
struct | IsArray< T > |
Check if type is an array. More... | |
struct | IsBool< T > |
Check if type is a boolean (true/false) type. More... | |
struct | IsByteCopyType< T > |
Check if type is a ByteCopy type. More... | |
struct | IsConst< T > |
Check if type is const. More... | |
class | IsConvertible< T, U > |
Check if type T is convertible to type U. More... | |
class | IsEvoContainer< T > |
Check if type is an EvoContainer. More... | |
struct | IsFloat< T > |
Check if type is a floating point type. More... | |
struct | IsInt< T > |
Check if type is an integer (whole number) type. More... | |
struct | IsNormalType< T > |
Check if type is a normal type (not POD and not ByteCopy type). More... | |
class | IsNullable< T > |
Check if type is nullable. More... | |
struct | IsPodType< T > |
Check if type is a Plan Old Data type. More... | |
struct | IsPointer< T > |
Check if type is a pointer. More... | |
struct | IsReference< T > |
Check if type is a reference. More... | |
struct | IsSame< T1, T2 > |
Check if types are exactly the same. More... | |
struct | IsSigned< T > |
Check if integer type is unsigned. More... | |
struct | RemoveConst< T > |
Remove const from type. More... | |
struct | RemoveConstVol< T > |
Remove const & volatile from type. More... | |
struct | RemoveExtents< T > |
Remove extents (pointer and array parts) from type. More... | |
struct | RemoveExtentsConstVol< T > |
Remove extents (pointer and array parts) and then const & volatile from type. More... | |
struct | RemoveVolatile< T > |
Remove volatile from type. More... | |
struct | StaticBool< val > |
Static bool value. More... | |
struct | StaticIf< b, T, F > |
Static conditional type. More... | |
struct | ToSigned< T > |
Translate integer type to signed. More... | |
struct | ToUnsigned< T > |
Translate integer type to unsigned. More... | |
struct | TypeId |
Type ID info (POD, ByteCopy, Normal). More... | |
Macros | |
#define | EVO_BCTYPE(Type) namespace evo { template<> struct ByteCopyType<Type> : public StaticBoolT { }; } |
Identify the given type as a Byte-Copy type. More... | |
#define | EVO_CONTAINER(Type) EVO_TRAIT_NSET(evo,EvoContainer,Type) |
Identify given type as an EvoContainer. More... | |
#define | EVO_CONTAINER_TYPE typedef void EvoContainerType |
Identify current class/struct as an EvoContainer. More... | |
#define | EVO_CREATE_HAS_METHOD(TypeName, ReturnType, Func, ...) |
Create template to check if type has a member function matching given signature. More... | |
#define | EVO_CREATE_HAS_METHOD_CONST(TypeName, ReturnType, Func, ...) |
Create template to check if type has a const member function matching given signature. More... | |
#define | EVO_CREATE_HAS_VAR(TypeName, VarType, VarName) |
Create template to check if type has a member variable matching given signature. More... | |
#define | EVO_PODTYPE(Type) namespace evo { template<> struct PodType<Type> : public StaticBoolT { }; } |
Identify given type as a Plain Old Data Type. More... | |
#define | EVO_STATIC_JOIN(A, B) IMPL_EVO_STATIC_JOIN1(A,B) |
Join (concatenate) compile-time symbols after resolving macros. More... | |
#define | EVO_TRAIT_CREATE(Name) template<class T> struct Name : StaticBoolF { }; |
Helper for creating a boolean trait type. More... | |
#define | EVO_TRAIT_NSET(Namespace, Name, Type) namespace Namespace { template<> struct Name< Type > : public StaticBoolT { }; } |
Helper for setting a boolean trait for given type. More... | |
#define | EVO_TRAIT_SET(Name, Type) template<> struct Name< Type > : public StaticBoolT { }; |
Helper for setting a boolean trait for given type. More... | |
#define | EVO_TYPE_SELECT(T, Pod, Bc, Normal) typename StaticIf<IsPodType<T>::value,Pod,typename StaticIf<IsByteCopyType<T>::value,Bc,Normal>::Type>::Type |
Select a type depending on whether Type is POD, ByteCopy, or Normal type. More... | |
#define | STATIC_ASSERT(EXP, TOKEN) static_assert(EXP,#TOKEN) |
Assert compile-time expression is true or trigger compiler error. More... | |
#define | STATIC_ASSERT_FUNC_UNUSED =delete; |
Assert a function is unused at compile-time. More... | |
#define | STATIC_ASSERT_FUNC_UNUSED_RET(RET) =delete; |
Assert a function is unused at compile-time (with return value). More... | |
Typedefs | |
typedef StaticBool< false > | StaticBoolF |
Static bool value (false). More... | |
typedef StaticBool< true > | StaticBoolT |
Static bool value (true). More... | |
Functions | |
template<class T > | |
bool | is_null (const T &val) |
Check whether object or value is null. More... | |
Evo metaprogramming types and helpers.
#define EVO_BCTYPE | ( | Type | ) | namespace evo { template<> struct ByteCopyType<Type> : public StaticBoolT { }; } |
Identify the given type as a Byte-Copy type.
Type | Type name to set as ByteCopy type. |
#define EVO_CONTAINER | ( | Type | ) | EVO_TRAIT_NSET(evo,EvoContainer,Type) |
Identify given type as an EvoContainer.
Type | Type to identify as EvoContainer |
#define EVO_CONTAINER_TYPE typedef void EvoContainerType |
Identify current class/struct as an EvoContainer.
#define EVO_CREATE_HAS_METHOD | ( | TypeName, | |
ReturnType, | |||
Func, | |||
... | |||
) |
Create template to check if type has a member function matching given signature.
TypeName | Template type name to create |
ReturnType | Member function return type |
Func | Member function name |
... | Member function parameter types (0 or more) |
#define EVO_CREATE_HAS_METHOD_CONST | ( | TypeName, | |
ReturnType, | |||
Func, | |||
... | |||
) |
Create template to check if type has a const member function matching given signature.
TypeName | Template type name to create |
ReturnType | Member function return type |
Func | Member function name |
... | Member function parameter types (0 or more) |
#define EVO_CREATE_HAS_VAR | ( | TypeName, | |
VarType, | |||
VarName | |||
) |
Create template to check if type has a member variable matching given signature.
TypeName | Template type name to create |
VarType | Member function return type |
VarName | Member function name |
#define EVO_PODTYPE | ( | Type | ) | namespace evo { template<> struct PodType<Type> : public StaticBoolT { }; } |
Identify given type as a Plain Old Data Type.
Type | Type name to set as POD type. |
#define EVO_STATIC_JOIN | ( | A, | |
B | |||
) | IMPL_EVO_STATIC_JOIN1(A,B) |
Join (concatenate) compile-time symbols after resolving macros.
A | First symbol/macro to join |
B | Second symbol/macro to join |
#define EVO_TRAIT_CREATE | ( | Name | ) | template<class T> struct Name : StaticBoolF { }; |
Helper for creating a boolean trait type.
Name | Name for trait type |
#define EVO_TRAIT_NSET | ( | Namespace, | |
Name, | |||
Type | |||
) | namespace Namespace { template<> struct Name< Type > : public StaticBoolT { }; } |
Helper for setting a boolean trait for given type.
Namespace | Namespace for trait |
Name | Name for trait type – same name created with EVO_TRAIT_CREATE() |
Type | Type to set trait for |
#define EVO_TRAIT_SET | ( | Name, | |
Type | |||
) | template<> struct Name< Type > : public StaticBoolT { }; |
Helper for setting a boolean trait for given type.
Name | Name for trait type – same name created with EVO_TRAIT_CREATE() |
Type | Type to set trait for |
#define EVO_TYPE_SELECT | ( | T, | |
Pod, | |||
Bc, | |||
Normal | |||
) | typename StaticIf<IsPodType<T>::value,Pod,typename StaticIf<IsByteCopyType<T>::value,Bc,Normal>::Type>::Type |
Select a type depending on whether Type is POD, ByteCopy, or Normal type.
T | Type to check |
Pod | Type to use if POD type |
Bc | Type to use if ByteCopy type |
Normal | Type to use if Normal type |
#define STATIC_ASSERT | ( | EXP, | |
TOKEN | |||
) | static_assert(EXP,#TOKEN) |
Assert compile-time expression is true or trigger compiler error.
EXP | Compile-time expression to evaluate. |
TOKEN | Error message token in the form of a type name that explains the error (not a string). |
#define STATIC_ASSERT_FUNC_UNUSED =delete; |
Assert a function is unused at compile-time.
#define STATIC_ASSERT_FUNC_UNUSED_RET | ( | RET | ) | =delete; |
Assert a function is unused at compile-time (with return value).
RET | Return value for function |
typedef StaticBool<false> StaticBoolF |
Static bool value (false).
typedef StaticBool<true> StaticBoolT |
Static bool value (true).
|
inline |
Check whether object or value is null.
0
or NULL
is considered nullT | Type to check, inferred from argument |
val | Object or value to check if null |