-- - the function RemoveLast to remove the last entry from the map.
Create(Other : IndexedMap from TCollection)
- returns IndexedMap from TCollection
+ returns IndexedMap from TCollection;
---Purpose: As copying Map is an expensive operation it is
- -- incorrect to do it implicitly. This constructor
- -- will raise an error if the Map is not empty. To
- -- copy the content of a Map use the Assign method (operator =).
- raises DomainError from Standard
- is private;
-
+ -- not recommended to do it implicitly.
Assign(me : in out; Other : IndexedMap from TCollection)
returns IndexedMap from TCollection
(const TCollection_IndexedMap& Other) :
TCollection_BasicMap(Other.NbBuckets(),Standard_False)
{
- if (!Other.IsEmpty())
- Standard_DomainError::Raise("TCollection:Copy of IndexedMap");
+ if (!Other.IsEmpty()) {
+ ReSize(Other.Extent());
+ for (Standard_Integer i = 1; i <= Other.Extent(); i++) {
+ Add(Other(i));
+ }
+ }
}
//=======================================================================
-- To copy a list, you must explicitly call the assignment operator (operator=).
Create(Other : List from TCollection)
- returns List from TCollection
- is private;
+ returns List from TCollection;
---Purpose: Creation by copy of existing list.
- -- Warning: This constructor prints a warning message.
- -- We recommand to use the operator =.
+ -- We recommend to use the operator =.
Assign(me : in out; Other : List from TCollection)
---Purpose: Replace <me> by a copy of <Other>.
-- - TCollection_MapHasher class describes the
-- functions required for a Hasher object.
-raises
- DomainError from Standard
-
class StdMapNode from TCollection
inherits MapNode from TCollection
-- - and a map iterator to explore the map.
- Create(Other : Map from TCollection) returns Map from TCollection
+ Create(Other : Map from TCollection) returns Map from TCollection;
---Purpose: As copying Map is an expensive operation it is
- -- incorrect to do it implicitly. This constructor
- -- will raise an error if the Map is not empty. To
- -- copy the content of a Map use the Assign method (operator =).
- raises DomainError from Standard
- is private;
+ -- not recommended to do it implicitly.
Assign(me : in out; Other : Map from TCollection)
returns Map from TCollection
TCollection_Map::TCollection_Map(const TCollection_Map& Other) :
TCollection_BasicMap(Other.NbBuckets(),Standard_True)
{
- if (Other.Extent() != 0)
- Standard_DomainError::Raise("TCollection:Copy of Map");
+ if (!Other.IsEmpty()) {
+ ReSize(Other.Extent());
+ for (TCollection_MapIterator It(Other); It.More(); It.Next()) {
+ Add(It.Key());
+ }
+ }
}
//=======================================================================