Type Traits module
Cnx Type Traits are compile-time facilities for checking attributes of types and comparing types, including types of values
Defines
- #define cnx_types_equal(type1, type2)
- Determines if the two types are the same.
- #define cnx_types_equal_v(type, value)
- Determines if the type of
valueis the same as the given type. - #define cnx_types_equal_vs(value1, value2)
- Determines if the type of
value1is the same as the type ofvalue2 - #define cnx_type_as_string(T)
- Converts the given type to a string literal.
- #define cnx_is_const_t(T, value)
- Determines if
value, of unqualified typeTis const.
Define documentation
#define cnx_types_equal(type1,
type2)
#include <include/Cnx/TypeTraits.h>
Determines if the two types are the same.
| Parameters | |
|---|---|
| type1 | - The first type to compare |
| type2 | - The second type to compare |
| Returns | true if the types are equal, false otherwise |
Determines if the two types are the same. This will require the types to be the same at the compiler level, not the semantic level. Eg: typedefs will not compare as unequal if they refer to the same underlying type.
#define cnx_types_equal_v(type,
value)
#include <include/Cnx/TypeTraits.h>
Determines if the type of value is the same as the given type.
| Parameters | |
|---|---|
| type | - The type to compare |
| value | - The value to compare the type of |
| Returns | true if the types are equal, false otherwise |
Determines if the type of value and the type type are the same. This will require the types to be the same at the compiler level, not the semantic level. Eg: typedefs will not compare as unequal if they refer to the same underlying type.
#define cnx_types_equal_vs(value1,
value2)
#include <include/Cnx/TypeTraits.h>
Determines if the type of value1 is the same as the type of value2
| Parameters | |
|---|---|
| value1 | - The first value to compare the type of |
| value2 | - The first value to compare the type of |
| Returns | true if the types are equal, false otherwise |
Determines if the type of value1 and the type of value2 are the same. This will require the types to be the same at the compiler level, not the semantic level. Eg: typedefs will not compare as unequal if they refer to the same underlying type.
#define cnx_type_as_string(T)
#include <include/Cnx/TypeTraits.h>
Converts the given type to a string literal.
| Parameters | |
|---|---|
| T | - The type to convert to a string literal |
| Returns | the type T as a string literal |
#define cnx_is_const_t(T,
value)
#include <include/Cnx/TypeTraits.h>
Determines if value, of unqualified type T is const.
| Parameters | |
|---|---|
| T | - The type of value, without any possible qualifiers |
| value | - The value to check constness for |
Determines if value is const. Does not determine if it is a compile-time constant, only that its type is declared as const at compile-time