The Sparta Modeling Framework
Loading...
Searching...
No Matches
Traits.hpp File Reference

File that defines compile-time queries on data types. Extends c++11+'s trait types. More...

#include <type_traits>

Go to the source code of this file.

Classes

class  sparta_traits< T >
 

Functions

template<class value_type >
static std::enable_if< sparta_traits< value_type >::is_smartptr==false, constvalue_type * >::type getAsPointer (const value_type &obj)
 getAsPointer Intended to convert what object is given to a pointer type
 
template<class value_type >
static std::enable_if< sparta_traits< value_type >::is_smartptr==true, consttypenamevalue_type::element_type * >::type getAsPointer (const value_type &obj)
 getAsPointer Intended to convert what object is given to a pointer type
 

Detailed Description

File that defines compile-time queries on data types. Extends c++11+'s trait types.

Definition in file Traits.hpp.

Function Documentation

◆ getAsPointer() [1/2]

template<class value_type >
static std::enable_if< sparta_traits< value_type >::is_smartptr==false, constvalue_type * >::type getAsPointer ( const value_type &  obj)
inlinestatic

getAsPointer Intended to convert what object is given to a pointer type

Parameters
objThe object to convert to a pointer
Template Parameters
value_typeThe type of the object

This version of the function will evaluate the value_type to see if it's NOT a smart pointer type (like a unique_ptr or a shared_ptr) and will return the given object as an address

Definition at line 54 of file Traits.hpp.

◆ getAsPointer() [2/2]

template<class value_type >
static std::enable_if< sparta_traits< value_type >::is_smartptr==true, consttypenamevalue_type::element_type * >::type getAsPointer ( const value_type &  obj)
inlinestatic

getAsPointer Intended to convert what object is given to a pointer type

Parameters
objThe object to convert to a pointer
Template Parameters
value_typeThe type of the object

This version of the function will evaluate the value_type to see if it IS a smart pointer type (like a unique_ptr or a shared_ptr) and will return the given object as an address via the smart pointer's get() method.

Definition at line 72 of file Traits.hpp.