This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3 PATCH] Make any's copy assignment operator exception-safe, don't copy the underlying value when any is moved, make in_place constructors explicit.


Tested on Linux-x64.

2016-10-08  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Make any's copy assignment operator exception-safe,
    don't copy the underlying value when any is moved,
    make in_place constructors explicit.
    * include/std/any (any(in_place_type_t<_ValueType>, _Args&&...)):
    Make explicit.
    (any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&...)):
    Likewise.
    (operator=(const any&)): Make strongly exception-safe.
    (operator=(any&&)): Reset the manager when resetting the value.
    This makes the state saner if an exception is thrown during the move.
    (_Manager_internal<_Tp>::_S_manage): Move in _Op_xfer, don't copy.
    * testsuite/20_util/any/assign/2.cc: Adjust.
    * testsuite/20_util/any/assign/exception.cc: New.
    * testsuite/20_util/any/cons/2.cc: Adjust.
    * testsuite/20_util/any/cons/explicit.cc: New.
    * testsuite/20_util/any/misc/any_cast_neg.cc: Ajust.

Attachment: any-fixes.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]