mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added last() member function
This commit is contained in:
@ -184,6 +184,12 @@ public:
|
||||
// an out-of-range element returns false without any ill-effects
|
||||
inline const T& operator[](const label) const;
|
||||
|
||||
//- Return last element of UList.
|
||||
inline T& last();
|
||||
|
||||
//- Return last element of UList.
|
||||
inline const T& last() const;
|
||||
|
||||
//- Allow cast to a const List<T>&
|
||||
inline operator const Foam::List<T>&() const;
|
||||
|
||||
|
||||
@ -114,6 +114,20 @@ inline void Foam::UList<T>::checkIndex(const label i) const
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::UList<T>::last()
|
||||
{
|
||||
return this->operator[](this->size()-1);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::UList<T>::last() const
|
||||
{
|
||||
return this->operator[](this->size()-1);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T* Foam::UList<T>::cdata() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user