10 #define BOOST_TEST_MODULE ( DereferenceIterator_test )
11 #include <boost/test/unit_test.hpp>
23 template <
template <
typename T,
typename...>
class SeqCont>
26 using Container_t = SeqCont<std::unique_ptr<size_t>>;
33 auto inserter = std::back_inserter(v);
34 for (
size_t i = 0; i < 10; ++i)
35 *(inserter++) = std::make_unique<size_t>(i);
43 BOOST_TEST((it == begin));
44 for (
size_t i = 0; i < 10; ++i, ++it) {
49 BOOST_TEST((it ==
end));
57 BOOST_TEST((rit == rbegin));
58 for (
size_t i = 0; i < 10; ++i, ++rit) {
60 BOOST_TEST(*rit == v.size() - i - 1);
63 BOOST_TEST((rit == rend));
71 BOOST_TEST(i == index);
83 static_assert(std::is_const<std::remove_reference_t<decltype(i)>>::
value,
84 "Dereferenced value from constant vector is not constant");
86 BOOST_TEST(i == index);
97 static_assert(std::is_const<std::remove_reference_t<decltype(i)>>::
value,
98 "Dereferenced value from constant vector is not constant");
100 BOOST_TEST(i == index);
120 test_DereferenceIterator<std::vector>();
122 test_DereferenceIterator<std::list>();
auto dereferenceConstIteratorLoop(Cont &cont)
Returns an object enabling a dereferencing range-for loop.
auto dereferenceIteratorLoop(Cont &cont)
Returns an object enabling a dereferencing range-for loop.
auto rendDereferenceIterator(Cont &cont)
Returns a dereference reverse iterator to the end of container.
auto beginDereferenceIterator(Cont &cont)
Returns a dereference iterator to the begin of specified container.
void test_DereferenceIterator()
Offer iterators automatically dereferencing their values.
auto end(FixedBins< T, C > const &) noexcept
auto begin(FixedBins< T, C > const &) noexcept
auto rbeginDereferenceIterator(Cont &cont)
Returns a dereference reverse iterator to the begin of container.
auto endDereferenceIterator(Cont &cont)
Returns a dereference iterator to the end of specified container.