Page MenuHomePhabricator

[libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block.
ClosedPublic

Authored by EricWF on Feb 19 2015, 3:48 PM.

Details

Summary

There is no reason to guard tuple_size, tuple_element and get<I>(...) for pair and array inside of <__tuple> so that they are only available when we have variadic templates.
This requires there be redundant declarations and definitions. It also makes it easy to get things wrong.

For example the following code should compile (and does in c++11).

#define _LIBCPP_HAS_NO_VARIADICS
#include <array>

int main()
{
  static_assert((std::tuple_size<std::array<int, 10> volatile>::value == 10), "");
}

This patch lifts the non-variadic parts of tuple_size, tuple_types, and get<I>(...) to the top of <__tuple> where they don't require variadic templates. This patch also removes <__tuple_03> because there is no longer a need for it.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 20349.Feb 19 2015, 3:48 PM
EricWF retitled this revision from to [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block..
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added reviewers: mclow.lists, danalbert, K-ballo.
EricWF added a subscriber: Unknown Object (MLST).
mclow.lists accepted this revision.Mar 17 2015, 7:58 AM
mclow.lists edited edge metadata.

LGTM

This revision is now accepted and ready to land.Mar 17 2015, 7:58 AM
EricWF closed this revision.Mar 17 2015, 8:10 AM