15 #ifndef dealii_cxx14_memory_h 16 #define dealii_cxx14_memory_h 18 #include <deal.II/base/config.h> 22 #ifndef DEAL_II_WITH_CXX14 24 # include <type_traits> 27 DEAL_II_NAMESPACE_OPEN
30 #ifdef DEAL_II_WITH_CXX14 31 using std::make_unique;
36 struct is_bounded_array
38 static constexpr
bool value =
false;
41 template <
typename T, std::
size_t N>
42 struct is_bounded_array<T[N]>
44 static constexpr
bool value =
true;
48 template <
typename T,
typename... Args>
50 typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T> >::type
51 make_unique(Args &&... constructor_arguments)
53 return std::unique_ptr<T>(
new T(std::forward<Args>(constructor_arguments)...));
58 typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T> >::type
59 make_unique(std::size_t n)
61 static_assert(!internal::is_bounded_array<T>::value,
62 "This function is not implemented for bounded array types.");
63 return std::unique_ptr<T>(
new typename std::remove_extent<T>::type [n]);
68 DEAL_II_NAMESPACE_CLOSE
70 #endif // dealii_cxx14_memory_h