mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
added C++0x-style cbegin(), cend() iterator methods
- added STL-compatible resize() method. Should this be the primary entry point? - made [DS]LListBase end iterators private
This commit is contained in:
@ -384,6 +384,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- const_iterator set to the beginning of the HashTable
|
||||
inline const_iterator cbegin() const;
|
||||
|
||||
//- const_iterator set to beyond the end of the HashTable
|
||||
inline const const_iterator& cend() const;
|
||||
|
||||
//- const_iterator set to the beginning of the HashTable
|
||||
inline const_iterator begin() const;
|
||||
|
||||
|
||||
@ -452,7 +452,7 @@ const Key& Foam::HashTable<T, Key, Hash>::const_iterator::key()
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline typename Foam::HashTable<T, Key, Hash>::const_iterator
|
||||
Foam::HashTable<T, Key, Hash>::begin() const
|
||||
Foam::HashTable<T, Key, Hash>::cbegin() const
|
||||
{
|
||||
label i = 0;
|
||||
|
||||
@ -477,6 +477,22 @@ Foam::HashTable<T, Key, Hash>::begin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const typename Foam::HashTable<T, Key, Hash>::const_iterator&
|
||||
Foam::HashTable<T, Key, Hash>::cend() const
|
||||
{
|
||||
return HashTable<T, Key, Hash>::endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline typename Foam::HashTable<T, Key, Hash>::const_iterator
|
||||
Foam::HashTable<T, Key, Hash>::begin() const
|
||||
{
|
||||
return this->cbegin();
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const typename Foam::HashTable<T, Key, Hash>::const_iterator&
|
||||
Foam::HashTable<T, Key, Hash>::end() const
|
||||
|
||||
@ -317,19 +317,24 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- iterator set to the begining of the StaticHashTable
|
||||
//- iterator set to the beginning of the StaticHashTable
|
||||
inline iterator begin();
|
||||
|
||||
//- iterator set to beyond the end of the StaticHashTable
|
||||
inline const iterator& end();
|
||||
|
||||
//- const_iterator set to the begining of the StaticHashTable
|
||||
//- const_iterator set to the beginning of the StaticHashTable
|
||||
inline const_iterator cbegin() const;
|
||||
|
||||
//- const_iterator set to beyond the end of the StaticHashTable
|
||||
inline const const_iterator& cend() const;
|
||||
|
||||
//- const_iterator set to the beginning of the StaticHashTable
|
||||
inline const_iterator begin() const;
|
||||
|
||||
//- const_iterator set to beyond the end of the StaticHashTable
|
||||
inline const const_iterator& end() const;
|
||||
|
||||
|
||||
// IOstream Operator
|
||||
|
||||
friend Istream& operator>> <T, Key, Hash>
|
||||
|
||||
@ -355,7 +355,7 @@ Foam::StaticHashTable<T, Key, Hash>::end()
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline typename Foam::StaticHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::StaticHashTable<T, Key, Hash>::begin() const
|
||||
Foam::StaticHashTable<T, Key, Hash>::cbegin() const
|
||||
{
|
||||
// Find first non-empty entry
|
||||
forAll(keys_, hashIdx)
|
||||
@ -377,6 +377,22 @@ Foam::StaticHashTable<T, Key, Hash>::begin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const typename Foam::StaticHashTable<T, Key, Hash>::const_iterator&
|
||||
Foam::StaticHashTable<T, Key, Hash>::cend() const
|
||||
{
|
||||
return StaticHashTable<T, Key, Hash>::endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline typename Foam::StaticHashTable<T, Key, Hash>::const_iterator
|
||||
Foam::StaticHashTable<T, Key, Hash>::begin() const
|
||||
{
|
||||
return this->cbegin();
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline const typename Foam::StaticHashTable<T, Key, Hash>::const_iterator&
|
||||
Foam::StaticHashTable<T, Key, Hash>::end() const
|
||||
|
||||
@ -30,14 +30,14 @@ License
|
||||
#include "IOstreams.H"
|
||||
#include "long.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::DLListBase::iterator Foam::DLListBase::endIter
|
||||
Foam::DLListBase::iterator Foam::DLListBase::endIter_
|
||||
(
|
||||
const_cast<DLListBase&>(static_cast<const DLListBase&>(DLListBase()))
|
||||
);
|
||||
|
||||
Foam::DLListBase::const_iterator Foam::DLListBase::endConstIter
|
||||
Foam::DLListBase::const_iterator Foam::DLListBase::endConstIter_
|
||||
(
|
||||
static_cast<const DLListBase&>(DLListBase()),
|
||||
reinterpret_cast<const link*>(0)
|
||||
|
||||
@ -176,7 +176,7 @@ public:
|
||||
|
||||
// STL iterator
|
||||
|
||||
//- An STL iterator
|
||||
//- An STL-conforming iterator
|
||||
class iterator
|
||||
{
|
||||
friend class DLListBase;
|
||||
@ -193,16 +193,17 @@ public:
|
||||
//- Copy of the link
|
||||
link curLink_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Construct for a given SLListBase with NULL element and link.
|
||||
// Only used to create endIter
|
||||
inline iterator(DLListBase&);
|
||||
|
||||
public:
|
||||
|
||||
//- Construct for a given DLListBase and link
|
||||
inline iterator(DLListBase&, link*);
|
||||
|
||||
//- Construct for a given DLListBase
|
||||
// setting element and link to NULL.
|
||||
// Only used to create endIter
|
||||
inline iterator(DLListBase&);
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator=(const iterator&);
|
||||
@ -217,16 +218,12 @@ public:
|
||||
};
|
||||
|
||||
inline iterator begin();
|
||||
|
||||
//- iterator returned by end()
|
||||
static iterator endIter;
|
||||
|
||||
inline const iterator& end();
|
||||
|
||||
|
||||
// STL const_iterator
|
||||
|
||||
//- An STL const_iterator
|
||||
//- An STL-conforming const_iterator
|
||||
class const_iterator
|
||||
{
|
||||
// Private data
|
||||
@ -258,12 +255,20 @@ public:
|
||||
inline const_iterator operator++(int);
|
||||
};
|
||||
|
||||
inline const_iterator cbegin() const;
|
||||
inline const const_iterator& cend() const;
|
||||
|
||||
inline const_iterator begin() const;
|
||||
inline const const_iterator& end() const;
|
||||
|
||||
private:
|
||||
|
||||
//- iterator returned by end()
|
||||
static iterator endIter_;
|
||||
|
||||
//- const_iterator returned by end()
|
||||
static const_iterator endConstIter;
|
||||
static const_iterator endConstIter_;
|
||||
|
||||
inline const const_iterator& end() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -259,14 +259,14 @@ Foam::DLListBase::begin()
|
||||
}
|
||||
else
|
||||
{
|
||||
return endIter;
|
||||
return endIter_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::DLListBase::iterator& Foam::DLListBase::end()
|
||||
{
|
||||
return endIter;
|
||||
return endIter_;
|
||||
}
|
||||
|
||||
|
||||
@ -350,7 +350,7 @@ Foam::DLListBase::const_iterator::operator++(int)
|
||||
|
||||
|
||||
inline Foam::DLListBase::const_iterator
|
||||
Foam::DLListBase::begin() const
|
||||
Foam::DLListBase::cbegin() const
|
||||
{
|
||||
if (size())
|
||||
{
|
||||
@ -358,15 +358,29 @@ Foam::DLListBase::begin() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return endConstIter;
|
||||
return endConstIter_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::DLListBase::const_iterator&
|
||||
Foam::DLListBase::cend() const
|
||||
{
|
||||
return endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::DLListBase::const_iterator
|
||||
Foam::DLListBase::begin() const
|
||||
{
|
||||
return this->cbegin();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::DLListBase::const_iterator&
|
||||
Foam::DLListBase::end() const
|
||||
{
|
||||
return endConstIter;
|
||||
return endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,12 +29,12 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::SLListBase::iterator Foam::SLListBase::endIter
|
||||
Foam::SLListBase::iterator Foam::SLListBase::endIter_
|
||||
(
|
||||
const_cast<SLListBase&>(static_cast<const SLListBase&>(SLListBase()))
|
||||
);
|
||||
|
||||
Foam::SLListBase::const_iterator Foam::SLListBase::endConstIter
|
||||
Foam::SLListBase::const_iterator Foam::SLListBase::endConstIter_
|
||||
(
|
||||
static_cast<const SLListBase&>(SLListBase()),
|
||||
reinterpret_cast<const link*>(0)
|
||||
|
||||
@ -178,17 +178,17 @@ public:
|
||||
//- Copy of the link
|
||||
link curLink_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Construct for a given SLListBase with NULL element and link.
|
||||
// Only used to create endIter
|
||||
inline iterator(SLListBase&);
|
||||
|
||||
public:
|
||||
|
||||
//- Construct for a given SLListBase and link
|
||||
inline iterator(SLListBase&, link*);
|
||||
|
||||
//- Construct for a given SLListBase
|
||||
// setting element and link to NULL.
|
||||
// Only used to create endIter
|
||||
inline iterator(SLListBase&);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator=(const iterator&);
|
||||
@ -203,10 +203,6 @@ public:
|
||||
};
|
||||
|
||||
inline iterator begin();
|
||||
|
||||
//- iterator returned by end()
|
||||
static iterator endIter;
|
||||
|
||||
inline const iterator& end();
|
||||
|
||||
|
||||
@ -245,12 +241,20 @@ public:
|
||||
inline const_iterator operator++(int);
|
||||
};
|
||||
|
||||
inline const_iterator cbegin() const;
|
||||
inline const const_iterator& cend() const;
|
||||
|
||||
inline const_iterator begin() const;
|
||||
inline const const_iterator& end() const;
|
||||
|
||||
private:
|
||||
|
||||
//- iterator returned by end()
|
||||
static iterator endIter_;
|
||||
|
||||
//- const_iterator returned by end()
|
||||
static const_iterator endConstIter;
|
||||
static const_iterator endConstIter_;
|
||||
|
||||
inline const const_iterator& end() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -231,7 +231,7 @@ Foam::SLListBase::begin()
|
||||
}
|
||||
else
|
||||
{
|
||||
return endIter;
|
||||
return endIter_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ Foam::SLListBase::begin()
|
||||
inline const Foam::SLListBase::iterator&
|
||||
Foam::SLListBase::end()
|
||||
{
|
||||
return endIter;
|
||||
return endIter_;
|
||||
}
|
||||
|
||||
|
||||
@ -323,7 +323,7 @@ Foam::SLListBase::const_iterator::operator++(int)
|
||||
|
||||
|
||||
inline Foam::SLListBase::const_iterator
|
||||
Foam::SLListBase::begin() const
|
||||
Foam::SLListBase::cbegin() const
|
||||
{
|
||||
if (size())
|
||||
{
|
||||
@ -331,15 +331,29 @@ Foam::SLListBase::begin() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return endConstIter;
|
||||
return endConstIter_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::SLListBase::const_iterator&
|
||||
Foam::SLListBase::cend() const
|
||||
{
|
||||
return endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::SLListBase::const_iterator
|
||||
Foam::SLListBase::begin() const
|
||||
{
|
||||
return this->cbegin();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::SLListBase::const_iterator&
|
||||
Foam::SLListBase::end() const
|
||||
{
|
||||
return endConstIter;
|
||||
return endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -142,12 +142,17 @@ void Foam::CompactListList<T>::setSize(const label nRows)
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::CompactListList<T>::setSize(const label nRows, const label nData)
|
||||
void Foam::CompactListList<T>::setSize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
offsets_.setSize(nRows);
|
||||
m_.setSize(nData);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::CompactListList<T>::setSize
|
||||
(
|
||||
@ -160,19 +165,6 @@ void Foam::CompactListList<T>::setSize
|
||||
m_.setSize(nData, t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Foam::labelList Foam::CompactListList<T>::sizes() const
|
||||
{
|
||||
labelList rowSizes(offsets_.size());
|
||||
|
||||
label prevOffset = 0;
|
||||
forAll(offsets_, i)
|
||||
{
|
||||
rowSizes[i] = offsets_[i]-prevOffset;
|
||||
prevOffset = offsets_[i];
|
||||
}
|
||||
return rowSizes;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Foam::CompactListList<T>::setSize(const UList<label>& rowSizes)
|
||||
@ -189,6 +181,22 @@ void Foam::CompactListList<T>::setSize(const UList<label>& rowSizes)
|
||||
m_.setSize(sumSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
Foam::labelList Foam::CompactListList<T>::sizes() const
|
||||
{
|
||||
labelList rowSizes(offsets_.size());
|
||||
|
||||
label prevOffset = 0;
|
||||
forAll(offsets_, i)
|
||||
{
|
||||
rowSizes[i] = offsets_[i]-prevOffset;
|
||||
prevOffset = offsets_[i];
|
||||
}
|
||||
return rowSizes;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::CompactListList<T>::clear()
|
||||
{
|
||||
|
||||
@ -156,15 +156,28 @@ public:
|
||||
//- Reset sizes of CompactListList and value for new elements.
|
||||
void setSize(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Return sizes (to be used e.g. for construction)
|
||||
labelList sizes() const;
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
void setSize(const UList<label>& rowSizes);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
// This form only allows contraction of the CompactListList.
|
||||
inline void resize(const label nRows);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
inline void resize(const label nRows, const label nData);
|
||||
|
||||
//- Reset sizes of CompactListList and value for new elements.
|
||||
inline void resize(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Reset size of CompactListList.
|
||||
inline void resize(const UList<label>& rowSizes);
|
||||
|
||||
//- Clear the CompactListList, i.e. set sizes to zero.
|
||||
void clear();
|
||||
|
||||
//- Return sizes (to be used e.g. for construction)
|
||||
labelList sizes() const;
|
||||
|
||||
//- Transfer the contents of the argument CompactListList
|
||||
// into this CompactListList and annull the argument list.
|
||||
void transfer(CompactListList<T>&);
|
||||
|
||||
@ -176,6 +176,43 @@ inline Foam::Xfer<Foam::CompactListList<T> > Foam::CompactListList<T>::xfer()
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::CompactListList<T>::resize(const label nRows)
|
||||
{
|
||||
this->setSize(nRows);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::CompactListList<T>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::CompactListList<T>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::CompactListList<T>::resize(const UList<label>& rowSizes)
|
||||
{
|
||||
this->setSize(rowSizes);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
|
||||
@ -142,6 +142,15 @@ public:
|
||||
//- Alter the addressed list size and fill new space with a constant.
|
||||
inline void setSize(const label, const T&);
|
||||
|
||||
//- Alter the addressed list size.
|
||||
// New space will be allocated if required.
|
||||
// Use this to resize the list prior to using the operator[] for
|
||||
// setting values (as per List usage).
|
||||
inline void resize(const label);
|
||||
|
||||
//- Alter the addressed list size and fill new space with a constant.
|
||||
inline void resize(const label, const T&);
|
||||
|
||||
//- Reserve allocation space for at least this size.
|
||||
// Never shrinks the allocated size, use setCapacity() for that.
|
||||
inline void reserve(const label);
|
||||
|
||||
@ -207,6 +207,27 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::resize
|
||||
(
|
||||
const label nElem
|
||||
)
|
||||
{
|
||||
this->setSize(nElem);
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::resize
|
||||
(
|
||||
const label nElem,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
this->setSize(nElem, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::clear()
|
||||
{
|
||||
|
||||
@ -153,6 +153,10 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Dummy resize function
|
||||
// needed to make FixedList consistent with List
|
||||
inline void resize(const label);
|
||||
|
||||
//- Dummy setSize function
|
||||
// needed to make FixedList consistent with List
|
||||
inline void setSize(const label);
|
||||
@ -227,12 +231,16 @@ public:
|
||||
//- Random access iterator for traversing FixedList.
|
||||
typedef const T* const_iterator;
|
||||
|
||||
//- Return a const_iterator to begin traversing the
|
||||
// constant FixedList.
|
||||
//- Return const_iterator to begin traversing the constant FixedList.
|
||||
inline const_iterator cbegin() const;
|
||||
|
||||
//- Return const_iterator to end traversing the constant FixedList.
|
||||
inline const_iterator cend() const;
|
||||
|
||||
//- Return const_iterator to begin traversing the constant FixedList.
|
||||
inline const_iterator begin() const;
|
||||
|
||||
//- Return a const_iterator to end traversing the
|
||||
// constant FixedList.
|
||||
//- Return const_iterator to end traversing the constant FixedList.
|
||||
inline const_iterator end() const;
|
||||
|
||||
|
||||
@ -241,12 +249,10 @@ public:
|
||||
//- Reverse iterator for reverse traversal of FixedList.
|
||||
typedef T* reverse_iterator;
|
||||
|
||||
//- Return a reverse_iterator to begin reverse traversing the
|
||||
// FixedList.
|
||||
//- Return reverse_iterator to begin reverse traversing the FixedList.
|
||||
inline reverse_iterator rbegin();
|
||||
|
||||
//- Return a reverse_iterator to end reverse traversing the
|
||||
// FixedList.
|
||||
//- Return reverse_iterator to end reverse traversing the FixedList.
|
||||
inline reverse_iterator rend();
|
||||
|
||||
|
||||
@ -255,12 +261,16 @@ public:
|
||||
//- Reverse iterator for reverse traversal of constant FixedList.
|
||||
typedef const T* const_reverse_iterator;
|
||||
|
||||
//- Return a const_reverse_iterator to begin reverse traversing the
|
||||
// FixedList.
|
||||
//- Return const_reverse_iterator to begin reverse traversing FixedList.
|
||||
inline const_reverse_iterator crbegin() const;
|
||||
|
||||
//- Return const_reverse_iterator to end reverse traversing FixedList.
|
||||
inline const_reverse_iterator crend() const;
|
||||
|
||||
//- Return const_reverse_iterator to begin reverse traversing FixedList.
|
||||
inline const_reverse_iterator rbegin() const;
|
||||
|
||||
//- Return a const_reverse_iterator to end reverse traversing the
|
||||
// FixedList.
|
||||
//- Return const_reverse_iterator to end reverse traversing FixedList.
|
||||
inline const_reverse_iterator rend() const;
|
||||
|
||||
|
||||
|
||||
@ -170,6 +170,14 @@ inline void Foam::FixedList<T, Size>::checkIndex(const label i) const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline void Foam::FixedList<T, Size>::resize(const label s)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
checkSize(s);
|
||||
# endif
|
||||
}
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline void Foam::FixedList<T, Size>::setSize(const label s)
|
||||
{
|
||||
@ -276,6 +284,14 @@ Foam::FixedList<T, Size>::begin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::cbegin() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::end()
|
||||
@ -291,6 +307,15 @@ Foam::FixedList<T, Size>::end() const
|
||||
return &v_[Size];
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::cend() const
|
||||
{
|
||||
return &v_[Size];
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::rbegin()
|
||||
@ -307,6 +332,14 @@ Foam::FixedList<T, Size>::rbegin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::crbegin() const
|
||||
{
|
||||
return &v_[Size-1];
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::rend()
|
||||
@ -323,6 +356,14 @@ Foam::FixedList<T, Size>::rend() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::crend() const
|
||||
{
|
||||
return &v_[-1];
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline Foam::label Foam::FixedList<T, Size>::size() const
|
||||
{
|
||||
|
||||
@ -158,6 +158,12 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Reset size of List.
|
||||
inline void resize(const label);
|
||||
|
||||
//- Reset size of List and value for new elements.
|
||||
inline void resize(const label, const T&);
|
||||
|
||||
//- Reset size of List.
|
||||
void setSize(const label);
|
||||
|
||||
|
||||
@ -47,6 +47,20 @@ inline const Foam::List<T>& Foam::List<T>::null()
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::List<T>::resize(const label newSize)
|
||||
{
|
||||
this->setSize(newSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::List<T>::resize(const label newSize, const T& a)
|
||||
{
|
||||
this->setSize(newSize, a);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::List<T>::newElmt(const label i)
|
||||
{
|
||||
|
||||
@ -150,6 +150,9 @@ public:
|
||||
//- Reset size of List.
|
||||
void setSize(const label);
|
||||
|
||||
//- Reset size of List.
|
||||
inline void resize(const label);
|
||||
|
||||
//- Clear the list, i.e. set size to zero.
|
||||
void clear();
|
||||
|
||||
|
||||
@ -110,6 +110,13 @@ inline Foam::PackedList<nBits>::PackedList(const label size)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<int nBits>
|
||||
inline void Foam::PackedList<nBits>::resize(const label size)
|
||||
{
|
||||
this->setSize(size);
|
||||
}
|
||||
|
||||
|
||||
template<int nBits>
|
||||
inline Foam::label Foam::PackedList<nBits>::size() const
|
||||
{
|
||||
|
||||
@ -170,6 +170,12 @@ public:
|
||||
// deleted.
|
||||
void setSize(const label);
|
||||
|
||||
//- Reset size of PtrList. This can only be used to set the size
|
||||
// of an empty PtrList, extend a PtrList, remove entries from
|
||||
// the end of a PtrList. If the entries are non-empty they are
|
||||
// deleted.
|
||||
inline void resize(const label);
|
||||
|
||||
//- Clear the PtrList, i.e. set size to zero deleting all the
|
||||
// allocated entries.
|
||||
void clear();
|
||||
|
||||
@ -45,6 +45,13 @@ inline bool Foam::PtrList<T>::empty() const
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::PtrList<T>::resize(const label newSize)
|
||||
{
|
||||
this->setSize(newSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::PtrList<T>::set(const label i) const
|
||||
{
|
||||
|
||||
@ -215,12 +215,16 @@ public:
|
||||
//- Random access iterator for traversing UList.
|
||||
typedef const T* const_iterator;
|
||||
|
||||
//- Return a const_iterator to begin traversing the
|
||||
// constant UList.
|
||||
//- Return const_iterator to begin traversing the constant UList.
|
||||
inline const_iterator cbegin() const;
|
||||
|
||||
//- Return const_iterator to end traversing the constant UList.
|
||||
inline const_iterator cend() const;
|
||||
|
||||
//- Return const_iterator to begin traversing the constant UList.
|
||||
inline const_iterator begin() const;
|
||||
|
||||
//- Return a const_iterator to end traversing the
|
||||
// constant UList.
|
||||
//- Return const_iterator to end traversing the constant UList.
|
||||
inline const_iterator end() const;
|
||||
|
||||
|
||||
@ -229,12 +233,10 @@ public:
|
||||
//- Reverse iterator for reverse traversal of UList.
|
||||
typedef T* reverse_iterator;
|
||||
|
||||
//- Return a reverse_iterator to begin reverse traversing the
|
||||
// UList.
|
||||
//- Return reverse_iterator to begin reverse traversing the UList.
|
||||
inline reverse_iterator rbegin();
|
||||
|
||||
//- Return a reverse_iterator to end reverse traversing the
|
||||
// UList.
|
||||
//- Return reverse_iterator to end reverse traversing the UList.
|
||||
inline reverse_iterator rend();
|
||||
|
||||
|
||||
@ -243,12 +245,16 @@ public:
|
||||
//- Reverse iterator for reverse traversal of constant UList.
|
||||
typedef const T* const_reverse_iterator;
|
||||
|
||||
//- Return a const_reverse_iterator to begin reverse traversing the
|
||||
// UList.
|
||||
//- Return const_reverse_iterator to begin reverse traversing the UList.
|
||||
inline const_reverse_iterator crbegin() const;
|
||||
|
||||
//- Return const_reverse_iterator to end reverse traversing the UList.
|
||||
inline const_reverse_iterator crend() const;
|
||||
|
||||
//- Return const_reverse_iterator to begin reverse traversing the UList.
|
||||
inline const_reverse_iterator rbegin() const;
|
||||
|
||||
//- Return a const_reverse_iterator to end reverse traversing the
|
||||
// UList.
|
||||
//- Return const_reverse_iterator to end reverse traversing the UList.
|
||||
inline const_reverse_iterator rend() const;
|
||||
|
||||
|
||||
|
||||
@ -161,6 +161,13 @@ Foam::UList<T>::begin() const
|
||||
return v_;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::cbegin() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::iterator
|
||||
Foam::UList<T>::end()
|
||||
@ -175,6 +182,13 @@ Foam::UList<T>::end() const
|
||||
return &v_[size_];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::cend() const
|
||||
{
|
||||
return &v_[size_];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::iterator
|
||||
Foam::UList<T>::rbegin()
|
||||
@ -189,6 +203,13 @@ Foam::UList<T>::rbegin() const
|
||||
return &v_[size_-1];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::crbegin() const
|
||||
{
|
||||
return &v_[size_-1];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::iterator
|
||||
Foam::UList<T>::rend()
|
||||
@ -203,6 +224,13 @@ Foam::UList<T>::rend() const
|
||||
return &v_[-1];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::crend() const
|
||||
{
|
||||
return &v_[-1];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::UList<T>::size() const
|
||||
{
|
||||
|
||||
@ -124,6 +124,9 @@ public:
|
||||
//- Return the number of elements in the UPtrList
|
||||
inline label size() const;
|
||||
|
||||
//- Return true if the UPtrList is empty (i.e., if size() == 0).
|
||||
inline bool empty() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
@ -132,6 +135,11 @@ public:
|
||||
// the end of a UPtrList.
|
||||
void setSize(const label);
|
||||
|
||||
//- Reset size of UPtrList. This can only be used to set the size
|
||||
// of an empty UPtrList, extend a UPtrList, remove entries from
|
||||
// the end of a UPtrList.
|
||||
inline void resize(const label);
|
||||
|
||||
//- Clear the UPtrList, i.e. set size to zero
|
||||
void clear();
|
||||
|
||||
|
||||
@ -35,13 +35,26 @@ inline Foam::label Foam::UPtrList<T>::size() const
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::UPtrList<T>::empty() const
|
||||
{
|
||||
return ptrs_.empty();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::UPtrList<T>::resize(const label newSize)
|
||||
{
|
||||
this->setSize(newSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::UPtrList<T>::set(const label i) const
|
||||
{
|
||||
return ptrs_[i] != NULL;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T* Foam::UPtrList<T>::set(const label i, T* ptr)
|
||||
{
|
||||
|
||||
@ -189,11 +189,21 @@ public:
|
||||
return IDLList<ParticleType>::begin();
|
||||
};
|
||||
|
||||
const const_iterator cbegin() const
|
||||
{
|
||||
return IDLList<ParticleType>::cbegin();
|
||||
};
|
||||
|
||||
const const_iterator end() const
|
||||
{
|
||||
return IDLList<ParticleType>::end();
|
||||
};
|
||||
|
||||
const const_iterator cend() const
|
||||
{
|
||||
return IDLList<ParticleType>::cend();
|
||||
};
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return IDLList<ParticleType>::begin();
|
||||
|
||||
@ -192,9 +192,11 @@ public:
|
||||
// the current face. For boundary edges this is the first boundary face
|
||||
// reached from walking back (i.e. in opposite direction to ++)
|
||||
inline edgeFaceCirculator begin() const;
|
||||
inline edgeFaceCirculator cbegin() const;
|
||||
|
||||
//- iterator set to beyond the end of the walk.
|
||||
inline const edgeFaceCirculator& end() const;
|
||||
inline const edgeFaceCirculator& cend() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -419,10 +419,34 @@ Foam::edgeFaceCirculator Foam::edgeFaceCirculator::begin() const
|
||||
}
|
||||
|
||||
|
||||
Foam::edgeFaceCirculator Foam::edgeFaceCirculator::cbegin() const
|
||||
{
|
||||
edgeFaceCirculator iter
|
||||
(
|
||||
mesh_,
|
||||
faceLabel_,
|
||||
ownerSide_,
|
||||
index_,
|
||||
isBoundaryEdge_
|
||||
);
|
||||
|
||||
if (isBoundaryEdge_)
|
||||
{
|
||||
iter.setCanonical();
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
const Foam::edgeFaceCirculator& Foam::edgeFaceCirculator::end() const
|
||||
{
|
||||
return endConstIter;
|
||||
}
|
||||
|
||||
const Foam::edgeFaceCirculator& Foam::edgeFaceCirculator::cend() const
|
||||
{
|
||||
return endConstIter;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -879,6 +879,14 @@ Foam::octree<Type>::begin() const
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
typename Foam::octree<Type>::const_iterator
|
||||
Foam::octree<Type>::cbegin() const
|
||||
{
|
||||
return const_iterator(*this, 0);
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
const typename Foam::octree<Type>::const_iterator&
|
||||
Foam::octree<Type>::end() const
|
||||
@ -887,6 +895,14 @@ Foam::octree<Type>::end() const
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
const typename Foam::octree<Type>::const_iterator&
|
||||
Foam::octree<Type>::cend() const
|
||||
{
|
||||
return octree<Type>::endConstIter_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template <class Type>
|
||||
|
||||
@ -445,10 +445,6 @@ public:
|
||||
//- Construct for a given octree and index
|
||||
const_iterator(const octree&, label);
|
||||
|
||||
// Member functions
|
||||
|
||||
const_iterator begin() const;
|
||||
|
||||
// Member operators
|
||||
|
||||
void operator=(const const_iterator&);
|
||||
@ -465,9 +461,11 @@ public:
|
||||
|
||||
//- const_iterator set to the begining of the octree
|
||||
inline const_iterator begin() const;
|
||||
inline const_iterator cbegin() const;
|
||||
|
||||
//- const_iterator set to beyond the end of the octree
|
||||
inline const const_iterator& end() const;
|
||||
inline const const_iterator& cend() const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
@ -102,6 +102,9 @@ private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disable resize with value
|
||||
void resize(const label, const Face&);
|
||||
|
||||
//- Disable setSize with value
|
||||
void setSize(const label, const Face&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user