1#ifndef HALCHECK_LIB_ITERATOR_REF_HPP
2#define HALCHECK_LIB_ITERATOR_REF_HPP
6#include <halcheck/lib/iterator/interface.hpp>
7#include <halcheck/lib/iterator/range.hpp>
8#include <halcheck/lib/pp.hpp>
9#include <halcheck/lib/type_traits.hpp>
13namespace halcheck {
namespace lib {
18class ref_view :
public lib::view_interface<ref_view<R>> {
21 static_assert(lib::is_range<R>(),
"R must be a range type");
24 friend class ref_view;
35 constexpr ref_view(T &&base)
38 template<typename T, HALCHECK_REQUIRE(std::is_convertible<T *, R *>())>
39 constexpr ref_view(
const ref_view<T> &other)
40 : _base(other._base) {}
42 constexpr R &base()
const {
return *_base; }
48 template<typename T = R, typename = decltype(lib::empty(std::declval<const T &>()))>
49 constexpr bool empty()
const {
53 template<typename T = R, HALCHECK_REQUIRE(lib::is_sized_range<T>())>
54 constexpr bool size()
const {
67 constexpr lib::ref_view<R> operator()(R &range)
const {
68 return lib::ref_view<R>(range);
decltype(lib::begin(std::declval< T & >())) iterator_t
Obtains the iterator type of a range type.
Definition range.hpp:92
HALCHECK_INLINE_CONSTEXPR struct halcheck::lib::@26 empty
Determines if a range is empty.
HALCHECK_INLINE_CONSTEXPR struct halcheck::lib::@25 size
Obtains the size of a range.
#define HALCHECK_INLINE_CONSTEXPR
A backwards-compatible substitute for inline constexpr.
Definition pp.hpp:70
typename std::remove_cv< typename std::remove_reference< T >::type >::type remove_cvref_t
An implementation of std::remove_cvref_t.
Definition type_traits.hpp:141
#define HALCHECK_REQUIRE(...)
Expands to a template argument that is only valid if the given argument evaluates to true.
Definition type_traits.hpp:24