17 #ifndef OPENKALMAN_COMPATIBILITY_VIEWS_OWNING_VIEW_HPP 18 #define OPENKALMAN_COMPATIBILITY_VIEWS_OWNING_VIEW_HPP 20 #ifndef __cpp_lib_ranges 34 static_assert(std::is_object_v<std::remove_reference_t<R>> and std::is_move_constructible_v<std::remove_reference_t<R>> and
35 std::is_assignable_v<std::remove_reference_t<R>&, std::remove_reference_t<R>> and
42 template<
typename aR = R, std::enable_if_t<std::is_default_constructible_v<aR>,
int> = 0>
71 constexpr decltype(
auto)
75 constexpr decltype(
auto)
76 base() const & {
return my_r; }
79 constexpr decltype(
auto)
80 base() && noexcept {
return std::move(*this).my_r; }
83 constexpr decltype(
auto)
84 base() const && noexcept {
return std::move(*this).my_r; }
90 constexpr
auto begin() {
return ranges::begin(my_r); }
93 template<
bool Enable = true, std::enable_if_t<Enable and range<const R>,
int> = 0>
94 constexpr
auto begin()
const {
return ranges::begin(my_r); }
100 constexpr
auto end() {
return ranges::end(my_r); }
103 template<
bool Enable = true, std::enable_if_t<Enable and range<const R>,
int> = 0>
104 constexpr
auto end()
const {
return ranges::end(my_r); }
110 template<
typename Enable =
void,
typename = std::
void_t<Enable, decltype(ranges::empty(std::declval<R>()))>>
111 constexpr
auto empty() {
return ranges::empty(my_r); }
114 template<
typename Enable =
void,
typename = std::
void_t<Enable, decltype(ranges::empty(std::declval<const R>()))>>
115 constexpr
auto empty()
const {
return ranges::empty(my_r); }
121 template<
bool Enable = true, std::enable_if_t<Enable and sized_range<R>,
int> = 0>
125 template<
bool Enable = true, std::enable_if_t<Enable and sized_range<const R>,
int> = 0>
136 constexpr
bool enable_borrowed_range<owning_view<R>> = enable_borrowed_range<R>;
144 #endif //OPENKALMAN_COMPATIBILITY_VIEWS_OWNING_VIEW_HPP constexpr auto begin() const
Definition: owning_view.hpp:94
Definition: view_interface.hpp:32
constexpr owning_view()
Default constructor.
Definition: owning_view.hpp:44
constexpr auto empty() const
Definition: owning_view.hpp:115
constexpr owning_view(R &&t)
Construct from a collection.
Definition: owning_view.hpp:58
constexpr auto begin()
Definition: owning_view.hpp:90
Definition: range-access.hpp:25
constexpr bool size
T is either an index representing a size, or void which represents that there is no size...
Definition: size.hpp:32
Definition: owning_view.hpp:32
decltype(auto) constexpr base() &
Get the base object.
Definition: owning_view.hpp:72
constexpr owning_view & operator=(owning_view &&other)=default
Move assignment operator.
constexpr auto empty()
Indicates whether the view is empty.
Definition: owning_view.hpp:111
Definitions implementing features of the c++ ranges library for compatibility.
constexpr auto end() const
Definition: owning_view.hpp:104
constexpr auto size() const noexcept
Definition: owning_view.hpp:126
constexpr auto end()
Definition: owning_view.hpp:100
Whether the argument is a specialization of std::initializer_list.
Definition: global-definitions.hpp:165
constexpr auto size() noexcept
The size of the object.
Definition: owning_view.hpp:122