void init_buf_ptrs(); | (exposition only*) |
Initializes the input and output sequences from buf according to mode. buf and mode are exposition-only data members of *this.
Immediately after this function returns:
std::ios_base::out is set in mode, pbase() points to buf.front() and epptr() >= pbase() + buf.size() is true; std::ios_base::ate is set in mode, pptr() == pbase() + buf.size() is true, pptr() == pbase() is true. std::ios_base::in is set in mode, eback() points to buf.front(), and gptr() == eback() && egptr() == eback() + buf.size() is true. For efficiency reasons, stream buffer operations can violate invariants of buf while it is held encapsulated in the std::basic_stringbuf, e.g., by writing to characters in the range [buf.data() + buf.size(), buf.data() + buf.capacity()).
All operations retrieving a std::basic_string from buf ensure that the std::basic_string invariants hold on the returned value.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 1448 | C++98 | calling init_buf_ptrs() madepptr() == pbase() + buf.data()for streams that are both input and output streams | makespptr() == pbase() + buf.size()for append streams |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/io/basic_stringbuf/init_buf_ptrs