12 #include <type_traits> 25 #define BOOST_TEST_MODULE ( StatCollector_test ) 26 #include "boost/test/unit_test.hpp" 50 "is_type<*(unique_ptr<int>())> not working");
55 "details::has_dereference_class<int> is not working");
57 "details::has_dereference_class<int*> is not working");
59 "details::has_dereference_class<MyPtr<int>> is not working");
61 "details::has_dereference_class<unique_ptr<int>> is not working");
65 static_assert(std::is_same<
69 "details::dereferenced_type<int> is not working" 71 static_assert(std::is_same<
75 "details::dereferenced_type<int*> is not working" 77 static_assert(std::is_same<
81 "details::dereferenced_type<MyPtr<int>> is not working" 83 static_assert(std::is_same<
87 "details::dereferenced_type<unique_ptr<int>> is not working" 92 static_assert(std::is_same<
96 "details::dereference_class<int> not working" 98 static_assert(std::is_same<
102 "details::dereference_class<int*> not working" 104 static_assert(std::is_same<
108 "details::dereference_class<MyPtr<int>> not working" 110 static_assert(std::is_same<
114 "details::dereference_class<unique_ptr<int>> not working" 119 static_assert(std::is_same<
123 "details::make_pointer_class<int> not working" 125 static_assert(std::is_same<
129 "details::make_pointer_class<int*> not working" 131 static_assert(std::is_same<
135 "details::make_pointer_class<MyPtr<int>> not working" 137 static_assert(std::is_same<
141 "details::make_pointer_class<unique_ptr<int>> not working" 146 static_assert(std::is_same<
150 "dereferenced_type<int> not working" 152 static_assert(std::is_same<
156 "dereferenced_type<int*> not working" 158 static_assert(std::is_same<
162 "dereferenced_type<MyPtr<int>> not working" 164 static_assert(std::is_same<
168 "dereferenced_type<unique_ptr<int>> not working" 175 template <
typename T>
181 auto uptr = std::make_unique<T>(
value);
185 BOOST_TEST(*ptr == value);
187 BOOST_TEST(*ptr == value);
189 BOOST_TEST(*ptr == value);
191 BOOST_TEST(*ptr == value);
Functor returning the dereferenced value of the argument.
BOOST_AUTO_TEST_CASE(TestInt)
details::make_pointer_class< T, details::has_dereference_class< T >::value >::pointer_type make_pointer(T &v)
Returns a pointer to the value of argument, or the argument itself.
typename std::add_lvalue_reference< typename dereferenced_type< T, CanDereference >::type >::type reference_type
Functor returning the pointer to a value in the argument.
typename std::add_pointer< typename dereferenced_type< T, CanDereference >::type >::type pointer_type
details::dereference_class< T, details::has_dereference_class< T >::value >::reference_type dereference(T &v)
Returns the value pointed by the argument, or the argument itself.
Class defining the dereferenced type of the specified type.
Class holding the type dereferenced from an object of type T.
Class compiling only if type T exists (then, it's std::true_type)
Class defining whether the specified type can be dereferenced.