[spanbuf.virtuals] (original) (raw)

31 Input/output library [input.output]

31.9 Span-based streams [span.streams]

31.9.3 Class template basic_spanbuf [spanbuf]

31.9.3.5 Overridden virtual functions [spanbuf.virtuals]

[Note 1:

Because the underlying buffer is of fixed size, neither overflow, underflow, nor pbackfailcan provide useful behavior.

— _end note_]

pos_type seekoff(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out) override;

Effects: Alters the stream position within one or both of the controlled sequences, if possible, as follows:

If both ios_base​::​in and ios_base​::​out are set in whichand way is ios_base​::​cur, the positioning operation fails.

For a sequence to be positioned, if its next pointer xnext (either gptr() or pptr()) is a null pointer and the new offset newoff as computed below is nonzero, the positioning operation fails.

Otherwise, the function determines baseoffas a value of type off_type as follows:

If would overflow, or if is less than zero, or if is greater than buf.size(), the positioning operation fails.

Otherwise, the function computesoff_type newoff = baseoff + off;and assigns xbeg + newoff to the next pointer xnext.

Returns: pos_type(off_type(-1)) if the positioning operation fails;pos_type(newoff) otherwise.

pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;

Effects: Equivalent to:return seekoff(off_type(sp), ios_base::beg, which);

basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n) override;

Effects: Equivalent to:this->span(std::span<charT>(s, n));return this;