Title
Preconditions of std::basic_streambuf::setg/setp
Status
wp
Section
[streambuf.protected]
Submitter
Jiang An

Created on 2023-12-08.00:00:00 last changed 3 weeks ago

Messages

Date: 2024-04-02.10:29:12

Proposed resolution:

This wording is relative to N4964.

  1. Modify [streambuf.get.area] as indicated:

    void setg(char_type* gbeg, char_type* gnext, char_type* gend);
    

    -?- Preconditions: [gbeg, gnext), [gbeg, gend), and [gnext, gend) are all valid ranges.

    -5- Postconditions: gbeg == eback(), gnext == gptr(), and gend == egptr() are all true.

  2. Modify [streambuf.put.area] as indicated:

    void setp(char_type* pbeg, char_type* pend);
    

    -?- Preconditions: [pbeg, pend) is a valid range.

    -5- Postconditions: pbeg == pbase(), pbeg == pptr(), and pend == epptr() are all true.

Date: 2024-04-02.10:29:12

[ Tokyo 2024-03-23; Status changed: Voting → WP. ]

Date: 2024-03-15.00:00:00

[ 2024-03-11; Reflector poll ]

Set status to Tentatively Ready after six votes in favour during reflector poll.

Date: 2023-12-08.00:00:00

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.

History
Date User Action Args
2024-04-02 10:29:12adminsetmessages: + msg14039
2024-04-02 10:29:12adminsetstatus: voting -> wp
2024-03-18 09:32:04adminsetstatus: ready -> voting
2024-03-11 21:46:48adminsetmessages: + msg13977
2024-03-11 21:46:48adminsetstatus: new -> ready
2023-12-09 16:21:45adminsetmessages: + msg13888
2023-12-08 00:00:00admincreate