18148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow//===----------------------------------------------------------------------===// 28148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// 38148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// The LLVM Compiler Infrastructure 48148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// 58148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// This file is dual licensed under the MIT and the University of Illinois Open 68148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// Source Licenses. See LICENSE.TXT for details. 78148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// 88148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow//===----------------------------------------------------------------------===// 98148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow 108148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// <tuple> 118148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow 128148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// template <class... Types> class tuple; 138148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow 148148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// template <size_t I, class... Types> 158148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// class tuple_element<I, tuple<Types...> > 168148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// { 178148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// public: 188148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// typedef Ti type; 198148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// }; 208148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// 2184acb1ec3f7d5e0f37d7176697c2fa876c413407Eric Fiselier// LWG #2212 says that tuple_size and tuple_element must be 228148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow// available after including <utility> 238148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow 248148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow#include <array> 258148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow#include <type_traits> 268148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow 278148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clowtemplate <class T, std::size_t N, class U, size_t idx> 288148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clowvoid test() 298148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow{ 308148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, 318148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow std::tuple_size<T> >::value), ""); 328148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, 338148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow std::tuple_size<const T> >::value), ""); 348148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, 358148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow std::tuple_size<volatile T> >::value), ""); 368148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_base_of<std::integral_constant<std::size_t, N>, 378148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow std::tuple_size<const volatile T> >::value), ""); 388148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_same<typename std::tuple_element<idx, T>::type, U>::value), ""); 398148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_same<typename std::tuple_element<idx, const T>::type, const U>::value), ""); 408148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_same<typename std::tuple_element<idx, volatile T>::type, volatile U>::value), ""); 418148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow static_assert((std::is_same<typename std::tuple_element<idx, const volatile T>::type, const volatile U>::value), ""); 428148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow} 438148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow 448148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clowint main() 458148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow{ 468148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow test<std::array<int, 5>, 5, int, 0>(); 478148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow test<std::array<int, 5>, 5, int, 1>(); 488148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow test<std::array<const char *, 4>, 4, const char *, 3>(); 498148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow test<std::array<volatile int, 4>, 4, volatile int, 3>(); 508148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow test<std::array<char *, 3>, 3, char *, 1>(); 518148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow test<std::array<char *, 3>, 3, char *, 2>(); 528148fdb5d2533cc57cefc874c46e00759df4d52fMarshall Clow} 53