Dune Core Modules (2.9.0)

make_array.hh
1// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3#ifndef DUNE_COMMON_STD_MAKE_ARRAY_HH
4#define DUNE_COMMON_STD_MAKE_ARRAY_HH
5
6#include <array>
7#include <type_traits>
8
9#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
10#include <experimental/array>
11#endif
12
13#warning make_array.hh is deprecated and will be removed after Dune 2.9. \
14 Use deduction guide of `std::array` or `std::to_array`.
15
16namespace Dune {
17namespace Std {
18
19#if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
20
23
24#else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
25
27
41 template <typename... Args>
42 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
43 make_array(const Args&... args) {
44 std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
45 result = {{args...}};
46 return result;
47 }
48
49#endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
50
51}
52}
53
54#endif
std::array< typename std::common_type< Args... >::type, sizeof...(Args)> make_array(const Args &... args)
Create and initialize an array.
Definition: make_array.hh:43
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)