Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 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 | |
Eric Fiselier | 02bb4bd | 2015-07-18 23:56:04 +0000 | [diff] [blame] | 14 | // UNSUPPORTED: c++98, c++03 |
| 15 | |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 16 | #include <array> |
| 17 | #include <memory> |
Marshall Clow | 6b913d7 | 2015-01-09 20:25:52 +0000 | [diff] [blame] | 18 | #include <utility> |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 19 | #include <cassert> |
| 20 | |
Eric Fiselier | 237206b | 2015-10-01 07:05:38 +0000 | [diff] [blame] | 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" |
Eric Fiselier | 02bb4bd | 2015-07-18 23:56:04 +0000 | [diff] [blame] | 24 | |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 25 | int main() |
| 26 | { |
Eric Fiselier | 02bb4bd | 2015-07-18 23:56:04 +0000 | [diff] [blame] | 27 | |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 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 | } |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 35 | } |