Develop Biology
The language of life
bio::utility Namespace Reference

Classes

struct  IsPointerImplementation
 
struct  IsPointerImplementation< T * >
 
struct  IsPrimitiveImplementation
 
struct  IsPrimitiveImplementation< bool >
 
struct  IsPrimitiveImplementation< double >
 
struct  IsPrimitiveImplementation< float >
 
struct  IsPrimitiveImplementation< int16_t >
 
struct  IsPrimitiveImplementation< int32_t >
 
struct  IsPrimitiveImplementation< int64_t >
 
struct  IsPrimitiveImplementation< int8_t >
 
struct  IsPrimitiveImplementation< std::string >
 
struct  IsPrimitiveImplementation< uint16_t >
 
struct  IsPrimitiveImplementation< uint32_t >
 
struct  IsPrimitiveImplementation< uint64_t >
 
struct  IsPrimitiveImplementation< uint8_t >
 

Functions

template<typename T >
T & Dereference (T &t)
 
template<typename T >
T & Dereference (T *t)
 
template<typename T >
bool IsPointer ()
 
template<typename T >
bool IsPointer (const T t)
 
template<typename T >
bool IsPrimitive ()
 
template<typename T >
bool IsPrimitive (const T t)
 

Function Documentation

◆ Dereference() [1/2]

template<typename T >
T & bio::utility::Dereference ( T &  t)
inline

Maybe a helper method? This is currently unused.

Template Parameters
T
Parameters
t
Returns
T

Definition at line 82 of file IsPointer.h.

83{
84 return t;
85}

◆ Dereference() [2/2]

template<typename T >
T & bio::utility::Dereference ( T *  t)
inline

Maybe a helper method? This is currently unused.

Template Parameters
T
Parameters
t
Returns
*T

Definition at line 95 of file IsPointer.h.

96{
97 return *t;
98}

◆ IsPointer() [1/2]

template<typename T >
bool bio::utility::IsPointer ( )
inline

Check whether or not T is a pointer

Template Parameters
T
Returns
whether or not T is a pointer.

Definition at line 51 of file IsPointer.h.

52{
53 //@formatter:off
54 #if BIO_CPP_VERSION >= 11
55 return std::is_pointer<T>::value;
56 #else
58 #endif
59 //@formatter:on
60}

◆ IsPointer() [2/2]

template<typename T >
bool bio::utility::IsPointer ( const T  t)
inline

Ease of use method for passing T as arg.

Template Parameters
T
Parameters
t
Returns
whether or not T is a pointer.

Definition at line 69 of file IsPointer.h.

70{
71 return IsPointer< T >();
72}

◆ IsPrimitive() [1/2]

template<typename T >
bool bio::utility::IsPrimitive ( )

IsPrimitive without an arg is the same as that with, except no automatic pointer dereferencing can be done. If we're using C++98 and don't have an interface for T, we'll try looking for std:: in its typename.

Template Parameters
T
Returns
whether or not T is a built-in type or a Biology class, which should, except for a few exceptions, always mean a child of physical::Wave; false by default.

Definition at line 78 of file IsPrimitive.h.

79{
80 if (IsPointer< T >())
81 {
82 return false;
83 }
84 //@formatter:off
85 #if BIO_CPP_VERSION < 11
86 return IsPrimitiveImplementation< T >::m_value;
87 #else
88 return std::is_fundamental<T>::value;
89 #endif
90 //@formatter:on
91}

◆ IsPrimitive() [2/2]

template<typename T >
bool bio::utility::IsPrimitive ( const T  t)

IsPrimitive is a bit more complex than it might need to be but the features, while slow, should be robust. First, if T is a pointer, we'll dereference it and try again until it is not. Second, if we're using C++98 and don't have an interface for T, we'll try looking for std:: in its typename.

Template Parameters
T
Parameters
t
Returns
whether or not T is a built-in type or a Biology class, which should, except for a few exceptions, always mean a child of physical::Wave; false by default.

Definition at line 57 of file IsPrimitive.h.

58{
59 BIO_SANITIZE_AT_SAFETY_LEVEL_2(!IsPointer< T >(), ,
60 return IsPrimitive(*t));
61
62 //@formatter:off
63 #if BIO_CPP_VERSION < 11
65 #else
66 return std::is_fundamental<T>::value;
67 #endif
68 //@formatter:on
69}
#define BIO_SANITIZE_AT_SAFETY_LEVEL_2(test, success, failure)
bool IsPrimitive()
Definition: IsPrimitive.h:78

References BIO_SANITIZE_AT_SAFETY_LEVEL_2, and IsPrimitive().

Referenced by IsPrimitive().