Marshall Clow | c5c2900 | 2015-05-26 18:57:27 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame^] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Marshall Clow | c5c2900 | 2015-05-26 18:57:27 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // <array> |
| 10 | |
| 11 | // An array is a contiguous container |
| 12 | |
| 13 | #include <array> |
| 14 | #include <cassert> |
| 15 | |
| 16 | template <class C> |
| 17 | void test_contiguous ( const C &c ) |
| 18 | { |
| 19 | for ( size_t i = 0; i < c.size(); ++i ) |
| 20 | assert ( *(c.begin() + i) == *(std::addressof(*c.begin()) + i)); |
| 21 | } |
| 22 | |
| 23 | int main() |
| 24 | { |
| 25 | { |
| 26 | typedef double T; |
| 27 | typedef std::array<T, 3> C; |
| 28 | test_contiguous (C()); |
| 29 | } |
| 30 | } |