VCCC  2024.05
VisualCamp Common C++ library
sentinel_t.hpp
Go to the documentation of this file.
1 //
2 // Created by cosge on 2023-12-02.
3 //
4 
5 #ifndef VCCC_RANGES_SENTINEL_T_HPP_
6 #define VCCC_RANGES_SENTINEL_T_HPP_
7 
8 #include <type_traits>
9 
10 #include "vccc/__ranges/end.hpp"
11 #include "vccc/__ranges/range.hpp"
13 
14 namespace vccc {
15 namespace ranges {
16 
18 struct sentinel {};
19 
20 template<typename R>
21 struct sentinel<R, true, void_t<decltype( ranges::end(std::declval<R&>()) )>> {
22  using type = decltype(ranges::end(std::declval<R&>()));
23 };
24 
27 
28 template<typename R>
29 using sentinel_t = typename sentinel<R>::type;
30 
32 
33 } // namespace ranges
34 } // namespace vccc
35 
36 #endif // VCCC_RANGES_SENTINEL_T_HPP_
typename sentinel< R >::type sentinel_t
Definition: sentinel_t.hpp:29
constexpr VCCC_INLINE_OR_STATIC detail::end_niebloid end
returns a sentinel indicating the end of a range
Definition: end.hpp:120
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
decltype(ranges::end(std::declval< R & >())) type
Definition: sentinel_t.hpp:22
Definition: sentinel_t.hpp:18