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.

3572.copyable-box should be fullyconstexpr

Section: 25.7.3[range.move.wrap]Status:C++23Submitter: Tim SongOpened: 2021-06-19Last modified: 2023-11-22

Priority:Not Prioritized

View all otherissues in [range.move.wrap].

View all issues withC++23 status.

Discussion:

P2231R1 madeoptional fullyconstexpr, but missed its cousinsemiregular-box (which was renamed tocopyable-box byP2325R3). Most operations ofcopyable-box are alreadyconstexpr simply becausecopyable-box is specified in terms ofoptional;the only missing ones are the assignment operators layered on top when the wrapped typeisn't assignable itself.

[2021-06-23; Reflector poll]

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

[2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative toN4892.

  1. Modify [range.copy.wrap] as indicated:

    -1- Many types in this subclause are specified in terms of an exposition-only class templatecopyable-box.copyable-box<T> behaves exactly likeoptional<T> with the following differences:

    1. (1.1) — […]

    2. (1.2) — […]

    3. (1.3) — Ifcopyable<T> is not modeled, the copy assignment operator is equivalent to:

      constexprcopyable-box& operator=(constcopyable-box& that)  noexcept(is_nothrow_copy_constructible_v<T>) {  if (this != addressof(that)) {    if (that) emplace(*that);    else reset();  }  return *this;}
    4. (1.4) — Ifmovable<T> is not modeled, the move assignment operator is equivalent to:

      constexprcopyable-box& operator=(copyable-box&& that)  noexcept(is_nothrow_move_constructible_v<T>) {  if (this != addressof(that)) {    if (that) emplace(std::move(*that));    else reset();  }  return *this;}

[8]ページ先頭

©2009-2026 Movatter.jp