DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0024971

Incomplete interface of NCollection classes

Open CASCADEOCCT:Foundation Classesclosed7 public notes

Search issues

Description

As revealed during implementation of #0024750, NCollection classes lack some features provided by their TCollection equivalents:

- HArray1, HArr1y2: constructor with additional argument of element_type allowing to initialize the array at construction time by specified value

- List: methods First() and Last() (and method Value() of the iterator) return const &, while in TCollection they return non-const &

- Constructor of NCollection_DataMap::DataMapNode uses operator = to assign its key; hence default constructor is necessary for key type to initialize a node. In TCollection_DataMap, copy constructor is used instead; this allows using type with no default constructor as a key type to a data map. In this, TCollection implementation seems to be more consistent with STL, see e.g. http://msdn.microsoft.com/en-us/library/bb385469.aspx

Public activity

7 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Fix pushed to branches CR24971 in OCCT and Products, please review
02Commenter 2
Note that one drawback of this change is that now it is not any more possible to use one container type directly as element of another one, since most of containers do not provide public copy constructor. Such cases can be corrected via use of Handles. The changes of this kind in Visualization are included (mostly use HSequence instead of Sequence in List).
03Commenter 2
Please test the patch.
04Commenter 4
Dear Commenter 3,

Branch CR24971 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]
[revision removed]

Number of compiler warnings:

Linux: 16 (16 on master)
Windows: 0 (0 on master)
MacOS: 200 (203 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
omf - emesh (014) - A2, A3, A4, A6, A7, B1, B2, B3, B4, B5, B6, B7
omf - quality 9015) - A1, A2, A3, A4, B1, B2, B3, B4, C1

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 376012688 / 383800460
Total CPU difference: 40887.671875 / 42820.09375

Testing on Windows:
Total MEMORY difference: 376012688 / 383800460
Total CPU difference: 40887.671875 / 42820.09375

05Commenter 5
The regression is caused by bug in copy constructor of NCollection_Vector, which creates invalid copy if original vector is empty. This problem has been fixed long ago for assignment operator (see #0007698), but not for copy constructor.

The trigger for regression to appear was change made in #0024971 to use copy constructor instead of assignment operator in list, sequence, and maps.
06Commenter 6
I have pushed fix to CR24971, please re-test
07Commenter 7
Dear Commenter 3,

Branch CR24971 from occt git repository and CR24971 from products git repository are compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]
[revision removed]

Number of compiler warnings:

occt component :
Linux: 16 (16 on master)
Windows: 0 (0 on master)
MacOS: 200 (203 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 347767356 / 361261972
Total CPU difference: 48794.049999999865 / 53203.24999999999

Testing on Windows:
Total MEMORY difference: 376076616 / 383786928
Total CPU difference: 39641.53125 / 42819.859375

There are no differences in images found by testdiff.

Related records