6#ifndef DMLC_TYPE_TRAITS_H_
7#define DMLC_TYPE_TRAITS_H_
24 static const bool value = std::is_pod<T>::value;
27 static const bool value =
false;
40 static const bool value = std::is_integral<T>::value;
43 static const bool value =
false;
55 static const bool value = std::is_floating_point<T>::value;
58 static const bool value =
false;
70 static const bool value = std::is_arithmetic<T>::value;
90 static inline std::string
value() {
122template<
bool cond,
typename Then,
typename Else>
126#define DMLC_DECLARE_TRAITS(Trait, Type, Value) \
128 struct Trait<Type> { \
129 static const bool value = Value; \
133#define DMLC_DECLARE_TYPE_NAME(Type, Name) \
135 struct type_name_helper<Type> { \
136 static inline std::string value() { \
143#if DMLC_USE_CXX11 == 0
181template<
typename Then,
typename Else>
182struct IfThenElseType<true, Then, Else> {
186template<
typename Then,
typename Else>
187struct IfThenElseType<false, Then, Else> {
namespace for dmlc
Definition array_view.h:12
std::string type_name()
the string representation of type name
Definition type_traits.h:101
Macros common to all headers.
template to select type based on condition For example, IfThenElseType<true, int, float>::Type will g...
Definition type_traits.h:123
whether a type have save/load function
Definition type_traits.h:110
static const bool value
the value of the traits
Definition type_traits.h:112
whether a type is arithemetic type
Definition type_traits.h:67
static const bool value
the value of the traits
Definition type_traits.h:73
whether a type is floating point type
Definition type_traits.h:52
static const bool value
the value of the traits
Definition type_traits.h:58
whether a type is integer type
Definition type_traits.h:37
static const bool value
the value of the traits
Definition type_traits.h:43
whether a type is pod type
Definition type_traits.h:21
static const bool value
the value of the traits
Definition type_traits.h:27
helper class to construct a string that represents type name
Definition type_traits.h:86
static std::string value()
Definition type_traits.h:90
#define DMLC_DECLARE_TRAITS(Trait, Type, Value)
macro to quickly declare traits information
Definition type_traits.h:126
#define DMLC_DECLARE_TYPE_NAME(Type, Name)
macro to quickly declare traits information
Definition type_traits.h:133