1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-06 18:26:22 +03:00

0030143: Foundation Classes - provide operator[] alias for NCollection_Array1, NCollection_Vector

This commit is contained in:
kgv 2018-09-17 13:14:00 +03:00
parent 0de16e296a
commit b8f7f6081f
2 changed files with 12 additions and 0 deletions

View File

@ -370,6 +370,9 @@ public:
const TheItemType& operator() (const Standard_Integer theIndex) const const TheItemType& operator() (const Standard_Integer theIndex) const
{ return Value (theIndex); } { return Value (theIndex); }
//! operator[] - alias to Value
const TheItemType& operator[] (Standard_Integer theIndex) const { return Value (theIndex); }
//! Variable value access //! Variable value access
TheItemType& ChangeValue (const Standard_Integer theIndex) TheItemType& ChangeValue (const Standard_Integer theIndex)
{ {
@ -381,6 +384,9 @@ public:
TheItemType& operator() (const Standard_Integer theIndex) TheItemType& operator() (const Standard_Integer theIndex)
{ return ChangeValue (theIndex); } { return ChangeValue (theIndex); }
//! operator[] - alias to ChangeValue
TheItemType& operator[] (Standard_Integer theIndex) { return ChangeValue (theIndex); }
//! Set value //! Set value
void SetValue (const Standard_Integer theIndex, void SetValue (const Standard_Integer theIndex,
const TheItemType& theItem) const TheItemType& theItem)

View File

@ -238,6 +238,9 @@ public: //! @name public methods
return Value (theIndex); return Value (theIndex);
} }
//! Operator[] - query the const value
const TheItemType& operator[] (Standard_Integer theIndex) const { return Value (theIndex); }
const TheItemType& Value (const Standard_Integer theIndex) const const TheItemType& Value (const Standard_Integer theIndex) const
{ {
return *(const TheItemType* )findV (theIndex); return *(const TheItemType* )findV (theIndex);
@ -273,6 +276,9 @@ public: //! @name public methods
return ChangeValue (theIndex); return ChangeValue (theIndex);
} }
//! Operator[] - query the value
TheItemType& operator[] ( Standard_Integer theIndex) { return ChangeValue (theIndex); }
TheItemType& ChangeValue (const Standard_Integer theIndex) TheItemType& ChangeValue (const Standard_Integer theIndex)
{ {
return *(TheItemType* )findV (theIndex); return *(TheItemType* )findV (theIndex);