View Issue Details

IDProjectCategoryView StatusLast Update
0029299Open CASCADEOCCT:Foundation Classespublic2018-06-29 21:19
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Target Version7.3.0Fixed in Version7.3.0 
Summary0029299: Foundation Classes, NCollection - define explicit empty constructor for map classes
DescriptionCurrently NCollection_Map, NCollection_DataMap define the following constructors:
  NCollection_DataMap (const Standard_Integer NbBuckets=1,
                     const Handle(NCollection_BaseAllocator)& theAllocator = 0L)

so that empty constructor is combined with initialization constructor by passing default arguments.

This may lead to broken code, when constructor is called implicitly by converting unrelated value to Standard_Integer, which is the first argument of map class constructor. In the following example, NCollection_Map::Contains (const NCollection_Map&) is called instead of NCollection_Map::Contains (const Quantity_ColorRGBA& ) because enumeration value can be used to initialize NCollection_Map() implicitly (this is for msvc10, newer compilers might put error here due to ambiguity):
NCollection_Map<Quantity_ColorRGBA, Quantity_ColorRGBAHasher> aColors;
if (aColors.Contains (Quantity_NOC_LIGHTGOLDENROD2))
{
  std::cerr << " @@ KO\n";
}
else
{
  std::cerr << " @@ OK\n";
}


Therefore, it is proposed defining explicit empty constructor and marking current constructor with explicit keyword.
Steps To ReproduceN/A
TagsNo tags attached.
Test case numberNot required

Activities

git

2017-11-07 17:24

administrator   ~0072021

Branch CR29299 has been created by kgv.

SHA-1: ab11308b3179d06e8b740d0deca8cfc258089e33


Detailed log of new commits:

Author: kgv
Date: Tue Nov 7 17:23:29 2017 +0300

    0029299: Foundation Classes, NCollection - define explicit empty constructor for map classes
    
    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,

kgv

2017-11-07 18:41

developer   ~0072022

Patch is ready for review.

http://jenkins-test-10.nnov.opencascade.com/view/CR29299-master-KGV

git

2017-11-07 21:32

administrator   ~0072023

Branch CR29299 has been updated forcibly by kgv.

SHA-1: e9eb73d35b0ed0e66ca166a3fd35801366eedf08

abv

2017-11-09 12:06

manager   ~0072109

No remarks, please integrate

bugmaster

2017-11-09 12:58

administrator   ~0072112

Combination -
OCCT branch : CR29299 SHA-1: e9eb73d35b0ed0e66ca166a3fd35801366eedf08
Products branch : master
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Linux:
OCCT
Total CPU difference: 20701.46000000036 / 20729.730000000465 [-0.14%]
Products
Total CPU difference: 7924.590000000066 / 7934.890000000088 [-0.13%]
Windows:
OCCT
Total CPU difference: 18760.555459198367 / 18506.86663299847 [+1.37%]
Products
Total CPU difference: 8032.959492999945 / 7981.338762099939 [+0.65%]

Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2017-11-10 12:15

administrator   ~0072159

Branch CR29299 has been deleted by kgv.

SHA-1: e9eb73d35b0ed0e66ca166a3fd35801366eedf08

Related Changesets

occt: master b6a0525b

2017-11-07 14:23:29

kgv


Committer: bugmaster Details Diff
0029299: Foundation Classes, NCollection - define explicit empty constructor for map classes

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,
Affected Issues
0029299
mod - src/NCollection/NCollection_DataMap.hxx Diff File
mod - src/NCollection/NCollection_DoubleMap.hxx Diff File
mod - src/NCollection/NCollection_IndexedDataMap.hxx Diff File
mod - src/NCollection/NCollection_IndexedMap.hxx Diff File
mod - src/NCollection/NCollection_List.hxx Diff File
mod - src/NCollection/NCollection_LocalArray.hxx Diff File
mod - src/NCollection/NCollection_Map.hxx Diff File
mod - src/NCollection/NCollection_Sequence.hxx Diff File
mod - src/NCollection/NCollection_SparseArray.hxx Diff File
mod - src/NCollection/NCollection_UBTree.hxx Diff File

Issue History

Date Modified Username Field Change
2017-11-07 17:08 kgv New Issue
2017-11-07 17:08 kgv Assigned To => abv
2017-11-07 17:24 git Note Added: 0072021
2017-11-07 18:41 kgv Note Added: 0072022
2017-11-07 18:41 kgv Status new => resolved
2017-11-07 18:41 kgv Description Updated
2017-11-07 21:32 git Note Added: 0072023
2017-11-09 12:06 abv Note Added: 0072109
2017-11-09 12:06 abv Assigned To abv => bugmaster
2017-11-09 12:06 abv Status resolved => reviewed
2017-11-09 12:46 bugmaster Test case number => Not required
2017-11-09 12:58 bugmaster Note Added: 0072112
2017-11-09 12:58 bugmaster Status reviewed => tested
2017-11-10 10:13 bugmaster Changeset attached => occt master b6a0525b
2017-11-10 10:13 bugmaster Status tested => verified
2017-11-10 10:13 bugmaster Resolution open => fixed
2017-11-10 12:15 git Note Added: 0072159
2018-02-18 00:01 abv Target Version 7.4.0 => 7.3.0
2018-06-29 21:15 aiv Fixed in Version => 7.3.0
2018-06-29 21:19 aiv Status verified => closed