constexpr std::array<int, 6> cae{{0, 2, 4, 6, 8, 10}};
-constexpr auto out2 = std::all_of(cae.begin(), cae.end(),
+constexpr auto out1 = std::all_of(cae.begin(), cae.end(),
[](int i){ return i % 2 == 0; });
-constexpr bool
-test()
-{
- return true;
-}
+static_assert(out1);
+
+constexpr auto out2 = std::all_of(cae.begin(), cae.end(),
+ [](int i){ return i != 8; });
-static_assert(test());
+static_assert(!out2);
const auto out3 = std::any_of(ca0.begin(), ca0.end(),
[](int i){ return i % 2 == 0; });
- return true;
+ const auto out4 = std::any_of(ca0.begin(), ca0.end(),
+ [](int i){ return i == -1; });
+
+ return out3 && !out4;
}
static_assert(test());
const auto out5 = std::binary_search(ca0.begin(), ca0.end(), 5,
std::less<int>());
- return true;
+ const auto out6 = std::binary_search(ca0.begin(), ca0.end(), 4.5,
+ std::less<>());
+
+ return out4 && out5 && !out6;
}
static_assert(test());
const auto out7 = std::copy_backward(ca0.begin(), ca0.begin() + 8,
ma0.begin() + 10);
- return true;
+ return out7 == ma0.begin() + 2 && ma0[3] == 1;
}
static_assert(test());
const auto out8 = std::count(ca0.begin(), ca0.end(), 6);
- return true;
+ const auto out9 = std::count(ca0.begin(), ca0.end(), 16);
+
+ return out8 == 1 && out9 == 0;
}
static_assert(test());
const auto outb = std::equal(ca0.begin(), ca0.end(), cas.begin(),
[](int i, int j){ return i + 3 == j; });
- return true;
+ auto ca2 = ca0;
+ ca2[5] = -1;
+
+ const auto outc = std::equal(ca0.begin(), ca0.end(), ca2.begin());
+
+ return outa && outb && !outc;
}
static_assert(test());
const auto outc = std::equal_range(car.begin(), car.end(), 6);
- return true;
+ return outc.first == (car.begin() + 6)
+ && outc.second == (car.begin() + 8);
}
static_assert(test());
std::array<int, 12> ma0{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
std::fill(ma0.begin(), ma0.end(), 66);
- return true;
+ return ma0[4] == 66 && ma0[7] == 66;
}
static_assert(test());
constexpr bool
test()
{
- constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
constexpr std::array<int, 3> cam{{4, 5, 6}};
constexpr std::array<int, 3> camm{{-4, -5, -6}};
camm.begin(), camm.end(),
[](int i, int j){ return i + 1 == -j; });
- return true;
+ return outf == (ca0.begin() + 4) && outg == (ca0.begin() + 3);
}
static_assert(test());
constexpr bool
test()
{
- constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
const auto outj = std::find_if(ca0.begin(), ca0.end(),
[](int i){ return i == 6; });
- return true;
+ return outj == (ca0.begin() + 6);
}
static_assert(test());
const auto outs = std::is_partitioned(caeo.begin(), caeo.end(),
[](int i){ return i % 2 == 0; });
- return true;
+ return outs;
}
static_assert(test());
const auto outt = std::is_permutation(ca0.begin(), ca0.end(), cap.begin());
- return true;
+ const auto outf = std::is_permutation(ca0.begin() + 1, ca0.end(), cap.begin());
+
+ return outt && !outf;
}
static_assert(test());
const auto outy = std::is_sorted_until(aus.begin(), aus.end(),
std::less<int>());
- return true;
+ const auto outz = std::is_sorted_until(outx - 1, aus.end(),
+ std::greater<int>());
+
+ return outx == aus.begin() + 7 && outy == outx && outz == (outx + 1);
}
static_assert(test());
ca1.begin(), ca1.end(),
std::less<int>());
- return true;
+ return outz && outaa;
}
static_assert(test());
const auto outcc = std::lower_bound(ca0.begin(), ca0.end(), 6,
std::less<int>());
- return true;
+ return outbb == (ca0.begin() + 6) && outcc == outbb;
}
static_assert(test());
const auto outdd = std::merge(ca0.begin(), ca0.end(),
cas.begin(), cas.end(), out0.begin());
+ if (outdd != out0.end())
+ return false;
const auto outee = std::merge(ca0.begin(), ca0.end(),
camm.begin(), camm.end(), out0.begin(),
[](int i, int j){ return i < j; });
- return true;
+ return outee == (out0.begin() + ca0.size() + camm.size());
}
static_assert(test());
const auto outgg = std::mismatch(ca0.begin(), ca0.end(), cax.begin(),
std::equal_to<int>());
- return true;
+ return outff.first == (ca0.begin() + 6) && outff.second == (cax.begin() + 6)
+ && outgg == outff;
}
static_assert(test());
const auto outhh = std::none_of(ca0.begin(), ca0.end(),
[](int i){ return i > 12; });
- return true;
+ return outhh;
}
static_assert(test());
out0.begin(), out1.begin(),
[](int i){ return i % 2 == 0; });
- return true;
+ return outii.first == (out0.begin() + 6) && out0[1] == 2
+ && outii.second == (out1.begin() + 6) && out1[1] == 3;
}
static_assert(test());
constexpr bool
test()
{
- constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
const auto outmm = std::remove_copy(ca0.begin(), ca0.end(), out0.begin(), 6);
- return true;
+ return outmm == out0.begin() + ca0.size() - 1;
}
static_assert(test());
const auto outnn = std::remove_copy_if(ca0.begin(), ca0.end(), out0.begin(),
[](int i){ return i == 7; });
- return true;
+ return outnn == out0.begin() + ca0.size() - 1;
}
static_assert(test());
const auto outll = std::remove_if(ac2.begin(), ac2.end(),
[](int i){ return i == 7; });
- return true;
+ return outll == (ac2.end() - 1) && ac2[7] == 8;
}
static_assert(test());
std::replace_if(ar0.begin(), ar0.end(), [](int i){ return i % 2 == 1; }, 42);
- return true;
+ std::array<int, 12> ar1{{0, 42, 2, 42, 4, 42, 6, 6, 8, 42, 42, 42}};
+
+ return ar0 == ar1;
}
static_assert(test());
constexpr bool
test()
{
- auto ok = true;
-
std::array<int, 12> ar0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
std::reverse(ar0.begin() + 2, ar0.begin() + 9);
const auto outqq = std::reverse_copy(ca0.rbegin(), ca0.rend(), out0.begin());
- return true;
+ return outqq == (out0.begin() + ca0.size()) && out0[3] == 3;
}
static_assert(test());
const auto outrr = std::rotate_copy(ca0.begin(), ca0.begin() + 6,
ca0.end(), out0.begin());
- return true;
+ return outrr == (out0.begin() + ca0.size()) && out0[3] == 9 && out0[8] == 2;
}
static_assert(test());
constexpr bool
test()
{
- constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
+ constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
constexpr std::array<int, 3> cam{{4, 5, 6}};
const auto outtt = std::search(ca0.begin(), ca0.end(),
= std::search(ca0.begin(), ca0.end(),
std::default_searcher(cam.begin(), cam.end()));
- return true;
+ return outtt == (ca0.begin() + 4) && outtt2 == outtt;
}
static_assert(test());
std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
const auto outvv = std::set_difference(ca0.begin(), ca0.end(),
- cas.begin(), cas.end(), out0.begin());
+ cas.begin(), cas.end(),
+ out0.begin());
const auto outww = std::set_difference(ca0.begin(), ca0.end(),
cas.begin(), cas.end(),
- out0.begin(), std::less<int>());
+ outvv,
+ std::less<int>());
- return true;
+
+ return outvv == (out0.begin() + 3) && outww == (outvv + 3);
}
static_assert(test());
cas.begin(), cas.end(),
out0.begin(), std::less<int>());
- return true;
+ return outxx == (out0.begin() + 9) && outyy == outxx;
}
static_assert(test());
test()
{
constexpr std::array<int, 12> ca0{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}};
- constexpr std::array<int, 12> cas{{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}};
+ constexpr std::array<int, 12> cas{{4, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13}};
std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
- const auto outvv = std::set_difference(ca0.begin(), ca0.end(),
- cas.begin(), cas.end(), out0.begin());
+ const auto outvv = std::set_symmetric_difference(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ out0.begin());
- const auto outww = std::set_difference(ca0.begin(), ca0.end(),
- cas.begin(), cas.end(),
- out0.begin(), std::less<int>());
+ const auto outww = std::set_symmetric_difference(ca0.begin(), ca0.end(),
+ cas.begin(), cas.end(),
+ out0.begin(),
+ std::less<int>());
- return true;
+ return outvv == (out0.begin() + 8) && outww == outvv;
}
static_assert(test());
std::array<int, 24> out0{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
const auto out11 = std::set_union(ca0.begin(), ca0.end(),
- cas.begin(), cas.end(), out0.begin());
+ cas.begin(), cas.end(),
+ out0.begin());
const auto out22 = std::set_union(ca0.begin(), ca0.end(),
cas.begin(), cas.end(),
out0.begin(), std::less<int>());
- return true;
+ return out11 == (out0.begin() + 15) && out22 == out11;
}
static_assert(test());
const auto out55 = std::unique_copy(ar3.begin(), ar3.end(), out0.begin());
- const auto out66 = std::unique_copy(ar3.begin(), ar3.end(), out0.begin(),
+ const auto out66 = std::unique_copy(ar3.begin(), ar3.end(), out55,
std::equal_to<int>());
- return true;
+ return out55 == (out0.begin() + 10) && out0[7] == 8
+ && out66 == (out55 + 10) ; // && out0[19] == 11;
}
static_assert(test());
const auto out88 = std::upper_bound(ca0.begin(), ca0.end(), 6,
std::less<int>());
- return true;
+ return out77 == (ca0.begin() + 7) && out88 == out77;
}
static_assert(test());