CASM  1.1.0
A Clusters Approach to Statistical Mechanics
notstd Namespace Reference

Detailed Description

Non-std smart pointer classes and functions.

Classes

class  Cloneable
 Base class for cloning. More...
 
class  cloneable_ptr
 A 'cloneable_ptr' can be used in place of 'unique_ptr'. More...
 
struct  has_clone
 Base type inherits from std::false_type if T does not have clone method. More...
 
struct  has_clone< T, void_t< decltype(&T::clone)> >
 Specialized case inherits from std::true_type if T does have clone method. More...
 
struct  has_move
 Base type inherits from std::false_type if T does not have move method. More...
 
struct  has_move< T, void_t< decltype(&T::move)> >
 Specialized case inherits from std::true_type if T does have move method. More...
 
struct  Comparisons
 Implements other comparisons in terms of '<'. More...
 
class  CRTPBase
 Base class for CRTP pattern. More...
 
struct  make_void
 Alias for void, to help SFINAE work. More...
 
struct  function_traits
 Deduces return type and argument types for non-generic labmdas and functors. More...
 
struct  function_traits< ReturnType(ClassType::*)(Args...) const >
 
struct  GetSecondDereferenced
 
struct  GetSecondDereferencedConst
 
class  UniqueMapIterator
 An iterator over a UniqueMap. More...
 
struct  GetSecond
 
struct  GetSecondConst
 
class  unique_map
 std::map wrapper to enforce a 1-1 ValueType->KeyType relationship More...
 

Typedefs

template<typename... Ts>
using void_t = typename make_void< Ts... >::type
 Alias for void, to help SFINAE work. More...
 
template<typename F >
using first_argument_type = typename std::decay< typename function_traits< F >::template arg< 0 >::type >::type
 
template<typename F >
using second_argument_type = typename std::decay< typename function_traits< F >::template arg< 1 >::type >::type
 
template<typename F >
using return_type = typename std::decay< typename function_traits< F >::result_type >::type
 
template<typename KeyType , typename ValueType , typename MapType = std::map<KeyType, cloneable_ptr<ValueType> >>
using unique_cloneable_map = unique_map< KeyType, ValueType, MapType, GetSecondDereferenced< MapType >, GetSecondDereferencedConst< MapType > >
 Enable use of unique_map of cloneable_ptr<ValueType> via references to ValueType. More...
 

Functions

template<typename T , typename... Args>
std::unique_ptr< T > make_unique (Args &&... args)
 c++17 does not include 'make_unique' More...
 
template<typename T , typename... Args>
cloneable_ptr< T > make_cloneable (Args &&... args)
 make a cloneable_ptr<T> via T(Args... args) More...
 
template<typename T , typename std::enable_if<!has_clone< T >::value, void >::type * = nullptr>
std::unique_ptr< T > clone (const T &obj)
 
template<typename T , typename std::enable_if<!has_move< T >::value, void >::type * = nullptr>
std::unique_ptr< T > clone_move (T &&obj)
 Construct std::unique_ptr<T> from rvalue reference. More...
 
template<typename Type >
void swap (cloneable_ptr< Type > &A, cloneable_ptr< Type > &B)
 
template<typename Type >
bool operator< (const cloneable_ptr< Type > &A, const cloneable_ptr< Type > &B)
 
template<typename Type >
bool operator== (const cloneable_ptr< Type > &A, const cloneable_ptr< Type > &B)
 
template<typename Type >
bool operator!= (const cloneable_ptr< Type > &A, const cloneable_ptr< Type > &B)
 
template<typename Type >
bool operator== (std::nullptr_t, const cloneable_ptr< Type > &B)
 
template<typename Type >
bool operator!= (std::nullptr_t, const cloneable_ptr< Type > &B)
 
template<typename Type >
bool operator== (const cloneable_ptr< Type > &A, std::nullptr_t)
 
template<typename Type >
bool operator!= (const cloneable_ptr< Type > &A, std::nullptr_t)
 

Typedef Documentation

◆ first_argument_type

template<typename F >
using notstd::first_argument_type = typedef typename std::decay< typename function_traits<F>::template arg<0>::type>::type

Definition at line 38 of file type_traits.hh.

◆ return_type

template<typename F >
using notstd::return_type = typedef typename std::decay<typename function_traits<F>::result_type>::type

Definition at line 48 of file type_traits.hh.

◆ second_argument_type

template<typename F >
using notstd::second_argument_type = typedef typename std::decay< typename function_traits<F>::template arg<1>::type>::type

Definition at line 43 of file type_traits.hh.

◆ unique_cloneable_map

template<typename KeyType , typename ValueType , typename MapType = std::map<KeyType, cloneable_ptr<ValueType> >>
using notstd::unique_cloneable_map = typedef unique_map<KeyType, ValueType, MapType, GetSecondDereferenced<MapType>, GetSecondDereferencedConst<MapType> >

Enable use of unique_map of cloneable_ptr<ValueType> via references to ValueType.

Definition at line 35 of file unique_cloneable_map.hh.

◆ void_t

template<typename... Ts>
using notstd::void_t = typedef typename make_void<Ts...>::type

Alias for void, to help SFINAE work.

Definition at line 16 of file type_traits.hh.

Function Documentation

◆ clone()

template<typename T , typename std::enable_if<!has_clone< T >::value, void >::type * = nullptr>
std::unique_ptr< T > notstd::clone ( const T &  obj)

Definition at line 262 of file cloneable_ptr.hh.

◆ clone_move()

template<typename T , typename std::enable_if<!has_move< T >::value, void >::type * = nullptr>
std::unique_ptr< T > notstd::clone_move ( T &&  obj)

Construct std::unique_ptr<T> from rvalue reference.

  • If obj.move() is valid, use that;
  • else if obj.clone() is valid use that;
  • else copy-construct (fails if T is abstract)

Definition at line 279 of file cloneable_ptr.hh.

◆ make_cloneable()

template<typename T , typename... Args>
cloneable_ptr<T> notstd::make_cloneable ( Args &&...  args)

make a cloneable_ptr<T> via T(Args... args)

Definition at line 109 of file cloneable_ptr.hh.

◆ make_unique()

template<typename T , typename... Args>
std::unique_ptr<T> notstd::make_unique ( Args &&...  args)

c++17 does not include 'make_unique'

Definition at line 83 of file cloneable_ptr.hh.

◆ operator!=() [1/3]

template<typename Type >
bool notstd::operator!= ( const cloneable_ptr< Type > &  A,
const cloneable_ptr< Type > &  B 
)

Definition at line 431 of file cloneable_ptr.hh.

◆ operator!=() [2/3]

template<typename Type >
bool notstd::operator!= ( const cloneable_ptr< Type > &  A,
std::nullptr_t   
)

Definition at line 451 of file cloneable_ptr.hh.

◆ operator!=() [3/3]

template<typename Type >
bool notstd::operator!= ( std::nullptr_t  ,
const cloneable_ptr< Type > &  B 
)

Definition at line 441 of file cloneable_ptr.hh.

◆ operator<()

template<typename Type >
bool notstd::operator< ( const cloneable_ptr< Type > &  A,
const cloneable_ptr< Type > &  B 
)

Definition at line 421 of file cloneable_ptr.hh.

◆ operator==() [1/3]

template<typename Type >
bool notstd::operator== ( const cloneable_ptr< Type > &  A,
const cloneable_ptr< Type > &  B 
)

Definition at line 426 of file cloneable_ptr.hh.

◆ operator==() [2/3]

template<typename Type >
bool notstd::operator== ( const cloneable_ptr< Type > &  A,
std::nullptr_t   
)

Definition at line 446 of file cloneable_ptr.hh.

◆ operator==() [3/3]

template<typename Type >
bool notstd::operator== ( std::nullptr_t  ,
const cloneable_ptr< Type > &  B 
)

Definition at line 436 of file cloneable_ptr.hh.

◆ swap()

template<typename Type >
void notstd::swap ( cloneable_ptr< Type > &  A,
cloneable_ptr< Type > &  B 
)

Definition at line 416 of file cloneable_ptr.hh.