Movatterモバイル変換


[0]ホーム

URL:



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

467. char_traits::lt(), compare(), and memcmp()

Section: 27.2.4.2[char.traits.specializations.char]Status:CD1Submitter: Martin SeborOpened: 2004-06-28Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [char.traits.specializations.char].

View all issues withCD1 status.

Discussion:

Table 37 describes the requirements on Traits::compare() in terms ofthose on Traits::lt(). 21.1.3.1, p6 requires char_traits<char>::lt()to yield the same result as operator<(char, char).

Most, if not all, implementations of char_traits<char>::compare()call memcmp() for efficiency. However, the C standard requires bothmemcmp() and strcmp() to interpret characters under comparison asunsigned, regardless of the signedness of char. As a result, allthese char_traits implementations fail to meet the requirementimposed by Table 37 on compare() when char is signed.

Read email thread starting with c++std-lib-13499 for more.

Proposed resolution:

Change 21.1.3.1, p6 from

The two-argument members assign, eq, and lt are defined identically to the built-in operators =, ==, and < respectively.

to

The two-argument member assign is defined identically to the built-in operator =. The two argument members eq and lt are defined identically to the built-in operators == and < for type unsigned char.

[Redmond: The LWG agreed with this general direction, but we also need to changeeq to be consistent with this change. Post-Redmond: Martin provided wording.]


[8]ページ先頭

©2009-2026 Movatter.jp