13 #ifndef VMCMC_TYPETRAITS_H_ 14 #define VMCMC_TYPETRAITS_H_ 16 #include <type_traits> 33 using test_type =
typename std::remove_const<T>::type;
36 static constexpr
bool test(
38 const A* cpt =
nullptr,
39 decltype( pt->begin() )* =
nullptr,
40 decltype( pt->end() )* =
nullptr,
41 decltype( cpt->begin() )* =
nullptr,
42 decltype( cpt->end() )* =
nullptr,
45 decltype( pt->size() )* =
nullptr,
47 typename A::iterator* pi =
nullptr,
48 typename A::const_iterator* pci =
nullptr,
49 typename A::value_type* =
nullptr )
51 using iterator =
typename A::iterator;
52 using const_iterator =
typename A::const_iterator;
53 using value_type =
typename A::value_type;
56 ( std::is_same<decltype(pt->begin()),iterator>::value || std::is_same<decltype(pt->begin()),const_iterator>::value) &&
57 ( std::is_same<decltype(pt->end()),iterator>::value || std::is_same<decltype(pt->end()),const_iterator>::value ) &&
58 std::is_same<decltype(cpt->begin()),const_iterator>::value &&
59 std::is_same<decltype(cpt->end()),const_iterator>::value &&
60 ( std::is_same<decltype(**pi),value_type &>::value || std::is_same<decltype(**pi),value_type const &>::value ) &&
61 std::is_same<decltype(**pci),value_type
const &>::value;
65 static constexpr
bool test(...)
70 static constexpr
bool value = test<test_type>(
nullptr);
78 static constexpr
bool value =
true;
84 static constexpr
bool value =
false;
Definition: algorithm.cpp:28
Typetrait checking for STL like container structure.
Definition: typetraits.hpp:31