tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
includes.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ALGORITHM_INCLUDES_HPP
4#define TETL_ALGORITHM_INCLUDES_HPP
5
7
8namespace etl {
9
13template <typename InputIt1, typename InputIt2, typename Compare>
14[[nodiscard]] constexpr auto includes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp)
15 -> bool
16{
17 for (; first2 != last2; ++first1) {
18 if (first1 == last1 or comp(*first2, *first1)) {
19 return false;
20 }
21 if (not comp(*first1, *first2)) {
22 ++first2;
23 }
24 }
25 return true;
26}
27
29template <typename InputIt1, typename InputIt2>
30[[nodiscard]] constexpr auto includes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) -> bool
31{
32 return etl::includes(first1, last1, first2, last2, etl::less());
33}
34
35} // namespace etl
36
37#endif // TETL_ALGORITHM_INCLUDES_HPP
constexpr auto includes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp) -> bool
Returns true if the sorted range [first2, last2) is a subsequence of the sorted range [first1,...
Definition includes.hpp:14
Definition adjacent_find.hpp:8
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:14