Commit 435013ea authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: consistency with DynamicList - add append(const T&) to List

parent e5e76840
......@@ -310,7 +310,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append
const T& t
)
{
label elemI = List<T>::size();
const label elemI = List<T>::size();
setSize(elemI + 1);
this->operator[](elemI) = t;
......@@ -361,7 +361,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()
{
label elemI = List<T>::size() - 1;
const label elemI = List<T>::size() - 1;
if (elemI < 0)
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -180,6 +180,9 @@ public:
//- Clear the list, i.e. set size to zero.
void clear();
//- Append an element at the end of the list
inline void append(const T&);
//- Append a List at the end of this list
inline void append(const UList<T>&);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -93,6 +93,13 @@ inline Foam::Xfer<Foam::List<T> > Foam::List<T>::xfer()
}
template<class T>
inline void Foam::List<T>::append(const T& t)
{
setSize(size()+1, t);
}
template<class T>
inline void Foam::List<T>::append(const UList<T>& lst)
{
......
Markdown is supported
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