Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::ranges::enable_borrowed_range< Rng > Class Template Reference

An opt-in trait to indicate that a range type is a borrowed range. More...

Inheritance diagram for arene::base::ranges::enable_borrowed_range< Rng >:
Inheritance graph

Additional Inherited Members

- Public Types inherited from std::integral_constant< bool, Value >< false >
using type
 The type of this class.
 
using type
 The type of this class.
 
using value_type
 The type of the value.
 
using value_type
 The type of the value.
 
- Public Member Functions inherited from std::integral_constant< bool, Value >< false >
constexpr operator value_type () const noexcept
 Implicit conversion to Type.
 
constexpr operator value_type () const noexcept
 Implicit conversion to Type.
 
constexpr operator value_type () const noexcept
 Implicit conversion to Type.
 
constexpr operator value_type () const noexcept
 Implicit conversion to Type.
 
constexpr auto operator() () const noexcept -> value_type
 Nullary function call operator.
 
constexpr auto operator() () const noexcept -> value_type
 Nullary function call operator.
 
constexpr auto operator() () const noexcept -> value_type
 Nullary function call operator.
 
constexpr auto operator() () const noexcept -> value_type
 Nullary function call operator.
 
- Static Public Attributes inherited from std::integral_constant< bool, Value >< false >
static constexpr value_type value
 The constant.
 
static constexpr value_type value
 The constant.
 
static constexpr value_type value
 The constant.
 
static constexpr value_type value
 The constant.
 

Detailed Description

template<typename Rng>
class arene::base::ranges::enable_borrowed_range< Rng >

An opt-in trait to indicate that a range type is a borrowed range.

Template Parameters
RngThe range type to check.

A borrowed range is a range whose iterators remain valid even after the range object is destroyed: for example arene::base::span and arene::base::string_view are borrowed ranges, while arene::base::inline_vector and arene::base::inline_string are not.

Users may specialize enable_borrowed_range for their range types to indicate that they are borrowed ranges by providing a static value member of type bool which indicates if the range type is a borrowed range or not (typically by inheriting from std::true_type if it is unconditional). The default specialization is false .

/// @brief A user specialization of @c enable_borrowed_range which is unconditionally a borrowed range.
/// @note The specialization must be contained in the @c arene::base::ranges namespace.
/// This means doing it at global scope if done using an FQN like this example, or by explicitly opening
/// the @c arene::base::ranges namespace and placing it inside it.
template <typename T>
class arene::base::ranges::enable_borrowed_range<ranges_examples::user_borrowed_range<T>> : public std::true_type {};

The documentation for this class was generated from the following file: