17 #ifndef OPENKALMAN_COMPATIBILITY_VIEWS_REF_VIEW_HPP 18 #define OPENKALMAN_COMPATIBILITY_VIEWS_REF_VIEW_HPP 20 #ifndef __cpp_lib_ranges 36 static_assert(std::is_object_v<R>);
38 static void FUN(R&&) =
delete;
45 template<
typename T, std::enable_if_t<std::is_convertible_v<T, R&> and (not std::is_same_v<remove_cvref_t<T>, ref_view>),
int> = 0,
46 typename = std::
void_t<decltype(FUN(std::declval<T>()))>>
48 ref_view(T&& t) : r_ {std::addressof(static_cast<R&>(std::forward<T>(t)))} {}
55 base()
const {
return *r_; }
61 constexpr ranges::iterator_t<R>
begin()
const {
return ranges::begin(*r_); }
67 constexpr ranges::sentinel_t<R>
end()
const {
return ranges::end(*r_); }
73 constexpr
bool empty()
const {
return ranges::empty(*r_); }
79 template<
bool Enable = true, std::enable_if_t<Enable and sized_range<R>,
int> = 0>
97 constexpr
bool enable_borrowed_range<ref_view<R>> =
true;
103 #endif //OPENKALMAN_COMPATIBILITY_VIEWS_REF_VIEW_HPP Definition: view_interface.hpp:32
Definition: range-access.hpp:25
constexpr ranges::iterator_t< R > begin() const
Definition: ref_view.hpp:61
constexpr ref_view(T &&t)
Construct from a range.
Definition: ref_view.hpp:48
constexpr bool empty() const
Indicates whether the view is empty.
Definition: ref_view.hpp:73
Definition: ref_view.hpp:32
constexpr ranges::sentinel_t< R > end() const
Definition: ref_view.hpp:67
constexpr bool size
T is either an index representing a size, or void which represents that there is no size...
Definition: size.hpp:32
constexpr R & base() const
Definition: ref_view.hpp:55
constexpr auto size() const
The size of the object.
Definition: ref_view.hpp:80
Definitions implementing features of the c++ ranges library for compatibility.