mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
check copy_assignable also in copy-constructor
This commit is contained in:
parent
98697959dd
commit
65761e7768
@ -711,12 +711,17 @@ namespace ngcore
|
|||||||
/// array copy
|
/// array copy
|
||||||
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)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
throw Exception(std::string("cannot copy-construct Array of type ") + typeid(T).name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename TA>
|
template <typename TA>
|
||||||
|
Loading…
Reference in New Issue
Block a user