VCCC  2024.05
VisualCamp Common C++ library
const_sentinel_t.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2024-01-27.
3 //
4 
5 #ifndef VCCC_RANGES_CONST_SENTINEL_T_HPP_
6 #define VCCC_RANGES_CONST_SENTINEL_T_HPP_
7 
8 #include <type_traits>
9 
10 #include "vccc/__ranges/cend.hpp"
11 #include "vccc/__ranges/range.hpp"
13 
14 namespace vccc {
15 namespace ranges {
16 namespace detail {
17 
19 struct const_sentinel_impl {};
20 
21 template<typename R>
22 struct const_sentinel_impl<R, true, void_t<decltype( ranges::cend(std::declval<R&>()) )>> {
23  using type = decltype(ranges::cend(std::declval<R&>()));
24 };
25 
26 } // namespace detail
27 
30 
31 template<typename R>
32 struct const_sentinel : detail::const_sentinel_impl<R> {};
33 
34 template<typename R>
36 
38 
39 } // namespace ranges
40 } // namespace vccc
41 
42 #endif // VCCC_RANGES_CONST_SENTINEL_T_HPP_
typename const_sentinel< R >::type const_sentinel_t
Definition: const_sentinel_t.hpp:35
constexpr VCCC_INLINE_OR_STATIC detail::cend_niebloid cend
returns a sentinel indicating the end of a read-only range
Definition: cend.hpp:46
void void_t
Definition: void_t.hpp:19
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
Definition: const_sentinel_t.hpp:32