mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Array copy only if type is assignable
This commit is contained in:
parent
5c2089ed96
commit
b2b8a15611
@ -939,6 +939,8 @@ namespace ngcore
|
|||||||
|
|
||||||
/// array copy
|
/// array copy
|
||||||
NETGEN_INLINE Array & operator= (const Array & a2)
|
NETGEN_INLINE Array & operator= (const Array & a2)
|
||||||
|
{
|
||||||
|
if constexpr (std::is_assignable<T,T>::value)
|
||||||
{
|
{
|
||||||
SetSize0 ();
|
SetSize0 ();
|
||||||
SetSize (a2.Size());
|
SetSize (a2.Size());
|
||||||
@ -946,6 +948,9 @@ namespace ngcore
|
|||||||
data[i] = a2.data[i];
|
data[i] = a2.data[i];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
throw Exception(std::string("cannot copy Array of type ") + typeid(T).name());
|
||||||
|
}
|
||||||
|
|
||||||
/// steal array
|
/// steal array
|
||||||
NETGEN_INLINE Array & operator= (Array && a2)
|
NETGEN_INLINE Array & operator= (Array && a2)
|
||||||
|
Loading…
Reference in New Issue
Block a user