diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H index d9bd00b1b198d9254240b59fbe5dfdf23adf2ea0..f5967cf5b382ff21649e08a10687cd1e40e8b4cb 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H @@ -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) { diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 17e3398a2055650cbf2880e373f61fd0e12d3c00..2999e0886ed5826b974c121b9ce2f8c53ad6f6b6 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -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>&); diff --git a/src/OpenFOAM/containers/Lists/List/ListI.H b/src/OpenFOAM/containers/Lists/List/ListI.H index 51abd2d55edfe4b6cc9ae235c9d70af34b0cd8a6..24b5c41996a3b57dccd4f459d9f400445ebdf7e6 100644 --- a/src/OpenFOAM/containers/Lists/List/ListI.H +++ b/src/OpenFOAM/containers/Lists/List/ListI.H @@ -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) {