Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::ranges Namespace Reference

Typedef Documentation

◆ borrowed_iterator_t

template<typename Rng>
using arene::base::ranges::borrowed_iterator_t
Initial value:
conditional_apply_t<is_borrowed_range_v<Rng>, iterator_t, borrowed_iterator_detail::always_dangling, Rng>
typedef iterator_t
The type of the iterator for a given range.
Definition begin_end.hpp:186
typename static_if< B >::template then_apply_else_apply< OnTrue, OnFalse, Args... > conditional_apply_t
lazily apply one of two template aliases based on a boolean condition
Definition conditional.hpp:73

A type alias conditionally selects between a ranges iterator or arene::base::dangling .

Template Parameters
RngThe range type for which to obtain the borrowed iterator type.

If Rng satisfies arene::base::is_borrowed_range_v<Rng>, the type alias resolves to arene::base::ranges::iterator_t<Rng> . Otherwise, it resolves to arene::base::ranges::dangling . This can be used to safely create range algorithms which should match all range types, but only return valid content if the input is a borrowed range.

Function Documentation

◆ ARENE_CPP14_INLINE_VARIABLE() [1/4]

arene::base::ranges::ARENE_CPP14_INLINE_VARIABLE ( begin_end_detail::accessor_fn< begin_end_detail::begin_policy > ,
begin  )

returns an iterator to the beginning of a range

Template Parameters
RngThe type of the range to get the beginning of. Must satisfy either std::is_lvalue_reference<Rng> or enable_borrowed_range_v<Rng>. The range to inspect is passed as rng.
Returns
An iterator to the beginning of the range This operation is expression-equivalent to one of the following operations, in order of preference:
  1. If Rng satisfies std::is_array<Rng> , returns &rng[0] .
  2. If rng.begin() is well-formed, returns rng.begin() .
  3. Otherwise, if begin(rng) is well-formed, returns begin(rng) .

If none of the requirements are satisfied, the function does not participate in overload resolution.

◆ ARENE_CPP14_INLINE_VARIABLE() [2/4]

arene::base::ranges::ARENE_CPP14_INLINE_VARIABLE ( begin_end_detail::accessor_fn< begin_end_detail::end_policy > ,
end  )

returns an iterator to the end of a range

Template Parameters
RngThe type of the range to get the end of. Must satisfy either std::is_lvalue_reference<Rng> or enable_borrowed_range_v<Rng>. The range to inspect is passed as rng.
Returns
An iterator to the end of the range This operation is expression-equivalent to one of the following operations, in order of preference:
  1. If Rng satisfies std::is_array<Rng> , returns &rng[std::extent<Rng>::value] .
  2. If rng.end() is well-formed, returns rng.end() .
  3. Otherwise, if end(rng) is well-formed, returns end(rng) .

If none of the requirements are satisfied, the function does not participate in overload resolution.

◆ ARENE_CPP14_INLINE_VARIABLE() [3/4]

arene::base::ranges::ARENE_CPP14_INLINE_VARIABLE ( itr_move_detail::iter_move_fn ,
iter_move  )

Performs the move operation on dereferenced value of a dereferenceable type.

Template Parameters
ItrThe type of the iterator to apply iter_move to. The iterator to move from is passed as iterator.
Returns
The result of applying iter_move to the iterator.

This operation is expression-equivalent to one of the following operations, in order of preference:

  1. If Itr satisfies either std::is_class or std::is_enum , and iter_move(itr) is well-formed by argument dependent lookup, returns iter_move(itr) .
  2. Otherwise, if *itr is well-formed:
    • if *itr is an lvalue reference, returns std::move(*itr) .
    • otherwise, returns *itr .

If none of the requirements are satisfied, then iter_move is ill-formed. This can cause a substitution failure when iter_move appears in the context of a template instantiation.

◆ ARENE_CPP14_INLINE_VARIABLE() [4/4]

arene::base::ranges::ARENE_CPP14_INLINE_VARIABLE ( size_detail::size_fn ,
size  )

Returns an integer equal to the size of a range.

size is intended to be a constant time operation. Callers of this function should generally assume this runs in constant time and is ill-formed for types which don't have a constant-time size, but we can not enforce this for range types that we don't control. Use arene::base::distance if you want to disclaim this constant time guarantee.

To container implementers: if your container has member or ADL size functions then size will pick them up and assume that they can operate in constant time. If your type's size is not constant time, specialize arene::base::ranges::disable_sized_range for it so that size ignores those functions.

Variable Documentation

◆ disable_sized_range_v

template<typename Rng>
bool arene::base::ranges::disable_sized_range_v {disable_sized_range<Rng>::value}
externconstexpr

Accessor for the value of disable_sized_range .

Template Parameters
RngThe range type to check.
Returns
Equivalent to disable_sized_range<Rng>::value .

◆ enable_borrowed_range_v

template<typename Rng>
bool arene::base::ranges::enable_borrowed_range_v = enable_borrowed_range<Rng>::value
externconstexpr

Query if a range type has opted into being a borrowed range.

Template Parameters
RngThe range type to check.
Returns
bool Equivalent to enable_borrowed_range<Rng>::value .
Note
Users should generally not query enable_borrowed_range_v directly; it is intended for use by the range library to detect enable_borrowed_range customizations, and should only be used for that purpose. Instead, use arene::base::is_borrowed_range_v<Rng> to query if a type qualifies as a borrowed range when implementing generic algorithms.

◆ is_borrowed_range_v

template<typename Rng>
bool arene::base::ranges::is_borrowed_range_v
externconstexpr
Initial value:
{
}
static constexpr value_type value
Definition integral_constant.hpp:34
constexpr bool enable_borrowed_range_v
Query if a range type has opted into being a borrowed range.
constexpr bool is_range_v
Predicate to check if a type is a range.

Predicate to check if a type is a borrowed range.

Template Parameters
RngThe type to check.
Returns
bool Equivalent to is_borrowed_range<Rng>::value .

◆ is_range_v

template<typename Rng>
bool arene::base::ranges::is_range_v {substitution_succeeds<is_range_detail::use_begin, Rng> && substitution_succeeds<is_range_detail::use_end, Rng>}
externconstexpr

Predicate to check if a type is a range.

Template Parameters
RngThe type to check.
Returns
bool true if Rng is a range, false otherwise. A type Rng is considered a range if and only if all of the following are true when considering an instance rng of Rng, with the ref-qualification of Rng preserved:
  1. ranges::begin(rng) is a well-formed expression.
  2. ranges::end(rng) is a well-formed expression.

◆ iterator_t

template<typename Rng>
using arene::base::ranges::iterator_t

The type of the iterator for a given range.

Template Parameters
RngThe type of the range to extract the iterator for.

◆ sentinel_t

template<typename Rng>
using arene::base::ranges::sentinel_t

The type of the sentinel (end iterator) for a given range.

Template Parameters
RngThe type of the range to extract the sentinel for.