mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: PtrList: append function
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -189,6 +189,11 @@ public:
|
||||
// allocated entries.
|
||||
void clear();
|
||||
|
||||
//- Append an element at the end of the list
|
||||
inline void append(const T*);
|
||||
inline void append(const autoPtr<T>&);
|
||||
inline void append(const tmp<T>&);
|
||||
|
||||
//- Transfer the contents of the argument PtrList into this PtrList
|
||||
// and annul the argument list.
|
||||
void transfer(PtrList<T>&);
|
||||
|
||||
@ -79,6 +79,32 @@ inline void Foam::PtrList<T>::resize(const label newSize)
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::PtrList<T>::append(const T* ptr)
|
||||
{
|
||||
label sz = size();
|
||||
this->setSize(sz+1);
|
||||
ptrs_[sz] = ptr;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::PtrList<T>::append(const autoPtr<T>& aptr)
|
||||
{
|
||||
return append(const_cast<autoPtr<T>&>(aptr).ptr());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::PtrList<T>::append
|
||||
(
|
||||
const tmp<T>& t
|
||||
)
|
||||
{
|
||||
return append(const_cast<tmp<T>&>(t).ptr());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::PtrList<T>::set(const label i) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user