VCCC  2024.05
VisualCamp Common C++ library
elements.hpp
Go to the documentation of this file.
1 //
2 // Created by yonggyulee on 2024/01/22.
3 //
4 
5 #ifndef VCCC_RANGES_VIEWS_ELEMENTS_HPP
6 #define VCCC_RANGES_VIEWS_ELEMENTS_HPP
7 
8 #include <type_traits>
9 #include <utility>
10 
16 
17 namespace vccc {
18 namespace ranges {
19 namespace views {
20 namespace detail {
21 
22 template<std::size_t N>
23 class elements_adaptor_object : public range_adaptor_closure<elements_adaptor_object<N>> {
24  public:
25  constexpr elements_adaptor_object() = default;
26 
28  constexpr auto operator()(R&& r) const {
29  return elements_view<all_t<R>, N>(std::forward<R>(r));
30  }
31 };
32 
33 } // namespace detail
34 
88 
89 template<std::size_t N>
90 VCCC_INLINE_OR_STATIC constexpr detail::elements_adaptor_object<N> elements{};
91 
93 
94 } // namespace views
95 } // namespace ranges
96 } // namespace vccc
97 
98 #endif // VCCC_RANGES_VIEWS_ELEMENTS_HPP
Definition: elements_view.hpp:93
constexpr auto operator()(R &&r) const
Definition: elements.hpp:28
#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
helper base class template for defining a range adaptor closure object
Definition: range_adaptor_closure.hpp:96