---
name: "std::ranges::single_view"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::ranges::single_view"
---

# std::ranges::single\_view(3)

A view that contains exactly one element.

## NAME

std::ranges::single\_view\< \_Tp \> - A view that contains exactly one element.

## SYNOPSIS

\#include \<ranges\>

Inherits **std::ranges::view\_interface\< single\_view\< \_Tp \> \>**.

### Public Member Functions

constexpr **single\_view** (\_Tp &&\_\_t) noexcept(is\_nothrow\_move\_constructible\_v\< \_Tp \>)\
 constexpr **single\_view** (const \_Tp &\_\_t) noexcept(is\_nothrow\_copy\_constructible\_v\< \_Tp \>)\
 template\<typename... \_Args\> constexpr **single\_view** (in\_place\_t, \_Args &&... \_\_args) noexcept(is\_nothrow\_constructible\_v\< \_Tp, \_Args... \>)\
 constexpr decltype(auto) **back** ()\
 constexpr const \_Tp \* **begin** () const noexcept\
 constexpr \_Tp \* **begin** () noexcept\
 constexpr auto **cbegin** ()\
 constexpr auto **cend** ()\
 constexpr const \_Tp \* **data** () const noexcept\
 constexpr \_Tp \* **data** () noexcept\
 constexpr const \_Tp \* **end** () const noexcept\
 constexpr \_Tp \* **end** () noexcept\
 constexpr decltype(auto) **front** ()\
 constexpr **operator bool** () noexcept(noexcept(ranges::empty(\_M\_derived())))\
 constexpr decltype(auto) **operator\[\]** (range\_difference\_t\< \_Range \> \_\_n)\

### Static Public Member Functions

static constexpr bool **empty** () noexcept\
 static constexpr size\_t **size** () noexcept\

## Detailed Description

### template\<copy\_constructible \_Tp\>

requires is\_object\_v\<\_Tp\>\
 class std::ranges::single\_view\< \_Tp \>"A view that contains exactly one element.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
