5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ITERATOR_CATEGORY_TRAITS_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ITERATOR_CATEGORY_TRAITS_HPP_
12#include "arene/base/stdlib_choice/declval.hpp"
13#include "arene/base/stdlib_choice/enable_if.hpp"
14#include "arene/base/stdlib_choice/is_assignable.hpp"
15#include "arene/base/stdlib_choice/is_base_of.hpp"
16#include "arene/base/stdlib_choice/is_convertible.hpp"
17#include "arene/base/stdlib_choice/is_copy_assignable.hpp"
18#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
19#include "arene/base/stdlib_choice/is_default_constructible.hpp"
20#include "arene/base/stdlib_choice/is_integral.hpp"
21#include "arene/base/stdlib_choice/is_pointer.hpp"
22#include "arene/base/stdlib_choice/is_reference.hpp"
23#include "arene/base/stdlib_choice/is_same.hpp"
24#include "arene/base/stdlib_choice/is_signed.hpp"
25#include "arene/base/stdlib_choice/iterator_tags.hpp"
26#include "arene/base/stdlib_choice/iterator_traits.hpp"
27#include "arene/base/stdlib_choice/remove_cv.hpp"
28#include "arene/base/stdlib_choice/remove_reference.hpp"
37namespace iterator_category_detail {
49template <
typename T,
typename = constra
ints<>>
50constexpr bool is_basic_iterator_v =
false;
55constexpr bool is_basic_iterator_v<
58 typename std::iterator_traits<T>::iterator_category,
59 std::enable_if_t<std::is_copy_constructible<T>::value>,
60 std::enable_if_t<std::is_copy_assignable<T>::value>,
68template <
typename T,
typename = constra
ints<>>
69constexpr bool has_output_iterator_category_v =
false;
74constexpr bool has_output_iterator_category_v<
77 std::is_base_of<std::output_iterator_tag, typename std::iterator_traits<T>::iterator_category>::value>>> =
true;
84template <
class T1,
class T2,
class X>
92template <
typename T1,
typename T2,
typename = constra
ints<>>
93class simple_common_lvalue_reference {};
100template <
typename T1,
typename T2>
101class simple_common_lvalue_reference<
118template <
typename T1,
typename T2>
119using simple_common_lvalue_reference_t =
typename simple_common_lvalue_reference<T1, T2>::type;
126template <
typename T1,
typename T2,
typename = constra
ints<>>
127class simple_common_reference {};
134template <
typename T1,
typename T2>
135using simple_common_reference_t =
typename simple_common_reference<T1, T2>::type;
142template <
typename T1,
typename T2>
143class simple_common_reference<T1&, T2&, constraints<simple_common_lvalue_reference_t<T1&, T2&>>> {
146 using type = simple_common_lvalue_reference_t<T1&, T2&>;
154template <
typename T1,
typename T2>
155class simple_common_reference<
173template <
typename A,
typename B>
174class simple_common_reference<
177 constraints<std::enable_if_t<std::is_convertible<B&&, simple_common_reference_t<A&, B const&>>::value>>> {
180 using type = simple_common_reference_t<A&, B const&>;
188template <
typename A,
typename B>
189class simple_common_reference<B&&, A&> :
public simple_common_reference<A&, B&&> {};
199template <
typename T,
typename U,
typename = constra
ints<>>
200constexpr bool have_common_type_v =
false;
205template <
typename T,
typename U>
206constexpr bool have_common_type_v<
211 simple_common_reference_t<T, U>>> =
true;
216template <
typename T,
typename U>
217constexpr bool have_common_type_v<
229template <
typename T,
typename = constra
ints<>>
230constexpr bool has_valid_pointer_trait_v =
236constexpr bool has_valid_pointer_trait_v<T, constraints<decltype(std::declval<T&>().operator->())>> =
244template <
typename T,
typename = constra
ints<>>
252 iterator_category_detail::has_output_iterator_category_v<T> ||
258template <
typename T,
typename = constra
ints<>>
284 std::enable_if_t<iterator_category_detail::has_valid_pointer_trait_v<T>>>> =
true;
289template <
typename T,
typename = constra
ints<>>
311template <
typename T,
typename = constra
ints<>>
331template <
typename T,
typename = constra
ints<>>
An empty tag type corresponding to a bidirectional iterator.
Definition iterator_tags.hpp:25
static constexpr value_type value
Definition integral_constant.hpp:34
Type trait to detect if an instance of To is assignable to from arguments of From.
Definition is_assignable.hpp:47
Type trait to detect if Base is a base class of Derived.
Definition is_base_of.hpp:30
Type trait to detect if one type is convertible to another.
Definition is_convertible.hpp:171
Check if the supplied template argument is a reference or not. The value member is true if so,...
Definition is_reference.hpp:29
Trait to detect if the two template parameters are the same or not. The value member is true if the t...
Definition is_same.hpp:35
provides a uniform interface to the properties of an iterator
Definition iterator_traits.hpp:90
An empty tag type corresponding to a random access iterator.
Definition iterator_tags.hpp:29
Definition accumulate.hpp:37
constexpr bool is_random_access_iterator_v
Definition iterator_category_traits.hpp:332
constexpr bool is_output_iterator_v
Definition iterator_category_traits.hpp:245
constexpr bool is_forward_iterator_v
Definition iterator_category_traits.hpp:290
constexpr bool is_iterator_v
Definition iterator_category_traits.hpp:375
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Backport of std::remove_cvref_t.
Definition remove_cvref.hpp:35
typename static_if< give_qualifiers_to_detail::is_volatile_v< Source > >::template then_apply_else_apply< give_qualifiers_to_detail::give_qualifiers_to_impl_volatile, give_qualifiers_to_detail::give_qualifiers_to_impl_nonvolatile, Source, Target > give_qualifiers_to
For a type Source and type Target: if Source is const volatile results in Target const volatile other...
Definition give_qualifiers_to.hpp:68
constexpr bool is_input_iterator_v
Definition iterator_category_traits.hpp:259
constexpr bool is_bidirectional_iterator_v
Definition iterator_category_traits.hpp:312
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
typename remove_reference< T >::type remove_reference_t
An alias for T, but with top-level reference qualifiers removed.
Definition remove_reference.hpp:47