Movatterモバイル変換


[0]ホーム

URL:



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

3467.bool can't be an integer-like type

Section: 24.3.4.4[iterator.concept.winc]Status:C++23Submitter: Casey CarterOpened: 2020-07-23Last modified: 2023-11-22

Priority:0

View all otherissues in [iterator.concept.winc].

View all issues withC++23 status.

Discussion:

Per 25.2[ranges.syn]/1, the Standard Library believes it can convert an integer-like typeXto an unsigned integer-like type with the exposition-only type aliasmake-unsigned-like-t.make-unsigned-like-t<X> is specified as being equivalent tomake_unsigned_t<X> whenX is an integral type. However, despite being an integral type,bool is not a valid template type argument formake_unsigned_t per [tab:meta.trans.sign].

This problem withbool was an oversight when we added support for integer-like types: it was certainlynot the design intent to allowranges::size(r) to returnfalse! While we could devise somemore-complicated metaprogramming to allow use ofbool, it seems easier — and consistent with thedesign intent — to simply excludebool from the set of integer-like types.

[2020-08-02; Reflector prioritization]

Set priority to 0 and status to Tentatively Ready after six votes in favour during reflector discussions.

[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative toN4861.

  1. Modify 24.3.4.4[iterator.concept.winc] as indicated:

    -11- A typeIother thancv bool isinteger-like if it modelsintegral<I>or if it is an integer-class type. An integer-like typeI issigned-integer-like if itmodelssigned_integral<I> or if it is a signed-integer-class type. An integer-liketypeI isunsigned-integer-like if it modelsunsigned_integral<I> or if it is anunsigned-integer-class type.


[8]ページ先頭

©2009-2026 Movatter.jp