[PATCH] [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block.
Eric Fiselier
eric at efcs.ca
Thu Feb 19 15:48:05 PST 2015
Hi mclow.lists, danalbert, K-ballo,
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.
http://reviews.llvm.org/D7774
Files:
include/__tuple
include/__tuple_03
include/array
include/utility
test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp
test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp
test/std/utilities/utility/pairs/pair.astuple/tuple_element.pass.cpp
test/std/utilities/utility/pairs/pair.astuple/tuple_size.pass.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7774.20349.patch
Type: text/x-patch
Size: 13967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150219/5741b440/attachment.bin>
More information about the cfe-commits
mailing list