summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/array/test/array_constexpr.cpp
blob: a3110057a9ad79cdc870c0d54eca23cf045e6ce0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* tests using constexpr on boost:array
 * (C) Copyright Marshall Clow 2012
 * Distributed under the Boost Software License, Version 1.0. (See
 * accompanying file LICENSE_1_0.txt or copy at
 * http://www.boost.org/LICENSE_1_0.txt)
 */

#include <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#endif

#ifndef BOOST_NO_CXX11_CONSTEXPR
constexpr boost::array<int, 10> arr  {{ 0,1,2,3,4,5,6,7,8,9 }};
constexpr std::array<int, 10> arr_std {{ 0,1,2,3,4,5,6,7,8,9 }};

template <typename T>
void sink ( T t ) {}

template <typename T, size_t N>
void sink ( boost::array<T,N> &arr ) {}

int main()
{
//    constexpr int two = arr_std.at (2);
    constexpr int three = arr.at (3);
    int whatever [ arr.at(4) ];
    (void)three;
    (void) whatever;
}

#else   // no constexpr means no constexpr tests!
int main()
{
}
#endif