This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
Section: 18.104.22.168 [utility.arg.requirements] Status: C++11 Submitter: Daniel Krügler Opened: 2010-02-03 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [utility.arg.requirements].
View all issues with C++11 status.
Table 33 — MoveConstructible requirements [moveconstructible] and Table 34 — CopyConstructible requirements [copyconstructible] support solely the following expression:
where rv is defined to be as "non-const rvalue of type T" and t as a "modifiable lvalue of type T" in 22.214.171.124 [utility.arg.requirements]/1.
This causes two different defects:
We cannot move/copy-initialize a const lvalue of type T as in:
int get_i(); const int i1(get_i());
both in Table 33 and in Table 34.
The single support for
in case of CopyConstructible means that we cannot provide an lvalue as a source of a copy as in
const int& get_lri(); int i2(get_lri());
I believe this second defect is due to the fact that this single expression supported both initialization situations according to the old (implicit) lvalue reference -> rvalue reference conversion rules.
Finally [copyconstructible] refers to some name u which is not part of the expression, and both [copyconstructible] and [moveconstructible] should support construction expressions from temporaries - this would be a stylistic consequence in the light of the new DefaultConstructible requirements and compared with existing requirements (see e.g. Container requirements or the output/forward iterator requirements)..
[ 2010-02-09 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]
[ 2010-02-10 Reopened. The proposed wording of 1283 has been merged here. ]
[ 2010-02-10 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]
Change 126.96.36.199 [utility.arg.requirements]/1 as indicated: [This change suggestion is motivated to make type descriptions clearer: First, a, b, and c may also be non-const T. Second, u is described in a manner consistent with the container requirements tables.]
1 The template definitions in the C++ standard library refer to various named requirements whose details are set out in tables 31-38. In these tables, T is a type to be supplied by a C++ program instantiating a template; a, b, and c are values of type const T; s and t are modifiable lvalues of type T; u
is a value of type (possibly const) T; andrv is a non-constrvalue of type T.
In 188.8.131.52 [utility.arg.requirements] Table 33 ([moveconstructible]) change as indicated [Note: The symbol u is defined to be either a const or a non-const value and is the right one we need here]:
Table 33 — MoveConstructible requirements [moveconstructible] Expression Post-condition T t(rv) tis equivalent to the value of rv before the construction [Note: There is no requirement on the value of rv after the construction.— end note]
In 184.108.40.206 [utility.arg.requirements] Table 34 ([copyconstructible]) change as indicated [Note: The symbol u is defined to be either a const or a non-const value and is the right one we need here. The expressions using a are recommended to ensure that lvalues are supported as sources of the copy expression]:
Table 34 — CopyConstructible requirements [copyconstructible]
Expression Post-condition T t( rv) the value of uis unchanged and is equivalent to t [Note: A type that satisfies the CopyConstructible requirements also satisfies the MoveConstructible requirements. — end note]
In Table 35 — MoveAssignable requirements [moveassignable] change as indicated:
Table 35 — MoveAssignable requirements [moveassignable] Expression Return type Return value Post-condition t = rv T& t t is equivalent to the value of rv before the assigment. [Note: There is no requirement on the value of rv after the assignment.— end note]
In 220.127.116.11 [utility.arg.requirements] change Table 36 as indicated:
Table 36 — CopyAssignable requirements [copyassignable] Expression Return type Return value Post-condition t = u T& t t is equivalent to u, the value of uis unchanged [Note: A type that satisfies the CopyAssignable requirements also satisfies the MoveAssignable requirements. — end note]