check for exception support

This commit is contained in:
Joachim Schoeberl 2023-02-21 20:52:25 +01:00
parent a0b9dca246
commit c6af357901

View File

@ -749,16 +749,17 @@ namespace ngcore
NETGEN_INLINE explicit Array (const Array & a2) NETGEN_INLINE explicit Array (const Array & a2)
: FlatArray<T,IndexType> (a2.Size(), a2.Size() ? new T[a2.Size()] : nullptr) : FlatArray<T,IndexType> (a2.Size(), a2.Size() ? new T[a2.Size()] : nullptr)
{ {
static_assert(std::is_copy_assignable<T>::value, "cannot copy-construct Array"); if constexpr (std::is_copy_assignable<T>::value)
// if constexpr (std::is_copy_assignable<T>::value)
{ {
allocsize = size; allocsize = size;
mem_to_delete = data; mem_to_delete = data;
for (size_t i = 0; i < size; i++) for (size_t i = 0; i < size; i++)
data[i] = a2.data[i]; data[i] = a2.data[i];
} }
// else #ifdef __cpp_exceptions
// throw Exception(std::string("cannot copy-construct Array of type ") + typeid(T).name()); else
throw Exception(std::string("cannot copy-construct Array of type ") + typeid(T).name());
#endif
} }