[v3 PATCH] Implement N4387 and LWG 2367

Ville Voutilainen ville.voutilainen@gmail.com
Sat Jun 13 18:05:00 GMT 2015


On 8 June 2015 at 19:01, Ville Voutilainen <ville.voutilainen@gmail.com> wrote:
>> Yes, it should be uglified, thanks.
> Ahem, yes, actually removed since it's there only to be specialized.

Another round! The new patch
- makes sure not to change non-deduced parameters to deduced ones, and adds
tests for that.
- removes the name of the bool non-type template parameter for the 'concepts'.
- introduces shortcuts for making the use of the 'concepts' more readable.
- changes library tag types into non-default-constructible ones.
Without this, we
can run into an ambiguity between the constructor template that takes
(const _T1&, const _T2&)
and the one that takes (allocator_arg_t, Alloc), when the call site
calls it with ({}, somethingelse).
We could avoid that by just not doing that in the library
(experimental string searchers do that),
but it's just daft to allow default-constructing a library tag type. I
have filed an LWG issue to
fix all tag types, but this patch doesn't yet touch nothrow_t and
optional's in_place_t. I expect
to submit follow-up patches for that.

Tested on Linux-PPC64.

2015-06-13  Ville Voutilainen  <ville.voutilainen@gmail.com>
    Implement N4387, "improving pair and tuple" and
    LWG 2367, "pair and tuple are not correctly implemented for
    is_constructible with no args". Also make the standard tag types
    non-default-constructible. std::nothrow_t not taken care
    of yet in that regard, nor std::experimental::optional's
    in_place_t.
    * include/bits/stl_pair.h (piecewise_construct_t,
    piecewise_construct): Make non-default-constructible and adjust.
    * include/bits/stl_pair.h (_ConstructiblePair,
    _ImplicitlyConvertiblePair, _MoveConstructiblePair,
    _ImplicitlyMoveConvertiblePair): New.
    * include/bits/stl_pair.h (pair()): Constrain it.
    * include/bits/stl_pair.h (pair(const _T1&, const _T2&),
    pair(const pair<_U1, _U2>&), pair(_U1&&, const _T2&),
    pair(const _T1&, _U2&&), pair(_U1&&, _U2&&),
    pair(pair<_U1, _U2>&&)): Make conditionally explicit.
    * include/bits/uses_allocator.h (allocator_arg_t,
    allocator_arg): Make non-default-constructible and adjust.
    * include/std/mutex (defer_lock_t, defer_lock,
    try_to_lock_t, try_to_lock, adopt_lock_t, adopt_lock):
    Make non-default-constructible and adjust.
    * include/std/tuple (_TC, tuple::_TC2, tuple::TCC, tuple::TMC): New.
    * include/std/tuple (tuple()): Constrain it.
    * include/std/tuple (tuple(const _UElements&...),
    tuple(_UElements&&...), tuple(const tuple<_UElements...>&),
    tuple(tuple<_UElements...>&&),
    tuple(allocator_arg_t, const _Alloc&, const _UElements&...),
    tuple(allocator_arg_t, const _Alloc&, _UElements&&...),
    tuple(allocator_arg_t, const _Alloc&, const tuple<_UElements...>&),
    tuple(allocator_arg_t, const _Alloc&, tuple<_UElements...>&&),
    tuple(const pair<_U1, _U2>&),
    tuple(pair<_U1, _U2>&&),
    tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&),
    tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&)): Make
    conditionally explicit.
    * src/c++11/compatibility-thread-c++0x.cc: Adjust.
    * testsuite/20_util/pair/cons/explicit_construct.cc: New.
    * estsuite/20_util/pair/piecewise.cc: Adjust.
    * testsuite/20_util/pair/requirements/dr2367.cc: New.
    * testsuite/20_util/tuple/cons/explicit_construct.cc: New.
    * testsuite/20_util/tuple/requirements/dr2367.cc: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: conditional-explicit4.diff.gz
Type: application/x-gzip
Size: 6887 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150613/1bd34ab3/attachment.bin>


More information about the Libstdc++ mailing list