[range.as.rvalue.overview]

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

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.as.rvalue.overview)

### 25.7.7 As rvalue view [[range.as.rvalue]](range.as.rvalue#overview)

#### 25.7.7.1 Overview [range.as.rvalue.overview]

[1](#1)

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

as_rvalue_view presents a view of an underlying sequence
with the same behavior as the underlying sequence
except that its elements are rvalues[.](#1.sentence-1)

Some generic algorithms can be called with an as_rvalue_view to replace copying with moving[.](#1.sentence-2)

[2](#2)

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

The name views​::​as_rvalue denotes
a range adaptor object ([[range.adaptor.object]](range.adaptor.object "25.7.2 Range adaptor objects"))[.](#2.sentence-1)

Let E be an expression and let T be decltype((E))[.](#2.sentence-2)

The expression views​::​as_rvalue(E) is expression-equivalent to:

- [(2.1)](#2.1)

  views​::​all(E) ifT models [input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") and[same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<range_rvalue_reference_t<T>, range_reference_t<T>> is true[.](#2.1.sentence-1)

- [(2.2)](#2.2)

  Otherwise, as_rvalue_view(E)[.](#2.2.sentence-1)

[3](#3)

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

[*Example [1](#example-1)*: vector<string> words = {"the", "quick", "brown", "fox", "ate", "a", "pterodactyl"};
vector<string> new_words;
ranges::copy(words | views::as_rvalue, back_inserter(new_words)); // moves each string from words into new_words â *end example*]
