Title
Keep the empty() functions in any
Status
nad
Section
[any.observers]
Submitter
Finland

Created on 2017-02-03.00:00:00 last changed 83 months ago

Messages

Date: 2017-07-26.00:00:00

[ 2017-06-26 Moved to Tentatively NAD after 5 positive votes on c++std-lib. ]

Date: 2017-02-15.00:00:00

[ 2017-02-03, Marshall notes ]

P0504R0 (adopted in Issaquah) removed use of function references for tag types

Date: 2017-02-03.00:00:00
Addresses FI 7

The proposal p0032 has multiple problems: 1) it turns member function .empty() into .has_value(), negating the logic. Refactoring e.g. existing uses of std::experimental::any to use std::any thus involve non-trivial refactorings that are error- prone and can't be done via simple search-and-replace if there are containers in the same source files for which .empty() is used (based on the implementation experience of making the change in libstdc++ and refactoring the testsuite). Whilst any is not a container, the library is failing to go towards a direction where there would be a generic way to query for emptiness. 2) The use of function references for tag types makes the interface hard to use. The tag types do not have value semantics like every other tag type has, the tag types are hard to construct, and present surprises for certain kinds of overload sets. Furthermore, any attempts to decay the tag types produces a really surprising effect — as opposed to what the other tag types do, which is that the result of decaying them is the tag type itself, decaying these new tag types results in a pointer to function.

Proposed change: Keep the .empty() functions (and introduce them to all the types that are supposed to have a homogeneous interface), and make the tag types be regular tag types that are not references to functions.

History
Date User Action Args
2017-06-26 19:27:05adminsetmessages: + msg9291
2017-06-26 19:27:05adminsetstatus: new -> nad
2017-02-05 13:14:01adminsetmessages: + msg8931
2017-02-03 00:00:00admincreate