7b1ff8bb183dbafcb0295494a0f37a0d530d0dfe
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / utilities / tuple / tuple.tuple / tuple.helper / tuple_element.pass.cpp
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
24 template <class T, std::size_t N, class U>
25 void test()
26 {
27     static_assert((std::is_same<typename std::tuple_element<N, T>::type, U>::value), "");
28     static_assert((std::is_same<typename std::tuple_element<N, const T>::type, const U>::value), "");
29     static_assert((std::is_same<typename std::tuple_element<N, volatile T>::type, volatile U>::value), "");
30     static_assert((std::is_same<typename std::tuple_element<N, const volatile T>::type, const volatile U>::value), "");
31 }
32 int main()
33 {
34     test<std::tuple<int>, 0, int>();
35     test<std::tuple<char, int>, 0, char>();
36     test<std::tuple<char, int>, 1, int>();
37     test<std::tuple<int*, char, int>, 0, int*>();
38     test<std::tuple<int*, char, int>, 1, char>();
39     test<std::tuple<int*, char, int>, 2, int>();
40 }