1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 inline Foam::List<T>::List()
34 inline Foam::autoPtr<Foam::List<T> > Foam::List<T>::clone() const
36 return autoPtr<List<T> >(new List<T>(*this));
40 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 inline const Foam::List<T>& Foam::List<T>::null()
50 inline void Foam::List<T>::resize(const label newSize)
52 this->setSize(newSize);
57 inline void Foam::List<T>::resize(const label newSize, const T& a)
59 this->setSize(newSize, a);
64 inline T& Foam::List<T>::newElmt(const label i)
66 if (i >= this->size())
68 setSize(2*this->size());
71 return UList<T>::operator[](i);
76 inline void Foam::List<T>::size(const label n)
83 inline Foam::label Foam::List<T>::size() const
85 return UList<T>::size_;
90 inline Foam::Xfer< Foam::List<T> > Foam::List<T>::xfer()
92 return xferMove(*this);
97 inline void Foam::List<T>::append(const UList<T>& lst)
103 "List<T>::append(const UList<T>&)"
104 ) << "attempted appending to self" << abort(FatalError);
107 label nextFree = this->size();
108 setSize(nextFree + lst.size());
112 this->operator[](nextFree++) = lst[elemI];
118 inline void Foam::List<T>::append(const UIndirectList<T>& lst)
120 label nextFree = this->size();
121 setSize(nextFree + lst.size());
125 this->operator[](nextFree++) = lst[elemI];
130 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
133 inline void Foam::List<T>::operator=(const T& t)
135 UList<T>::operator=(t);
139 // ************************************************************************* //