VCCC  2024.05
VisualCamp Common C++ library
contiguous_range.hpp
Go to the documentation of this file.
1 //
2 // Created by yonggyulee on 2023/12/30.
3 //
4 
5 #ifndef VCCC_RANGES_CONTIGUOUS_RANGE_HPP
6 #define VCCC_RANGES_CONTIGUOUS_RANGE_HPP
7 
8 #include <type_traits>
9 
12 #include "vccc/__ranges/data.hpp"
19 
20 namespace vccc {
21 namespace ranges {
22 namespace detail {
23 
24 template<
25  typename T,
26  bool =
27  conjunction<
28  contiguous_iterator< iterator_t<T> >,
29  is_invocable<decltype(ranges::data), T&>
30  >::value /* true */
31 >
32 struct contiguous_range_impl_2
33  : same_as<
34  decltype( ranges::data(std::declval<T&>()) ),
35  std::add_pointer_t<range_reference_t<T>>
36  > {};
37 template<typename T>
38 struct contiguous_range_impl_2<T, false> : std::false_type {};
39 
40 template<
41  typename T,
42  bool =
43  conjunction<
44  random_access_range<T>,
45  has_typename_type< iterator<T> >,
46  has_typename_type< range_reference<T> >
47  >::value /* true */
48 >
49 struct contiguous_range_impl_1 : contiguous_range_impl_2<T> {};
50 template<typename T>
51 struct contiguous_range_impl_1<T, false> : std::false_type {};
52 
53 } // namespace ranges
54 
57 
68 template<typename T>
69 struct contiguous_range : detail::contiguous_range_impl_1<T> {};
70 
72 
73 } // namespace vccc
74 } // namespace ranges
75 
76 #endif // VCCC_RANGES_CONTIGUOUS_RANGE_HPP
constexpr VCCC_INLINE_OR_STATIC detail::data_niebloid data
obtains a pointer to the beginning of a contiguous range
Definition: data.hpp:103
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
specifies a range whose iterator type satisfies contiguous_iterator
Definition: contiguous_range.hpp:69