Marshall Clow | c5c2900 | 2015-05-26 18:57:27 +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 | // An array is a contiguous container |
| 13 | |
| 14 | #include <array> |
| 15 | #include <cassert> |
| 16 | |
| 17 | template <class C> |
| 18 | void test_contiguous ( const C &c ) |
| 19 | { |
| 20 | for ( size_t i = 0; i < c.size(); ++i ) |
| 21 | assert ( *(c.begin() + i) == *(std::addressof(*c.begin()) + i)); |
| 22 | } |
| 23 | |
| 24 | int main() |
| 25 | { |
| 26 | { |
| 27 | typedef double T; |
| 28 | typedef std::array<T, 3> C; |
| 29 | test_contiguous (C()); |
| 30 | } |
| 31 | } |