qxLib
include
qx
algo
equal.h
Go to the documentation of this file.
1
/**
2
3
@file equal.h
4
@author Khrapov
5
@date 20.08.2023
6
@copyright © Nick Khrapov, 2023. All right reserved.
7
8
**/
9
#pragma once
10
11
namespace
qx
12
{
13
14
/**
15
@brief Check if two ranges contains same values in a certain order, which may be shifted
16
@details For { 0, 1, 2 } returns true for { 1, 2, 0 }, but false for { 1, 2 } and { 2, 1, 0 }
17
@tparam it_1_t - first range iterator type
18
@tparam it_2_t - second range iterator type
19
@tparam pred_t - predicate type
20
@param range1Begin - first range begin iterator
21
@param range1End - first range end iterator
22
@param range2Begin - second range begin iterator
23
@param range2End - second range end iterator
24
@param pred - predicate that compares values from left and right ranges
25
@retval - true if ranges are equal
26
**/
27
template
<
class
it_1_t,
class
it_2_t,
class
pred_t>
28
inline
bool
equal_rotated
(
29
it_1_t range1Begin,
30
it_1_t range1End,
31
it_2_t range2Begin,
32
it_2_t range2End,
33
const
pred_t& pred) noexcept;
34
35
/**
36
@brief Check if two ranges contains same values in a certain order, which may be shifted
37
@details For { 0, 1, 2 } returns true for { 1, 2, 0 }, but false for { 1, 2 } and { 2, 1, 0 }
38
@tparam range_1_t - first range type
39
@tparam range_2_t - second range type
40
@tparam pred_t - predicate type
41
@param range1 - first range
42
@param range2 - second range
43
@param pred - predicate that compares values from left and right ranges
44
@retval - true if ranges are equal
45
**/
46
template
<
class
range_1_t,
class
range_2_t,
class
pred_t>
47
inline
bool
equal_rotated
(
const
range_1_t& range1,
const
range_2_t& range2,
const
pred_t& pred) noexcept;
48
49
/**
50
@brief Check if two ranges contains same values in a certain order, which may be shifted
51
@details For { 0, 1, 2 } returns true for { 1, 2, 0 }, but false for { 1, 2 } and { 2, 1, 0 }
52
@tparam it_1_t - first range iterator type
53
@tparam it_2_t - second range iterator type
54
@param range1Begin - first range begin iterator
55
@param range1End - first range end iterator
56
@param range2Begin - second range begin iterator
57
@param range2End - second range end iterator
58
@retval - true if ranges are equal
59
**/
60
template
<
class
it_1_t,
class
it_2_t>
61
inline
bool
equal_rotated
(it_1_t range1Begin, it_1_t range1End, it_2_t range2Begin, it_2_t range2End) noexcept;
62
63
/**
64
@brief Check if two ranges contains same values in a certain order, which may be shifted
65
@details For { 0, 1, 2 } returns true for { 1, 2, 0 }, but false for { 1, 2 } and { 2, 1, 0 }
66
@tparam range_1_t - first range type
67
@tparam range_2_t - second range type
68
@param range1 - first range
69
@param range2 - second range
70
@retval - true if ranges are equal
71
**/
72
template
<
class
range_1_t,
class
range_2_t>
73
inline
bool
equal_rotated
(
const
range_1_t& range1,
const
range_2_t& range2) noexcept;
74
75
}
// namespace qx
76
77
#include <
qx/algo/equal.inl
>
qx::equal_rotated
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.
Definition:
equal.inl:14
equal.inl
Generated by
1.9.1