5 #ifndef VCCC_RANGES_END_HPP_
6 #define VCCC_RANGES_END_HPP_
27 using vccc::detail::return_category;
31 template<
typename T,
bool = is_bounded_array<remove_cvref_t<T>>::value>
32 struct end_array_check : std::false_type {
33 using category = return_category<0>;
36 struct end_array_check<T, true> : std::true_type {
37 using category = return_category<1, decltype(std::declval<T>() + std::extent<std::remove_reference_t<T>>
::value)>;
40 template<
typename T,
typename =
void>
41 struct end_member_check : std::false_type {
42 using category = return_category<0>;
46 : sentinel_for<decltype(vccc_decay_copy(std::declval<T>().end())), iterator_t<T>> {
47 using category = return_category<2, decltype(vccc_decay_copy(std::declval<T>().end()))>;
50 template<
typename T,
typename =
void>
51 struct end_global_check : std::false_type {
52 using category = return_category<0>;
56 : sentinel_for<decltype(vccc_decay_copy(end(std::declval<T>()))), iterator_t<T>> {
57 using category = return_category<3, decltype(vccc_decay_copy(end(std::declval<T>())))>;
61 struct end_category_impl_2 : end_global_check<T> {};
63 struct end_category_impl_2<T, true> : end_member_check<T> {};
66 struct end_category_impl : end_category_impl_2<T> {};
68 struct end_category_impl<T, true> : end_array_check<T> {};
74 std::is_lvalue_reference<T>,
75 enable_borrowed_range<remove_cvref_t<T>>
77 typename end_category_impl<T>::category,
81 template<
typename T,
typename R>
82 constexpr R operator()(T&& t, return_category<1, R>)
const {
83 static_assert(
is_complete<std::remove_all_extents_t<std::remove_reference_t<T>>>::
value,
"Array element must be complete type");
84 return t + std::extent<remove_cvref_t<T>>
::value;
87 template<
typename T,
typename R>
88 constexpr R operator()(T&& t, return_category<2, R>)
const {
92 template<
typename T,
typename R>
93 constexpr R operator()(T&& t, return_category<3, R>)
const {
99 constexpr
typename end_category<T&&>::return_type
100 operator()(T&& t)
const {
101 return (*
this)(std::forward<T>(t), end_category<T&&>{});
125 using namespace niebloid;
#define vccc_decay_copy(x)
Definition: decay_copy.hpp:12
constexpr VCCC_INLINE_OR_STATIC detail::end_niebloid end
returns a sentinel indicating the end of a range
Definition: end.hpp:120
decltype(detail::is_complete_impl(std::declval< T * >())) is_complete
Definition: is_complete.hpp:23
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
Definition: matrix.hpp:495
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35