17 #ifndef OPENKALMAN_COMPATIBILITY_VIEWS_REF_VIEW_HPP 18 #define OPENKALMAN_COMPATIBILITY_VIEWS_REF_VIEW_HPP 25 #ifdef __cpp_lib_ranges 26 using std::ranges::ref_view;
37 static_assert(std::is_object_v<R>);
39 static void FUN(R&&) =
delete;
46 template<
typename T, std::enable_if_t<stdex::convertible_to<T, R&> and (not std::is_same_v<stdex::remove_cvref_t<T>, ref_view>),
int> = 0,
47 typename = std::
void_t<decltype(FUN(std::declval<T>()))>>
49 ref_view(T&& t) : r_ {std::addressof(static_cast<R&>(std::forward<T>(t)))} {}
56 base()
const {
return *r_; }
62 constexpr stdex::ranges::iterator_t<R>
begin()
const {
return stdex::ranges::begin(*r_); }
68 constexpr stdex::ranges::sentinel_t<R>
end()
const {
return stdex::ranges::end(*r_); }
74 constexpr
bool empty()
const {
return stdex::ranges::empty(*r_); }
80 template<
bool Enable = true, std::enable_if_t<Enable and sized_range<R>,
int> = 0>
98 constexpr
bool enable_borrowed_range<ref_view<R>> =
true;
constexpr bool empty() const
Indicates whether the view is empty.
Definition: ref_view.hpp:74
constexpr stdex::ranges::iterator_t< R > begin() const
Definition: ref_view.hpp:62
constexpr R & base() const
Definition: ref_view.hpp:56
Definition: view_interface.hpp:32
Definitions relating to the availability of c++ language features.
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
Definition: ref_view.hpp:33
constexpr ref_view(T &&t)
Construct from a range.
Definition: ref_view.hpp:49
constexpr auto size() const
The size of the object.
Definition: ref_view.hpp:81
constexpr stdex::ranges::sentinel_t< R > end() const
Definition: ref_view.hpp:68