• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // <utility>
11 
12 // template <class T1, class T2> struct pair
13 
14 // template<size_t I, class T1, class T2>
15 //     const typename tuple_element<I, std::pair<T1, T2> >::type&
16 //     get(const pair<T1, T2>&);
17 
18 #include <utility>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 
main()23 int main()
24 {
25     {
26         typedef std::pair<int, short> P;
27         const P p(3, static_cast<short>(4));
28         assert(std::get<0>(p) == 3);
29         assert(std::get<1>(p) == 4);
30     }
31 
32 #if TEST_STD_VER > 11
33     {
34         typedef std::pair<int, short> P;
35         constexpr P p1(3, static_cast<short>(4));
36         static_assert(std::get<0>(p1) == 3, "");
37         static_assert(std::get<1>(p1) == 4, "");
38     }
39 #endif
40 }
41