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] Slight cleanup of tuple constraints.


This is not something that should go in at this stage, but I'm sending
it for review. Dinka quite astutely pointed out that the sizeof...(_Elements)>=1
tests seem unnecessary, and they are;

1) the helper aliases _TCC and _TMC already check that the incoming
pack and the element pack have the same size
2) if the element pack is empty, we wouldn't use these constructors
anyway, since we have a specialization for a zero-element tuple...
3) ...except that for the one taking const _Elements& we might, for
class template argument deduction cases, but we have a deduction
guide that deduces the zero-element specialization for 'tuple t;' so
we still won't use these constructors.

When stage1 for gcc 8 opens, I expect to clean up tuple's constraints
a bit anyway: there's no actual need to have, for instance, _ConstructibleTuple
and _MoveConstructibleTuple separately. However, that's a topic for another day,
as mentioned.

Tested on Linux-x64.

2017-03-27  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Slight cleanup of tuple constraints.
    * include/std/tuple (tuple(const _Elements&...)): Strike
    the unnecessary sizeof... test.
    (tuple(_UElements&&...)): Likewise.
    * testsuite/20_util/tuple/element_access/get_neg.cc: Adjust.

Attachment: tuple-sizeof-cleanup.diff
Description: Text document


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