std::basic_spanbuf<CharT,Traits>::seekoff
From cppreference.com
protected:
pos_type seekoff( off_type off, std::ios_base::seekdir dir,
std::ios_base::openmode which =
std::ios_base::in | std::ios_base::out ) override;
|
(since C++23) | |
Repositions the next pointer to get and/or put area, if possible, to the position that corresponds to exactly off characters from beginning, end, or current position of the get and/or put area of the buffer.
Let n be the number of CharT elements in underlying buffer, or 0 when there is no underlying buffer, this function fails if
- the next pointer to the get and/or put area to reposition is null and the computed
newoff(see below) is not zero, which may occur if there is no underlying buffer, or the*thisis not opened in the mode required bywhich, or diris std::ios_base::cur and both std::ios_base::in and std::ios_base::out are set inwhich, or- the computed
newoffis not representable inoff_type, less than zero, or greater thann.
newoff is computed as below:
- If
diris std::ios_base::beg,newoffisoff. - If
diris std::ios_base::cur,newoffispptr() - pbase() + offif std::ios_base::out is set inwhich, orgptr() - eback() + offif std::ios_base::in is set inwhich.
- If
diris std::ios_base::end,newoffispptr() - pbase() + offif std::ios_base::out but not std::ios_base::in is set in the open mode of*this,- otherwise,
off + n.
This function repositions the next pointer to get and/or put area to pbuf + newoff on success if std::ios_base::in and/or std::ios_base::out is correspondingly set in which, where pbuf is the pointer to the beginning of the underlying buffer, or the null pointer value if there is no underlying buffer.
Contents
Parameters
| off | - | relative position to set the next pointer(s) to | ||||||||
| dir | - | defines base position to apply the relative offset to. It can be one of the following constants:
| ||||||||
| which | - | defines whether the input sequences, the output sequence, or both are affected. It can be one or a combination of the following constants:
|
Return value
pos_type(newoff) on success, pos_type(off_type(-1)) on failure.
Example
| This section is incomplete Reason: no example |
See also
[virtual] |
repositions the next pointer in the input sequence, output sequence, or both, using relative addressing (virtual protected member function of std::basic_stringbuf<CharT,Traits,Allocator>)
|
[virtual] |
repositions the next pointer in the input sequence, output sequence, or both, using relative addressing (virtual protected member function of std::strstreambuf)
|