[range.ref.view]

# 25 Ranges library [[ranges]](./#ranges)

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.ref.view)

### 25.7.6 All view [[range.all]](range.all#range.ref.view)

#### 25.7.6.2 Class template ref_view [range.ref.view]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L4515)

ref_view is a view of the elements of some other range[.](#1.sentence-1)

[ð](#lib:ref_view)

namespace std::ranges {template<[range](range.range#concept:range "25.4.2 Ranges [range.range]") R>requires is_object_v<R>class ref_view : public view_interface<ref_view<R>> {private: R* *r_*; // *exposition only*public:template<[*different-from*](range.utility.helpers#concept:different-from "25.5.2 Helper concepts [range.utility.helpers]")<ref_view> T>requires *see below*constexpr ref_view(T&& t); constexpr R& base() const { return **r_*; }constexpr iterator_t<R> begin() const { return ranges::begin(**r_*); }constexpr sentinel_t<R> end() const { return ranges::end(**r_*); }constexpr bool empty() constrequires requires { ranges::empty(**r_*); }{ return ranges::empty(**r_*); }constexpr auto size() const requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<R>{ return ranges::size(**r_*); }constexpr auto reserve_hint() const requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<R>{ return ranges::reserve_hint(**r_*); }constexpr auto data() const requires [contiguous_range](range.refinements#concept:contiguous_range "25.4.6 Other range refinements [range.refinements]")<R>{ return ranges::data(**r_*); }}; template<class R> ref_view(R&) -> ref_view<R>;}

[ð](#lib:ref_view,constructor)

`template<[different-from](range.utility.helpers#concept:different-from "25.5.2 Helper concepts [range.utility.helpers]")<ref_view> T>
  requires see below
constexpr ref_view(T&& t);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L4563)

*Effects*: Initializes *r_* withaddressof(static_cast<R&>(std​::​forward<T>(t)))[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L4568)

*Remarks*: Let *FUN* denote the exposition-only functionsvoid *FUN*(R&);void *FUN*(R&&) = delete;

The expression in the [*requires-clause*](temp.pre#nt:requires-clause "13.1 Preamble [temp.pre]") is equivalent to:[convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<T, R&> && requires { *FUN*(declval<T>()); }
