blob: 41a7153e88d46e8a0b10d71a831b5e4baff57fc1 [file] [log] [blame]
Marshall Clowc5c29002015-05-26 18:57:27 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// 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 Clowc5c29002015-05-26 18:57:27 +00006//
7//===----------------------------------------------------------------------===//
8
9// <array>
10
11// An array is a contiguous container
12
13#include <array>
14#include <cassert>
15
Marshall Clow7fc6a552019-05-31 18:35:30 +000016#include "test_macros.h"
17
Marshall Clowc5c29002015-05-26 18:57:27 +000018template <class C>
19void test_contiguous ( const C &c )
20{
21 for ( size_t i = 0; i < c.size(); ++i )
22 assert ( *(c.begin() + i) == *(std::addressof(*c.begin()) + i));
23}
24
JF Bastien2df59c52019-02-04 20:31:13 +000025int main(int, char**)
Marshall Clowc5c29002015-05-26 18:57:27 +000026{
27 {
28 typedef double T;
29 typedef std::array<T, 3> C;
30 test_contiguous (C());
31 }
JF Bastien2df59c52019-02-04 20:31:13 +000032
33 return 0;
Marshall Clowc5c29002015-05-26 18:57:27 +000034}