17 #ifndef OPENKALMAN_COMPATIBILITY_VIEWS_OWNING_VIEW_HPP 18 #define OPENKALMAN_COMPATIBILITY_VIEWS_OWNING_VIEW_HPP 25 #ifdef __cpp_lib_ranges 26 using std::ranges::owning_view;
35 static_assert(std::is_object_v<std::remove_reference_t<R>> and std::is_move_constructible_v<std::remove_reference_t<R>> and
36 std::is_assignable_v<std::remove_reference_t<R>&, std::remove_reference_t<R>> and
43 template<
bool Enable = true, std::enable_if_t<Enable and stdex::default_initializable<R>,
int> = 0>
72 constexpr decltype(
auto)
76 constexpr decltype(
auto)
77 base() const & {
return my_r; }
80 constexpr decltype(
auto)
81 base() && noexcept {
return std::move(*this).my_r; }
84 constexpr decltype(
auto)
85 base() const && noexcept {
return std::move(*this).my_r; }
91 constexpr
auto begin() {
return stdex::ranges::begin(my_r); }
94 template<
bool Enable = true, std::enable_if_t<Enable and range<const R>,
int> = 0>
95 constexpr
auto begin()
const {
return stdex::ranges::begin(my_r); }
101 constexpr
auto end() {
return stdex::ranges::end(my_r); }
104 template<
bool Enable = true, std::enable_if_t<Enable and range<const R>,
int> = 0>
105 constexpr
auto end()
const {
return stdex::ranges::end(my_r); }
111 template<
typename Enable =
void,
typename = std::
void_t<Enable, decltype(stdex::ranges::empty(std::declval<R>()))>>
112 constexpr
auto empty() {
return stdex::ranges::empty(my_r); }
115 template<
typename Enable =
void,
typename = std::
void_t<Enable, decltype(stdex::ranges::empty(std::declval<const R>()))>>
116 constexpr
auto empty()
const {
return stdex::ranges::empty(my_r); }
122 template<
bool Enable = true, std::enable_if_t<Enable and sized_range<R>,
int> = 0>
126 template<
bool Enable = true, std::enable_if_t<Enable and sized_range<const R>,
int> = 0>
137 constexpr
bool enable_borrowed_range<owning_view<R>> = enable_borrowed_range<R>;
decltype(auto) constexpr base() &
Get the base object.
Definition: owning_view.hpp:73
constexpr auto size() noexcept
The size of the object.
Definition: owning_view.hpp:123
constexpr auto end() const
Definition: owning_view.hpp:105
Definition: view_interface.hpp:32
constexpr auto end()
Definition: owning_view.hpp:101
Exposition-only definitions from teh c++ language standard.
constexpr owning_view & operator=(owning_view &&other)=default
Move assignment operator.
Definition: common.hpp:200
constexpr bool size
T is either an index representing a size, or unbounded_size_t, which indicates that the size is unbou...
Definition: size.hpp:65
constexpr auto begin()
Definition: owning_view.hpp:91
constexpr auto empty() const
Definition: owning_view.hpp:116
constexpr auto begin() const
Definition: owning_view.hpp:95
constexpr owning_view()
Default constructor.
Definition: owning_view.hpp:45
Whether the argument is a specialization of std::initializer_list.
Definition: exposition.hpp:76
constexpr auto size() const noexcept
Definition: owning_view.hpp:127
constexpr auto empty()
Indicates whether the view is empty.
Definition: owning_view.hpp:112
constexpr owning_view(R &&t)
Construct from a collection.
Definition: owning_view.hpp:59
Definition: owning_view.hpp:33