std::basic_streambuf::setg/setpSection: 31.6.3.4 [streambuf.protected] Status: WP Submitter: Jiang An Opened: 2023-12-08 Last modified: 2024-04-02
Priority: Not Prioritized
View all issues with WP status.
Discussion:
It seems that operations of std::basic_streambuf expect that
[eback(), egptr()) is a valid range and gptr() points into that range, and
[pbase(), pptr()) is a valid range and epptr() points into that range.
However, it is currently not specified for setg/setp that such invariants need to be established.
[2024-03-11; Reflector poll]
Set status to Tentatively Ready after six votes in favour during reflector poll.
[Tokyo 2024-03-23; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4964.
Modify 31.6.3.4.2 [streambuf.get.area] as indicated:
void setg(char_type* gbeg, char_type* gnext, char_type* gend);-?- Preconditions:
-5- Postconditions:[gbeg, gnext),[gbeg, gend), and[gnext, gend)are all valid ranges.gbeg == eback(),gnext == gptr(), andgend == egptr()are alltrue.
Modify 31.6.3.4.3 [streambuf.put.area] as indicated:
void setp(char_type* pbeg, char_type* pend);-?- Preconditions:
-5- Postconditions:[pbeg, pend)is a valid range.pbeg == pbase(),pbeg == pptr(), andpend == epptr()are alltrue.