0029299: Foundation Classes, NCollection - define explicit empty constructor for...
authorkgv <kgv@opencascade.com>
Tue, 7 Nov 2017 14:23:29 +0000 (17:23 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 9 Nov 2017 15:08:20 +0000 (18:08 +0300)
Ambiguous constructors have been marked with explicit keyword for classes
NCollection_DataMap, NCollection_DoubleMap, NCollection_IndexedDataMap, NCollection_IndexedMap,
NCollection_List, NCollection_LocalArray, NCollection_Map, NCollection_Sequence,
NCollection_SparseArray, NCollection_UBTree,

src/NCollection/NCollection_DataMap.hxx
src/NCollection/NCollection_DoubleMap.hxx
src/NCollection/NCollection_IndexedDataMap.hxx
src/NCollection/NCollection_IndexedMap.hxx
src/NCollection/NCollection_List.hxx
src/NCollection/NCollection_LocalArray.hxx
src/NCollection/NCollection_Map.hxx
src/NCollection/NCollection_Sequence.hxx
src/NCollection/NCollection_SparseArray.hxx
src/NCollection/NCollection_UBTree.hxx

index 2f93636..779bdec 100644 (file)
@@ -140,10 +140,13 @@ public:
  public:
   // ---------- PUBLIC METHODS ------------
 
+  //! Empty Constructor.
+  NCollection_DataMap() : NCollection_BaseMap (1, Standard_True, Handle(NCollection_BaseAllocator)()) {}
+
   //! Constructor
-  NCollection_DataMap (const Standard_Integer NbBuckets=1,
-                     const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
-    : NCollection_BaseMap (NbBuckets, Standard_True, theAllocator) {}
+  explicit NCollection_DataMap (const Standard_Integer theNbBuckets,
+                                const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
+  : NCollection_BaseMap (theNbBuckets, Standard_True, theAllocator) {}
 
   //! Copy constructor
   NCollection_DataMap (const NCollection_DataMap& theOther)
index 3f67d42..5f17434 100644 (file)
@@ -123,10 +123,13 @@ public:
  public:
   // ---------- PUBLIC METHODS ------------
 
+  //! Empty constructor.
+  NCollection_DoubleMap() : NCollection_BaseMap (1, Standard_False, Handle(NCollection_BaseAllocator)()) {}
+
   //! Constructor
-  NCollection_DoubleMap (const Standard_Integer NbBuckets=1,
-                     const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
-    : NCollection_BaseMap (NbBuckets, Standard_False, theAllocator) {}
+  explicit NCollection_DoubleMap (const Standard_Integer theNbBuckets,
+                                  const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
+  : NCollection_BaseMap (theNbBuckets, Standard_False, theAllocator) {}
 
   //! Copy constructor
   NCollection_DoubleMap (const NCollection_DoubleMap& theOther)
index da2c685..45fa17d 100644 (file)
@@ -162,10 +162,13 @@ private:
  public:
   // ---------- PUBLIC METHODS ------------
 
+  //! Empty constructor.
+  NCollection_IndexedDataMap() : NCollection_BaseMap (1, Standard_False, Handle(NCollection_BaseAllocator)()) {}
+
   //! Constructor
-  NCollection_IndexedDataMap (const Standard_Integer NbBuckets=1,
-                     const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
-    :  NCollection_BaseMap (NbBuckets, Standard_False, theAllocator) {}
+  explicit NCollection_IndexedDataMap (const Standard_Integer theNbBuckets,
+                                       const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
+  : NCollection_BaseMap (theNbBuckets, Standard_False, theAllocator) {}
 
   //! Copy constructor
   NCollection_IndexedDataMap (const NCollection_IndexedDataMap& theOther) 
index fe3c4a7..c0a66cd 100644 (file)
@@ -124,10 +124,13 @@ private:
  public:
   // ---------- PUBLIC METHODS ------------
 
+  //! Empty constructor.
+  NCollection_IndexedMap() : NCollection_BaseMap (1, Standard_False, Handle(NCollection_BaseAllocator)()) {}
+
   //! Constructor
-  NCollection_IndexedMap (const Standard_Integer NbBuckets=1,
-                          const Handle(NCollection_BaseAllocator)& theAllocator=0L)
-  : NCollection_BaseMap (NbBuckets, Standard_False, theAllocator) {}
+  explicit NCollection_IndexedMap (const Standard_Integer theNbBuckets,
+                                   const Handle(NCollection_BaseAllocator)& theAllocator=0L)
+  : NCollection_BaseMap (theNbBuckets, Standard_False, theAllocator) {}
 
   //! Copy constructor
   NCollection_IndexedMap (const NCollection_IndexedMap& theOther)
index ded27c5..7ce1eaa 100644 (file)
@@ -58,9 +58,11 @@ public:
  public:
   // ---------- PUBLIC METHODS ------------
 
+  //! Empty constructor.
+  NCollection_List() : NCollection_BaseList(Handle(NCollection_BaseAllocator)()) {}
+
   //! Constructor
-  NCollection_List(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
-    NCollection_BaseList(theAllocator) {}
+  explicit NCollection_List(const Handle(NCollection_BaseAllocator)& theAllocator) : NCollection_BaseList(theAllocator) {}
 
   //! Copy constructor
   NCollection_List (const NCollection_List& theOther) :
index 20580cc..0605049 100644 (file)
@@ -24,7 +24,7 @@ template<class theItem, Standard_Integer MAX_ARRAY_SIZE = 1024> class NCollectio
 {
 public:
 
-  NCollection_LocalArray (const size_t theSize)
+  explicit NCollection_LocalArray (const size_t theSize)
   : myPtr (myBuffer)
   {
     Allocate(theSize);
index 6e12dd8..459c4f2 100644 (file)
@@ -119,10 +119,13 @@ public:
  public:
   // ---------- PUBLIC METHODS ------------
 
+  //! Empty constructor.
+  NCollection_Map() : NCollection_BaseMap (1, Standard_True, Handle(NCollection_BaseAllocator)()) {}
+
   //! Constructor
-  NCollection_Map (const Standard_Integer NbBuckets = 1,
-                   const Handle(NCollection_BaseAllocator)& theAllocator = 0L) :
-    NCollection_BaseMap (NbBuckets, Standard_True, theAllocator) {}
+  explicit NCollection_Map (const Standard_Integer theNbBuckets,
+                            const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
+  : NCollection_BaseMap (theNbBuckets, Standard_True, theAllocator) {}
 
   //! Copy constructor
   NCollection_Map (const NCollection_Map& theOther) :
index f50896c..1162164 100644 (file)
@@ -108,9 +108,11 @@ public:
  public:
   // ---------- PUBLIC METHODS ------------
 
+  //! Empty constructor.
+  NCollection_Sequence() : NCollection_BaseSequence(Handle(NCollection_BaseAllocator)()) {}
+
   //! Constructor
-  NCollection_Sequence(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
-    NCollection_BaseSequence(theAllocator) {}
+  explicit NCollection_Sequence (const Handle(NCollection_BaseAllocator)& theAllocator) : NCollection_BaseSequence(theAllocator) {}
 
   //! Copy constructor
   NCollection_Sequence (const NCollection_Sequence& theOther) :
index 2d50b49..ade83bc 100644 (file)
@@ -49,7 +49,7 @@ template <class TheItemType> class NCollection_SparseArray
 public:
 
   //! Constructor; accepts size of blocks 
-  NCollection_SparseArray (Standard_Size theIncrement)
+  explicit NCollection_SparseArray (Standard_Size theIncrement)
     : NCollection_SparseArrayBase(sizeof(TheItemType),theIncrement)
   { 
   }
index f8c12d0..412f737 100644 (file)
@@ -238,17 +238,15 @@ public:
   // ---------- PUBLIC METHODS ----------
 
   /**
+   * Empty constructor.
+   */
+  NCollection_UBTree() : myRoot(0L), myLastNode(0L), myAlloc (NCollection_BaseAllocator::CommonBaseAllocator()) {}
+
+  /**
    * Constructor.
    */
-  NCollection_UBTree
-    (const Handle(NCollection_BaseAllocator)& theAllocator=0L)
-      : myRoot(0L), myLastNode(0L)
-  {
-    if (theAllocator.IsNull())
-      myAlloc = NCollection_BaseAllocator::CommonBaseAllocator();
-    else
-      myAlloc = theAllocator;
-  }
+  explicit NCollection_UBTree (const Handle(NCollection_BaseAllocator)& theAllocator)
+  : myRoot(0L), myLastNode(0L), myAlloc (!theAllocator.IsNull() ? theAllocator : NCollection_BaseAllocator::CommonBaseAllocator()) {}
 
   /**
    * Update the tree with a new object and its bounding box.