4#ifndef TETL_CONCEPTS_EMULATION_HPP
5#define TETL_CONCEPTS_EMULATION_HPP
7#include <etl/_iterator/begin.hpp>
8#include <etl/_iterator/end.hpp>
9#include <etl/_iterator/iterator_traits.hpp>
10#include <etl/_type_traits/bool_constant.hpp>
11#include <etl/_type_traits/declval.hpp>
12#include <etl/_type_traits/is_assignable.hpp>
13#include <etl/_type_traits/is_convertible.hpp>
14#include <etl/_type_traits/is_move_constructible.hpp>
15#include <etl/_type_traits/is_object.hpp>
16#include <etl/_type_traits/is_swappable.hpp>
17#include <etl/_type_traits/void_t.hpp>
19namespace etl::detail {
25inline constexpr bool is_movable_v
26 = is_object_v<T>
and is_assignable_v<T&, T>
and is_move_constructible_v<T>
and is_swappable_v<T&>;
28template <
typename Rng>
29using range_iterator_t =
decltype(
etl::begin(
etl::declval<Rng>()));
35using iterator_category_t =
typename iterator_traits<T>::iterator_category;
37template <
typename T,
typename Category,
typename =
void>
38struct IteratorConcept : false_type { };
40template <
typename T,
typename Category>
41struct IteratorConcept<T, Category, void_t<iterator_category_t<T>>>
42 : bool_constant<is_convertible_v<iterator_category_t<T>, Category>> { };
45template <
typename T>
inline constexpr bool InputIterator = IteratorConcept<T, input_iterator_tag> {};
46template <
typename T>
inline constexpr bool ForwardIterator = IteratorConcept<T, forward_iterator_tag> {};
47template <
typename T>
inline constexpr bool OutputIterator = IteratorConcept<T, output_iterator_tag> {} || ForwardIterator<T>;
48template <
typename T>
inline constexpr bool BidirectionalIterator = IteratorConcept<T, bidirectional_iterator_tag> {};
49template <
typename T>
inline constexpr bool RandomAccessIterator = IteratorConcept<T, random_access_iterator_tag> {};
50template <
typename T>
inline constexpr bool RandomAccessRange = RandomAccessIterator<range_iterator_t<T>>;
Definition adjacent_find.hpp:9
iterator_traits is the type trait class that provides uniform interface to the properties of LegacyIt...
Definition iterator_traits.hpp:48