mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
missing assignment operator
This commit is contained in:
@ -182,9 +182,14 @@ public:
|
||||
//- Assignment of all addressed entries to the given value
|
||||
inline void operator=(const T&);
|
||||
|
||||
//- Assignment from List<T>. Also handles assignment from DynamicList.
|
||||
inline void operator=(const UList<T>&);
|
||||
//- Assignment from DynamicList
|
||||
inline void operator=
|
||||
(
|
||||
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
|
||||
);
|
||||
|
||||
//- Assignment from List<T>.
|
||||
inline void operator=(const UList<T>&);
|
||||
|
||||
// IOstream operators
|
||||
|
||||
|
||||
@ -334,13 +334,36 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
(
|
||||
const UList<T>& lst
|
||||
)
|
||||
{
|
||||
if (capacity_ >= lst.size())
|
||||
{
|
||||
// can copy w/o reallocating, match initial size to avoid reallocation
|
||||
List<T>::size(lst.size());
|
||||
List<T>::operator=(lst);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make everything available for the copy operation
|
||||
List<T>::size(capacity_);
|
||||
|
||||
List<T>::operator=(lst);
|
||||
capacity_ = List<T>::size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
(
|
||||
const DynamicList<T, SizeInc, SizeMult, SizeDiv>& lst
|
||||
)
|
||||
{
|
||||
if (this == &lst)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator="
|
||||
"(const UList<T>&)"
|
||||
"(const DynamicList<T, SizeInc, SizeMult, SizeDiv>&)"
|
||||
) << "attempted assignment to self" << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user