/usr/include/range/v3/action/concepts.hpp is in librange-v3-dev 0.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /// \file
// Range v3 library
//
// Copyright Eric Niebler 2013-present
//
// Use, modification and distribution is subject to the
// Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//
#ifndef RANGES_V3_ACTION_CONCEPTS_HPP
#define RANGES_V3_ACTION_CONCEPTS_HPP
#include <utility>
#include <meta/meta.hpp>
#include <range/v3/range_fwd.hpp>
#include <range/v3/range_concepts.hpp>
#include <range/v3/range_traits.hpp>
#include <range/v3/utility/functional.hpp>
namespace ranges
{
inline namespace v3
{
/// \cond
namespace detail
{
template<typename T>
struct movable_input_iterator
{
using iterator_category = std::input_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = T *;
using reference = T &&;
movable_input_iterator() = default;
movable_input_iterator &operator++();
movable_input_iterator operator++(int);
bool operator==(movable_input_iterator const &) const;
bool operator!=(movable_input_iterator const &) const;
T && operator*() const;
};
}
/// \endcond
/// \addtogroup group-concepts
/// @{
namespace concepts
{
// std::array is a SemiContainer, native arrays are not.
struct SemiContainer
: refines<ForwardRange>
{
template<typename T>
auto requires_() -> decltype(
concepts::valid_expr(
concepts::model_of<DefaultConstructible, uncvref_t<T>>(),
concepts::model_of<Movable, uncvref_t<T>>(),
concepts::is_false(is_view<T>())
));
};
// std::vector is a Container, std::array is not
struct Container
: refines<SemiContainer>
{
template<typename T,
typename I = detail::movable_input_iterator<range_value_type_t<T>>>
auto requires_() -> decltype(
concepts::valid_expr(
concepts::model_of<Constructible, uncvref_t<T>, I, I>()
));
};
}
template<typename T>
using SemiContainer = concepts::models<concepts::SemiContainer, T>;
template<typename T>
using Container = concepts::models<concepts::Container, T>;
namespace concepts
{
struct Reservable
: refines<Container, SizedRange>
{
template<typename C, typename S = concepts::SizedRange::size_t<C>>
auto requires_(C &&c, const C &&cc = C{}, S &&s = S{}) -> decltype(
concepts::valid_expr(
concepts::has_type<S>(cc.capacity()),
concepts::has_type<S>(cc.max_size()),
((void)c.reserve(s), 42)
));
};
struct ReserveAndAssignable
: refines<Reservable(_1), InputIterator(_2)>
{
template<typename C, typename I>
auto requires_(C &&c, I &&i) -> decltype(
concepts::valid_expr(
((void)c.assign(i, i), 42)
));
};
}
template<typename C>
using Reservable = concepts::models<concepts::Reservable, C>;
template<typename C, typename I>
using ReserveAndAssignable =
concepts::models<concepts::ReserveAndAssignable, C, I>;
template<typename C>
using RandomAccessReservable =
meta::strict_and<Reservable<C>, RandomAccessRange<C>>;
/// \cond
namespace detail
{
template<typename T, CONCEPT_REQUIRES_(Container<T>())>
std::true_type is_lvalue_container_like(T &);
template<typename T, CONCEPT_REQUIRES_(Container<T>())>
meta::not_<std::is_rvalue_reference<T>> is_lvalue_container_like(reference_wrapper<T>);
template<typename T, CONCEPT_REQUIRES_(Container<T>())>
std::true_type is_lvalue_container_like(std::reference_wrapper<T>);
}
/// \endcond
namespace concepts
{
struct LvalueContainerLike
: refines<ForwardRange>
{
template<typename T>
auto requires_(T &&t) -> decltype(
concepts::valid_expr(
detail::is_lvalue_container_like(static_cast<T &&>(t))
));
};
}
template<typename T>
using LvalueContainerLike = concepts::models<concepts::LvalueContainerLike, T>;
/// @}
}
}
#endif
|