This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Implement N4387 and LWG 2367


This patch implements the so-called conditionally-explicit constructors
for tuple and pair, and also constrains the default constructors of tuple and
pair. The patch does not try to implement the part in N4387 that allows
constructing tuples from shorter packs than the tuple's element count,
I suggest we look at that separately. The constraints involve fair amounts
of evil black magic, but they do the job. Chances are they can be simplified,
but I again suggest we look at that separately.

Tested on Linux-PPC64.

Patch gzipped since it's 50kB otherwise. :)

2015-06-07  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".
    * 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/std/tuple (_TC, _TC2): 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.
    * testsuite/20_util/pair/cons/explicit_construct.cc: New.
    * 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.

Attachment: explicit-tuple-pair.diff.gz
Description: GNU Zip compressed data


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