1 #define BOOST_TEST_MODULE (container_algorithms test) 2 #include "boost/test/unit_test.hpp" 17 operator<(A<T>
const&
r)
const 37 operator<<(std::ostream& os, A<T>
const&
a)
45 operator()(
T const val)
const 51 template <
class T,
class U>
54 operator()(
T const t, U
const u)
const 56 return std::pair<T, U>{
t, u};
61 BOOST_AUTO_TEST_SUITE(container_algorithms)
65 std::vector<int>
a{1, 2, 3, 4};
75 vector<int>
const v1{1, 2, 3, 4};
76 vector<char>
const v2{
'a',
'b',
'c',
'd'};
79 vector<A<int>> is1, is2;
80 vector<A<char>> cs1, cs2;
81 map<A<int>, A<char>> p1, p2;
83 transform(
cbegin(v1),
cend(v1), back_inserter(is1), MakeA<int>());
84 transform(
cbegin(v2),
cend(v2), back_inserter(cs1), MakeA<char>());
88 inserter(p1,
begin(p1)),
89 MakeAPair<int, char>());
95 BOOST_TEST(is1 == is2);
96 BOOST_TEST(cs1 == cs2);
98 BOOST_TEST(p1.size() == p2.size());
102 for (; p1_it !=
cend(p1); ++p1_it, ++p2_it) {
103 BOOST_TEST(p1_it->first.t_ == p2_it->first.t_);
104 BOOST_TEST(p1_it->second.t_ == p2_it->second.t_);
110 std::vector<std::string>
names{
"Alice",
"Bob",
"Cathy",
"Dylan"};
111 auto firstNames =
names;
112 auto const& refNames =
names;
118 refNames, [&firstNames](
unsigned const i,
auto const& refName) {
120 BOOST_TEST(refName == assembledName);
124 BOOST_AUTO_TEST_SUITE_END()
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
void for_all_with_index(FwdCont &, Func)
bool operator!=(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept
auto transform_all(Container &, OutputIt, UnaryOp)
auto copy_all(FwdCont &, FwdIter)
BOOST_AUTO_TEST_CASE(copy_all)
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
static std::vector< std::string > const names
std::string to_string(ModuleType const mt)
bool operator==(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept