Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofTC1 status.

11. Bitset minor problems

Section: 22.9.2[template.bitset]Status:TC1Submitter: Matt AusternOpened: 1998-01-22Last modified: 2016-08-09

Priority:Not Prioritized

View all otherissues in [template.bitset].

View all issues withTC1 status.

Discussion:

(1) bitset<>::operator[] is mentioned in the class synopsis (23.3.5), but it isnot documented in 23.3.5.2.

(2) The class synopsis only gives a single signature for bitset<>::operator[],reference operator[](size_t pos). This doesn't make much sense. It ought to be overloadedon const. reference operator[](size_t pos); bool operator[](size_t pos) const.

(3) Bitset's stream input function (23.3.5.3) ought to skip all whitespace beforetrying to extract 0s and 1s. The standard doesn't explicitly say that, though. This shouldgo in the Effects clause.

Proposed resolution:

ITEMS 1 AND 2:

In the bitset synopsis (22.9.2[template.bitset]), replace the member function

    reference operator[](size_t pos);

with the two member functions

    bool operator[](size_t pos) const;
    reference operator[](size_t pos);

Add the following text at the end of 22.9.2.3[bitset.members], immediately after paragraph 45:

bool operator[](size_t pos) const;
Requires: pos is valid
Throws: nothing
Returns:test(pos)

bitset<N>::reference operator[](size_t pos);
Requires: pos is valid
Throws: nothing
Returns: An object of typebitset<N>::reference such that(*this)[pos] == this->test(pos), and such that(*this)[pos] = val is equivalent tothis->set(pos, val);

Rationale:

The LWG believes Item 3 is not a defect. "Formattedinput" implies the desired semantics. See 31.7.5.3[istream.formatted].


[8]ページ先頭

©2009-2026 Movatter.jp