Skip to content
Snippets Groups Projects
Commit 9991ac08 authored by mattijs's avatar mattijs
Browse files

ENH: PtrList: append function

parent d97a966a
No related merge requests found
......@@ -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
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment