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

This commit is contained in:
Mark Olesen
2010-06-07 08:56:55 +02:00
parent e5e768403b
commit 435013ea08
3 changed files with 14 additions and 4 deletions

View File

@ -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)
{

View File

@ -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>&);

View File

@ -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)
{