-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MoveConstructible<T>() != std::is_move_constructible<T>() #313
Comments
Wording in Progress:[Editor's note: this wording assumes that the resolution of #301 has been applied, so that Change [concepts.lib.object.moveconstructible] as follows: template <class T>
concept bool MoveConstructible() {
- return Constructible<T, remove_cv_t<T>&&>() &&
- ConvertibleTo<remove_cv_t<T>&&, T>();
+ return Constructible<T, T>() && ConvertibleTo<T, T>();
}
- 1 Let rv be an rvalue of type remove_cv_t<T>. Then MoveConstructible<T>() is satisfied if
-(1.1) — After the definition T u = rv;, u is equal to the value of rv before the construction.
-(1.2) — T{rv} or *new T{rv} is equal to the value of rv before the construction.
- 2 rv’s resulting state is unspecified. [ Note: rv must still meet the requirements of the
- library component that is using it. The operations listed in those requirements must
- work as specified whether rv has been moved from or not.—end note ]
+ 1 MoveConstructible<T>() is satisfied if and only if
+(1.1) — T is a non-object type, or
+(1.2) — T is an object type and the result of constructing a new object of type T from an
+ rvalue rv of type T is equal to rv's original value, leaving rv in an
+ unspecified state. [ Note: rv must still meet the requirements of the library component
+ that is using it. The operations listed in those requirements must work as specified
+ whether rv has been moved from or not.—end note ] Change [concepts.lib.object.copyconstructible] as follows: template <class T>
concept bool CopyConstructible() {
return MoveConstructible<T>() &&
- Constructible<T, const remove_cv_t<T>&>() &&
- ConvertibleTo<remove_cv_t<T>&, T>() &&
- ConvertibleTo<const remove_cv_t<T>&, T>() &&
- ConvertibleTo<const remove_cv_t<T>&&, T>();
+ Constructible<T, T&>() && ConvertibleTo<T&, T>() &&
+ Constructible<T, const T&>() && ConvertibleTo<const T&, T>() &&
+ Constructible<T, const T&&>() && ConvertibleTo<const T&&, T>();
}
1 Let v be an lvalue of type (possibly const) remove_cv_t<T> or an rvalue of type const
remove_cv_t<T>. Then CopyConstructible<T>() is satisfied if and only if
(1.1) — After the definition T u = v;, v is equal to u.
(1.2) — T{v} or *new T{v} is equal to v. |
Surely the semantic constraints on |
Nope.
I don't bother saying, "Otherwise, |
Yes, WIP. Distracted integrating cmcstl2 pulls.
They fail syntactically in |
So text which reads, "MoveConstructible() is satisfied if and only if T is a non-object type, or..." is wrong. I guess I'm confused about what you're suggesting. |
The prose requirements are implicitly in addition to the syntactic requirements, here as in all of the other concepts. |
But they should not be in contradiction of it. |
* P0541 * P0547 * P0579 * ericniebler/stl2#155 * ericniebler/stl2#167 * ericniebler/stl2#172 * ericniebler/stl2#229 * ericniebler/stl2#232 * ericniebler/stl2#239 * ericniebler/stl2#241 * ericniebler/stl2#242 * ericniebler/stl2#243 * ericniebler/stl2#244 * ericniebler/stl2#245 * ericniebler/stl2#255 * ericniebler/stl2#286 * ericniebler/stl2#299 * ericniebler/stl2#301 * ericniebler/stl2#310 * ericniebler/stl2#311 * ericniebler/stl2#313 * ericniebler/stl2#322 * ericniebler/stl2#339 * ericniebler/stl2#381 Remove post-increment experiment in `move_iterator`. Remove `EqualityComparable`/`Sentinel<default_sentinel>` extensions to `ostreambuf_iterator`.
* P0541 * P0547 * P0579 * ericniebler/stl2#155 * ericniebler/stl2#167 * ericniebler/stl2#172 * ericniebler/stl2#229 * ericniebler/stl2#232 * ericniebler/stl2#239 * ericniebler/stl2#241 * ericniebler/stl2#242 * ericniebler/stl2#243 * ericniebler/stl2#244 * ericniebler/stl2#245 * ericniebler/stl2#255 * ericniebler/stl2#286 * ericniebler/stl2#299 * ericniebler/stl2#301 * ericniebler/stl2#310 * ericniebler/stl2#311 * ericniebler/stl2#313 * ericniebler/stl2#322 * ericniebler/stl2#339 * ericniebler/stl2#381 Remove post-increment experiment in `move_iterator`. Remove `EqualityComparable`/`Sentinel<default_sentinel>` extensions to `ostreambuf_iterator`.
...when
T
isconst some_move_only_type
due to the use ofremove_cv_t
in the definition ofMoveConstructible
. This is sensible ifMoveConstructible
means "Can I construct aT
object from an rvalue expression withT
's value type?" but becomes very surprising if we align the other `structibles with the meaning of the standard type traits.CopyConstructible
needs to change similarly for consistency.Proposed Resolution
See P0547
The text was updated successfully, but these errors were encountered: