tuple_element.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <tuple> 11 12// template <class... Types> class tuple; 13 14// template <size_t I, class... Types> 15// class tuple_element<I, tuple<Types...> > 16// { 17// public: 18// typedef Ti type; 19// }; 20 21#include <tuple> 22#include <type_traits> 23 24int main() 25{ 26 { 27 typedef std::tuple<int> T; 28 static_assert((std::is_same<std::tuple_element<0, T>::type, 29 int>::value), ""); 30 } 31 { 32 typedef std::tuple<char, int> T; 33 static_assert((std::is_same<std::tuple_element<0, T>::type, 34 char>::value), ""); 35 static_assert((std::is_same<std::tuple_element<1, T>::type, 36 int>::value), ""); 37 } 38 { 39 typedef std::tuple<int*, char, int> T; 40 static_assert((std::is_same<std::tuple_element<0, T>::type, 41 int*>::value), ""); 42 static_assert((std::is_same<std::tuple_element<1, T>::type, 43 char>::value), ""); 44 static_assert((std::is_same<std::tuple_element<2, T>::type, 45 int>::value), ""); 46 } 47} 48