mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: consistency with DynamicList - add append(const T&) to List
This commit is contained in:
@ -310,7 +310,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append
|
|||||||
const T& t
|
const T& t
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label elemI = List<T>::size();
|
const label elemI = List<T>::size();
|
||||||
setSize(elemI + 1);
|
setSize(elemI + 1);
|
||||||
|
|
||||||
this->operator[](elemI) = t;
|
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>
|
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||||
inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()
|
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)
|
if (elemI < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -180,6 +180,9 @@ public:
|
|||||||
//- Clear the list, i.e. set size to zero.
|
//- Clear the list, i.e. set size to zero.
|
||||||
void clear();
|
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
|
//- Append a List at the end of this list
|
||||||
inline void append(const UList<T>&);
|
inline void append(const UList<T>&);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
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>
|
template<class T>
|
||||||
inline void Foam::List<T>::append(const UList<T>& lst)
|
inline void Foam::List<T>::append(const UList<T>& lst)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user