mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +03:00
0028186: Foundation Classes, NCollection_List - methods "Remove" and "Contains" prevent template usage
::Remove() and ::Contains() are now defined as template methods to allow using NCollection_List with types without quality operator.
This commit is contained in:
parent
20ef5652b7
commit
2a79a1aeb4
@ -200,7 +200,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Remove the first occurrence of the object.
|
//! Remove the first occurrence of the object.
|
||||||
Standard_Boolean Remove (const TheItemType& theObject)
|
template<typename TheValueType> // instantiate this method on first call only for types defining equality operator
|
||||||
|
Standard_Boolean Remove (const TheValueType& theObject)
|
||||||
{
|
{
|
||||||
for (Iterator anIter (*this); anIter.More(); anIter.Next())
|
for (Iterator anIter (*this); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
@ -285,7 +286,8 @@ public:
|
|||||||
{ PReverse(); }
|
{ PReverse(); }
|
||||||
|
|
||||||
//! Return true if object is stored in the list.
|
//! Return true if object is stored in the list.
|
||||||
Standard_Boolean Contains (const TheItemType& theObject) const
|
template<typename TheValueType> // instantiate this method on first call only for types defining equality operator
|
||||||
|
Standard_Boolean Contains (const TheValueType& theObject) const
|
||||||
{
|
{
|
||||||
for (Iterator anIter (*this); anIter.More(); anIter.Next())
|
for (Iterator anIter (*this); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
@ -101,6 +101,12 @@ public:
|
|||||||
return myIterator;
|
return myIterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Access to NCollection iterator instance
|
||||||
|
BaseIterator& ChangeIterator()
|
||||||
|
{
|
||||||
|
return myIterator;
|
||||||
|
}
|
||||||
|
|
||||||
protected: //! @name methods related to forward STL iterator
|
protected: //! @name methods related to forward STL iterator
|
||||||
|
|
||||||
// Note: Here we use SFINAE (Substitution failure is not an error) to choose
|
// Note: Here we use SFINAE (Substitution failure is not an error) to choose
|
||||||
|
Loading…
x
Reference in New Issue
Block a user