Title
Equivalence of contained objects
Status
c++17
Section
[any.class]
Submitter
Jonathan Wakely

Created on 2016-11-09.00:00:00 last changed 81 months ago

Messages

Date: 2016-12-16.20:56:38

Proposed resolution:

This wording is relative to N4606.

  1. Change [any.cons] p2:

    any(const any& other);
    

    Effects: Constructs an object of type any with an equivalent state as other.If other.has_value() is false, constructs an object that has no value. Otherwise, equivalent to any(in_place<T>, any_cast<const T&>(other)) where T is the type of the contained object.

  2. Change [any.cons] p4:

    any(any&& other);
    

    Effects: Constructs an object of type any with a state equivalent to the original state of other.If other.has_value() is false, constructs an object that has no value. Otherwise, constructs an object of type any that contains either the contained object of other, or contains an object of the same type constructed from the contained object of other considering that contained object as an rvalue.

Date: 2017-02-02.00:41:18

[ Issues Telecon 16-Dec-2016 ]

Move to Tentatively Ready

Date: 2016-11-15.00:00:00

[ 2016-11-08, Jonathan comments and suggests wording ]

We can rephrase the copy constructor in terms of equivalence to construction from the contained object. We need to use in-place construction to avoid recursion in the case where the contained object is itself an any.

For the move constructor we don't simply want to construct from the contrained object, because when the contained object is stored in dynamic memory we don't actually construct anything, we just transfer ownership of a pointer.

Date: 2016-11-09.00:00:00

Addresses US 29

What does it mean for (the contained) objects to be "equivalent"?

Suggested resolution:

Add definition (note that using operator==() involves complicated questions of overload resolution).

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2017-03-05 23:41:16adminsetstatus: ready -> wp
2016-12-16 20:56:38adminsetmessages: + msg8721
2016-12-16 20:56:38adminsetstatus: new -> ready
2016-11-09 18:55:50adminsetmessages: + msg8584
2016-11-09 18:55:50adminsetmessages: + msg8583
2016-11-09 00:00:00admincreate