std::experi..._permutation(3)
π NAME π
okay so welcome to the std::experi..._permutation(3) page from the C++ Standard Libary manual, bestie π
β¨
std::experimental::ranges::is_permutation β std::experimental::ranges::is_permutation
πΈ Synopsis πΈ
Defined in header <experimental/ranges/algorithm>, and hereβs the whole declaration situation exactly as it is β we do not mess with code, periodt π
Defined in header <experimental/ranges/algorithm>
template< ForwardIterator I1, Sentinel<I1> S1, ForwardIterator I2,
Sentinel<I2> S2,
class Pred = ranges::equal_to<>,
class Proj1 = ranges::identity, class Proj2 =
ranges::identity >
(1) (ranges TS)
requires IndirectlyComparable<I1, I2, Pred, Proj1, Proj2>
bool is_permutation( I1 first1, S1 last1, I2 first2, S2 last2, Pred
pred = Pred{},
Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
);
template< ForwardRange R1, ForwardRange R2, class Pred =
ranges::equal_to<>,
class Proj1 = ranges::identity, class Proj2 =
ranges::identity >
requires IndirectlyComparable<ranges::iterator_t<R1>,
(2) (ranges TS)
ranges::iterator_t<R2>,
Pred, Proj1, Proj2>
bool is_permutation( R1&& r1, R2&& r2, Pred pred = Pred{},
Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
);
template< ForwardIterator I1, Sentinel<I1> S1, class I2,
class Pred = ranges::equal_to<>,
class Proj1 = ranges::identity, class Proj2 =
ranges::identity >
requires ForwardIterator<std::decay_t<I2>> && !Range<I2> &&
(3) (ranges TS)
IndirectlyComparable<I1, std::decay_t<I2>, Pred,
(3) (deprecated)
Proj1, Proj2>
bool is_permutation( I1 first1, S1 last1, I2&& first2_, Pred pred =
Pred{},
Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
);
template< ForwardRange R1, class I2, class Pred =
ranges::equal_to<>,
class Proj1 = ranges::identity, class Proj2 =
ranges::identity >
requires ForwardIterator<std::decay_t<I2>> && !Range<I2> &&
(4) (ranges TS)
IndirectlyComparable<ranges::iterator_t<R1>,
(4) (deprecated)
std::decay_t<I2>, Pred, Proj1, Proj2>
bool is_permutation( R1&& r1, I2&& first2_, Pred pred = Pred{},
Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
);
- Returns
trueif there exists a permutation of the elements in range[first1, last1)that makes the range equal to[first2, last2), andfalseotherwise. π - Same as (1), but uses
r1as the first source range andr2as the second source range, as if usingranges::begin(r1)asfirst1,ranges::end(r1)aslast1,ranges::begin(r2)asfirst2, andranges::end(r2)aslast2. - Same as (1), except that
first2is defined as if bystd::decay_t<I2> first2 = std::forward<I2>(first2_);andlast2isfirst2 + (last1 - first1). - Same as (3), but uses
r1as the first source range, as if usingranges::begin(r1)asfirst1andranges::end(r1)aslast1.
Two ranges are considered equal if they have the same number of elements and, for every iterator i in the range [first1, last1), ranges::invoke(pred, ranges::invoke(proj1, *i), ranges::invoke(proj2, *(first2 + (i - first1)))) is true.
π«Ά Notwithstanding the declarations depicted above, the actual number and order of template parameters for algorithm declarations is unspecified. Thus, if explicit template arguments are used when calling an algorithm, the program is probably non-portable.
π Parameters π
first1,last1β the first range of the elementsr1β the first range of the elementsfirst2,last2β the second range of the elementsr2β the second range of the elementsfirst2_β the beginning of the second range of the elementspredβ predicate to apply to the projected elementsproj1β projection to apply to the elements in the first rangeproj2β projection to apply to the elements in the second range
π Return value π
true if the range [first1, last1) is a permutation of the range [first2, last2).
π₯ Complexity π₯
At most O(N^2) applications of the predicate and each projection, or exactly N if the sequences are already equal, where N = last1 - first1.
However if SizedSentinel<S1, I1> && SizedSentinel<S2, I2> is satisfied and last1 - first1 != last2 - first2, no applications of the predicate and projections are made. β¨
π Example π
This section is incomplete
Reason: no example
π¦ See also π¦
is_permutationβ determines if a sequence is a permutation of another sequence (C++11) (function template)next_permutationβ generates the next greater lexicographic permutation of a range of elements (function template)prev_permutationβ generates the next smaller lexicographic permutation of a range of elements (function template)
π Category π
- Todo no example
okay bye bestie β source/version http://cppreference.com, date 2024.06.10, and the footer title is std::experi..._permutation(3). mwah ππ«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms