dune-common  2.6-git
make_array.hh
Go to the documentation of this file.
1 #ifndef DUNE_COMMON_STD_MAKE_ARRAY_HH
2 #define DUNE_COMMON_STD_MAKE_ARRAY_HH
3 
4 #include <array>
5 #include <type_traits>
6 
7 #if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
8 #include <experimental/array>
9 #endif
10 
11 namespace Dune {
12 namespace Std {
13 
14 #if DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
15 
17 
18 #else // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
19 
21 
34  template <typename... Args>
35  std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
36  make_array(const Args&... args) {
37  std::array<typename std::common_type<Args...>::type, sizeof...(Args)>
38  result = {{args...}};
39  return result;
40  }
41 
42 #endif // DUNE_HAVE_CXX_EXPERIMENTAL_MAKE_ARRAY
43 
44 }
45 }
46 
47 #endif
Dune
Dune namespace.
Definition: alignedallocator.hh:9
Dune::Std::make_array
std::array< typename std::common_type< Args... >::type, sizeof...(Args)> make_array(const Args &... args)
Create and initialize an array.
Definition: make_array.hh:36