5 #ifndef VCCC_RANGES_VIEWS_TAKE_HPP
6 #define VCCC_RANGES_VIEWS_TAKE_HPP
10 #include <type_traits>
40 using vccc::detail::return_category;
45 struct return_category_empty_view : std::true_type {
46 using category = return_category<1, decltype(vccc_decay_copy(std::declval<R>()))>;
48 template<
typename R,
typename T,
typename D>
49 struct return_category_empty_view<R, T, D, false> : std::false_type {
50 using category = return_category<0>;
52 template<
typename R,
typename RT>
58 struct is_span : std::false_type {};
59 template<
typename T, std::
size_t Extent>
60 struct is_span<
span<T, Extent>> : std::true_type {};
63 struct return_category_span : std::true_type {
64 using category = return_category<2, span<typename T::element_type>>;
66 template<
typename T,
typename D>
67 struct return_category_span<T, D, false> : std::false_type {
68 using category = return_category<0>;
72 struct return_category_string_view : std::true_type {
73 using category = return_category<2, T>;
76 struct return_category_string_view<T, false> : std::false_type {
77 using category = return_category<0>;
81 struct return_category_subrange : std::true_type {
82 using category = return_category<2, subrange<iterator_t<T>>>;
85 struct return_category_subrange<T, false> : std::false_type {
86 using category = return_category<0>;
89 template<
typename R,
typename U>
98 template<
typename T,
bool = conjunction<is_specialization<T, iota_view>, random_access_range<T>, sized_range<T>>::value >
99 struct return_category_iota_view : std::true_type {
100 using category = return_category<3, T>;
103 struct return_category_iota_view<T, false> : std::false_type {
104 using category = return_category<0>;
106 template<
typename R,
typename IV>
116 struct return_category_repeat_view : std::true_type {
120 struct return_category_repeat_view<T, false> : std::false_type {
121 using category = return_category<0>;
134 template<
typename R,
typename TakeView>
136 return TakeView(std::forward<R>(r), f);
139 template<
typename R,
typename T,
typename D>
153 return_category<5, take_view<views::all_t<R>>>>
164 return (*
this)(std::forward<R>(r),
count, category<R&&, T, D>{});
167 template<
typename DifferenceType>
Definition: range_adaptor.hpp:25
a non-owning view over a contiguous sequence of objects
Definition: span.hpp:118
#define vccc_decay_copy(x)
Definition: decay_copy.hpp:12
constexpr VCCC_INLINE_OR_STATIC detail::count_niebloid count
Definition: count.hpp:58
constexpr T e
the mathematical constant
Definition: constants.hpp:37
constexpr VCCC_INLINE_OR_STATIC detail::iota_niebloid iota
Definition: iota_view.hpp:539
constexpr VCCC_INLINE_OR_STATIC detail::take_niebloid take
Definition: take.hpp:177
constexpr VCCC_INLINE_OR_STATIC detail::begin_niebloid begin
returns an iterator to the beginning of a range
Definition: begin.hpp:116
constexpr VCCC_INLINE_OR_STATIC detail::repeat_niebloid repeat
Definition: repeat.hpp:56
constexpr VCCC_INLINE_OR_STATIC detail::distance_niebloid distance
Definition: distance.hpp:72
typename range_difference< R >::type range_difference_t
Used to obtain the difference type of the iterator type of range type R.
Definition: range_difference_t.hpp:41
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
Models std::convertible_to
Definition: convertible_to.hpp:38
constexpr auto operator()(DifferenceType &&count) const
Definition: take.hpp:168
constexpr auto operator()(R &&r, ranges::range_difference_t< R > count) const
Definition: take.hpp:160