Files
2025-10-25 03:02:53 +03:00

32 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[range.single.overview]
# 25 Ranges library [[ranges]](./#ranges)
## 25.6 Range factories [[range.factories]](range.factories#range.single.overview)
### 25.6.3 Single view [[range.single]](range.single#overview)
#### 25.6.3.1 Overview [range.single.overview]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2626)
single_view produces a view that contains
exactly one element of a specified value[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2630)
The name views::single denotes a
customization point object ([[customization.point.object]](customization.point.object "16.3.3.3.5Customization Point Object types"))[.](#2.sentence-1)
Given a subexpression E, the expressionviews::single(E) is expression-equivalent tosingle_view<decay_t<decltype((E))>>(E)[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2638)
[*Example [1](#example-1)*: for (int i : views::single(4)) cout << i; // prints 4 — *end example*]