0024831: Make iterators of NCollection classes STL-compatible

STL-compatible iterators returned methods begin() and end() are provided in collection classes from NCollection package.
NCollection_Array1::Iterator is redesigned to use pointer instead of index.
Iterators of Sequence, Array, and Vector are extended by new methods to iterate backwards.

Use of SortTools_QuickSortOfReal is replaced by std::sort() in a few places (where possible).
This commit is contained in:
dbp
2014-04-23 09:38:58 +04:00
committed by apn
parent 574d723693
commit 79a35943dd
25 changed files with 1988 additions and 173 deletions

View File

@@ -36,20 +36,24 @@ void NCollection_BaseVector::Iterator::copyV (const NCollection_BaseVector::Iter
//purpose : Initialisation of iterator by a vector
//=======================================================================
void NCollection_BaseVector::Iterator::initV (const NCollection_BaseVector& theVector)
void NCollection_BaseVector::Iterator::initV (const NCollection_BaseVector& theVector, Standard_Boolean theToEnd)
{
myVector = &theVector;
myICurBlock = 0;
myCurIndex = 0;
myVector = &theVector;
if (theVector.myNBlocks == 0)
{
myIEndBlock = 0;
myCurIndex = 0;
myEndIndex = 0;
myICurBlock = 0;
myIEndBlock = 0;
}
else
{
myIEndBlock = theVector.myNBlocks - 1;
myEndIndex = theVector.myData[myIEndBlock].Length;
myICurBlock = !theToEnd ? 0 : myIEndBlock;
myCurIndex = !theToEnd ? 0 : myEndIndex;
}
}