11 #define BOOST_TEST_MODULE ( operations_test ) 12 #include <boost/test/unit_test.hpp> 30 std::vector<int>
data(10U);
31 std::iota(data.begin(), data.end(), 0U);
42 std::vector<int*> ptrs(data.size());
48 BOOST_TEST(ptrs.size() == data.size());
52 BOOST_TEST(*ptr ==
value);
53 BOOST_TEST(ptr == &
value);
64 std::vector<int>
data(10U);
65 std::iota(data.begin(), data.end(), 0U);
75 std::vector<int*> ptrs(data.size());
80 BOOST_TEST(ptrs.size() == data.size());
84 BOOST_TEST(*ptr ==
value);
85 BOOST_TEST(ptr == &
value);
96 std::vector<int>
data(10U);
97 std::iota(data.begin(), data.end(), 0U);
99 std::vector<int const*> dataPtr;
100 std::transform(data.cbegin(), data.cend(), std::back_inserter(dataPtr),
106 BOOST_TEST(*ptr ==
value);
107 BOOST_TEST(ptr == &
value);
117 std::vector<int>
data(10U);
118 std::iota(data.begin(), data.end(), 0U);
120 std::vector<int const*> dataPtr;
124 using addressof_t =
int const*(*)(
int const&);
126 std::transform(data.cbegin(), data.cend(), std::back_inserter(dataPtr),
127 ((addressof_t) &std::addressof));
132 BOOST_TEST(*ptr ==
value);
133 BOOST_TEST(ptr == &
value);
141 auto takeAddress = [](
auto&& ref){
return std::addressof(ref); };
143 std::transform(data.cbegin(), data.cend(), std::back_inserter(dataPtr),
149 BOOST_TEST(*ptr ==
value);
150 BOOST_TEST(ptr == &
value);
160 std::vector<int>
data(10U);
161 std::iota(data.begin(), data.end(), 0U);
163 std::vector<int*> ptrs(data.size());
175 std::vector<int>
values(ptrs.size());
180 BOOST_TEST(
values.size() == data.size());
183 BOOST_TEST(
value == orig);
193 std::vector<int>
data(10U);
194 std::iota(data.begin(), data.end(), 0U);
196 std::vector<int*> ptrs(data.size());
208 std::vector<int>
values(ptrs.size());
213 BOOST_TEST(
values.size() == data.size());
216 BOOST_TEST(
value == orig);
227 std::vector<int>
data(10U);
228 std::iota(data.begin(), data.end(), 0U);
230 std::vector<int const*> dataPtrs;
231 std::transform(data.cbegin(), data.cend(), std::back_inserter(dataPtrs),
234 std::vector<int> dataAgain;
236 dataPtrs.cbegin(), dataPtrs.cend(),
237 std::back_inserter(dataAgain),
241 BOOST_TEST(dataAgain.size() == data.size());
244 BOOST_TEST(valueAgain ==
value);
245 BOOST_TEST(&valueAgain != &
value);
255 std::vector<int>
data(10U);
256 std::iota(data.begin(), data.end(), 0U);
258 std::vector<std::unique_ptr<int>> dataPtrs;
259 dataPtrs.reserve(data.size());
260 for (
auto&&
value: data) dataPtrs.push_back(std::make_unique<int>(
value));
262 std::vector<int> dataAgain;
264 dataPtrs.cbegin(), dataPtrs.cend(),
265 std::back_inserter(dataAgain),
269 BOOST_TEST(dataAgain.size() == data.size());
272 BOOST_TEST(valueAgain ==
value);
273 BOOST_TEST(&valueAgain != &
value);
288 ToughInt
const* pValue = &
value;
Definition of util::zip().
An empty class that can't be copied nor moved.
decltype(auto) takeAddress()
Returns a functor that returns the address of its argument.
Defines classes that can't be copied nor moved.
void test_dereference_documentation()
Functor returning the address in memory of the operand.
void test_Dereferencer_documentation()
Provides a few simple operations for use in generic programming.
void test_dereference_unique_ptr()
void test_takeAddress_whyBother()
void test_AddressTaker_documentation()
decltype(auto) dereference()
Returns a functor that returns *ptr of its argument ptr.
void test_dereference_C_ptr()
void test_dereference_uncopiable()
void test_takeAddress_documentation()
BOOST_AUTO_TEST_CASE(takeAddress_testcase)
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Functor dereferencing the operand.