Home | History | Annotate | Download | only in array.tuple
      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 // <array>
     11 
     12 // template <size_t I, class T, size_t N> T&& get(array<T, N>&& a);
     13 
     14 // UNSUPPORTED: c++98, c++03
     15 
     16 #include <array>
     17 #include <memory>
     18 #include <utility>
     19 #include <cassert>
     20 
     21 // std::array is explicitly allowed to be initialized with A a = { init-list };.
     22 // Disable the missing braces warning for this reason.
     23 #include "disable_missing_braces_warning.h"
     24 
     25 int main()
     26 {
     27 
     28     {
     29         typedef std::unique_ptr<double> T;
     30         typedef std::array<T, 1> C;
     31         C c = {std::unique_ptr<double>(new double(3.5))};
     32         T t = std::get<0>(std::move(c));
     33         assert(*t == 3.5);
     34     }
     35 }
     36