13 template<
class it_1_t,
class it_2_t,
class pred_t>
19 const pred_t& pred) noexcept
21 auto increment_range_1_it = [range1Begin, range1End](it_1_t itCurrent)
23 it_1_t itNext = ++itCurrent;
24 return itNext != range1End ? itNext : range1Begin;
27 auto compare_starting_with_it = [increment_range_1_it, &pred, range2Begin, range2End](it_1_t range1Start)
29 it_1_t range1Current = range1Start;
30 for (it_2_t it = range2Begin; it != range2End; ++it)
32 if (!pred(*range1Current, *it))
35 range1Current = increment_range_1_it(range1Current);
38 return range1Current == range1Start;
41 for (it_1_t it = range1Begin; it != range1End; ++it)
42 if (compare_starting_with_it(it))
48 template<
class range_1_t,
class range_2_t,
class pred_t>
49 inline bool equal_rotated(
const range_1_t& range1,
const range_2_t& range2,
const pred_t& pred) noexcept
51 return equal_rotated(range1.begin(), range1.end(), range2.begin(), range2.end(), pred);
54 template<
class it_1_t,
class it_2_t>
55 inline bool equal_rotated(it_1_t range1Begin, it_1_t range1End, it_2_t range2Begin, it_2_t range2End) noexcept
62 [](
const auto& value1,
const auto& value2)
64 return value1 == value2;
68 template<
class range_1_t,
class range_2_t>
69 inline bool equal_rotated(
const range_1_t& range1,
const range_2_t& range2) noexcept
71 return equal_rotated(range1.begin(), range1.end(), range2.begin(), range2.end());
bool equal_rotated(it_1_t range1Begin, it_1_t range1End, it_2_t range2Begin, it_2_t range2End, const pred_t &pred) noexcept
Check if two ranges contains same values in a certain order, which may be shifted.