mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add assignment from UIndirectList to DynamicList
This commit is contained in:
@ -207,6 +207,10 @@ public:
|
||||
//- Assignment from UList
|
||||
inline void operator=(const UList<T>&);
|
||||
|
||||
//- Assignment from UIndirectList
|
||||
inline void operator=(const UIndirectList<T>&);
|
||||
|
||||
|
||||
|
||||
// IOstream operators
|
||||
|
||||
|
||||
@ -406,29 +406,6 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
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=
|
||||
(
|
||||
@ -461,4 +438,49 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
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 UIndirectList<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();
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -91,8 +91,10 @@ public:
|
||||
//- Return the last element of the list.
|
||||
inline const T& last() const;
|
||||
|
||||
|
||||
//- Return the complete list
|
||||
inline const UList<T>& completeList() const;
|
||||
|
||||
//- Return the list addressing
|
||||
inline const List<label>& addressing() const;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user