[spanbuf.members]

# 31 Input/output library [[input.output]](./#input.output)

## 31.9 Span-based streams [[span.streams]](span.streams#spanbuf.members)

### 31.9.3 Class template basic_spanbuf [[spanbuf]](spanbuf#members)

#### 31.9.3.4 Member functions [spanbuf.members]

[ð](#lib:span,basic_spanbuf)

`std::span<charT> span() const noexcept;
`

[1](#1)

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

*Returns*: If ios_base​::​out is set in *mode*,
returns std​::​span<charT>(pbase(), pptr()),
otherwise returns *buf*[.](#1.sentence-1)

[*Note [1](#note-1)*:

In contrast to basic_stringbuf,
the underlying sequence never grows and is not owned[.](#1.sentence-2)

An owning copy can be obtained
by converting the result to basic_string<charT>[.](#1.sentence-3)

â *end note*]

[ð](#lib:span,basic_spanbuf_)

`void span(std::span<charT> s) noexcept;
`

[2](#2)

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

*Effects*: *buf* = s[.](#2.sentence-1)

Initializes the input and output sequences according to *mode*[.](#2.sentence-2)

[3](#3)

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

*Postconditions*: 

- [(3.1)](#3.1)

  If ios_base​::​out is set in *mode*,pbase() == s.data() && epptr() == pbase() + s.size() is true;
  * [(3.1.1)](#3.1.1)

in addition, if ios_base​::​ate is set in *mode*,pptr() == pbase() + s.size() is true,

  * [(3.1.2)](#3.1.2)

otherwise pptr() == pbase() is true[.](#3.1.sentence-1)

- [(3.2)](#3.2)

  If ios_base​::​in is set in *mode*,eback() == s.data() && gptr() == eback() && egptr() == eback() + s.size() is true[.](#3.2.sentence-1)
