Silicium
make_array.hpp
Go to the documentation of this file.
1 #ifndef SILICIUM_MAKE_ARRAY_HPP
2 #define SILICIUM_MAKE_ARRAY_HPP
3 
4 #include <silicium/config.hpp>
5 #include <silicium/identity.hpp>
6 #include <array>
7 
8 namespace Si
9 {
10  template <class Element = void, class ...T>
11  auto make_array(T &&...elements)
12 #if !SILICIUM_COMPILER_HAS_AUTO_RETURN_TYPE
13  -> std::array<
14  typename std::conditional<
15  std::is_same<Element, void>::value,
16  std::common_type<T...>,
18  >::type::type,
19  sizeof...(elements)
20  >
21 #endif
22  {
23  typedef typename std::conditional<
24  std::is_same<Element, void>::value,
25  std::common_type<T...>,
27  >::type::type element_type;
28  std::array<element_type, sizeof...(elements)> result =
29  {{
30  std::forward<T>(elements)...
31  }};
32  return result;
33  }
34 }
35 
36 #endif
auto make_array(T &&...elements) -> std::array< typename std::conditional< std::is_same< Element, void >::value, std::common_type< T... >, identity< Element > >::type::type, sizeof...(elements) >
Definition: make_array.hpp:11
Definition: absolute_path.hpp:19
Definition: identity.hpp:7