MantisBT - Open CASCADE
View Issue Details
0029230Open CASCADE[OCCT] OCCT:Foundation Classespublic2017-10-15 10:582019-11-08 17:48
kgv 
kgv 
normalfeature 
assignedopen 
 
[OCCT] 7.5.0* 
0029230: Foundation Classes - provide move constructors for basic collections
Move constructors can be used for code optimization, and should be provided for basic collections.
N/A
No tags attached.
related to 0028470closed bugmaster Foundation Classes, NCollection_Array1 - add Resize() method for re-allocating array with new limits 
parent of 0029258closed bugmaster Foundation Classes - provide move constructors for string classes 
Issue History
2017-10-15 10:58kgvNew Issue
2017-10-15 10:58kgvAssigned To => abv
2017-10-15 16:08gitNote Added: 0071500
2017-10-15 16:27gitNote Added: 0071501
2017-10-15 18:30gitNote Added: 0071502
2017-10-15 18:32gitNote Added: 0071503
2017-10-15 19:33gitNote Added: 0071504
2017-10-15 20:48kgvRelationship addedrelated to 0028470
2017-10-15 21:54kgvNote Added: 0071506
2017-10-15 21:54kgvStatusnew => resolved
2017-10-25 09:20abvNote Added: 0071765
2017-10-25 09:20abvAssigned Toabv => kgv
2017-10-25 09:20abvStatusresolved => feedback
2017-10-25 10:52kgvRelationship addedparent of 0029258
2017-10-25 10:56gitNote Added: 0071768
2017-10-25 11:08gitNote Added: 0071770
2017-10-25 12:20kgvStatusfeedback => assigned
2019-09-04 13:04abvTarget Version7.4.0 => 7.5.0*
2019-11-07 14:50bugmasterCategoryOCCT:Foundation Classes => PRODUCTS:Advanced wrappers
2019-11-08 17:48kgvCategoryPRODUCTS:Advanced wrappers => OCCT:Foundation Classes

Notes
(0071500)
git   
2017-10-15 16:08   
Branch CR29230 has been created by kgv.

SHA-1: 5d7d2585f3e6615987bbe6f5762a75258cedc351


Detailed log of new commits:

Author: kgv
Date: Sun Oct 15 16:08:01 2017 +0300

    0029230: Foundation Classes - provide move constructors for basic collections
    
    Standard_NO_RVALUE_REFERENCE - added new macros disabling
    move constructors on obsolete compilers.
    
    NCollection_Array1 - added method Exchange().
    
    NCollection_Array2 - added methods Resize(), Move(), Exchange()
    and move constructor + operator.
    
    NCollection_Map, NCollection_DataMap, NCollection_DoubleMap,
    NCollection_IndexedDataMap, NCollection_IndexedMap - added
    method Move() and move constructor + operator.
    
    NCollection_Sequence, NCollection_Vector, NCollection_List,
    TCollection_AsciiString, TCollection_ExtendedString,
    NCollection_UtfString - added methods
    Move(), Exchange() and move constructor + operator.
    
    NCollection_SparseArray - added method Move().
(0071501)
git   
2017-10-15 16:27   
Branch CR29230 has been updated forcibly by kgv.

SHA-1: fa1b95b7cad53341e585ccf2fbdf9125fd34ac06
(0071502)
git   
2017-10-15 18:30   
Branch CR29230 has been updated forcibly by kgv.

SHA-1: 77022217799c2af4e5117239ec64782fbaa918a9
(0071503)
git   
2017-10-15 18:32   
Branch CR29230 has been updated forcibly by kgv.

SHA-1: 4853d53bbc684d869544ebc843492af4d76a150b
(0071504)
git   
2017-10-15 19:33   
Branch CR29230 has been updated forcibly by kgv.

SHA-1: f54463a5aefb21ba28bf22cbe58ff984a9a601fb
(0071506)
kgv   
2017-10-15 21:54   
Patch is ready for review.
(0071765)
abv   
2017-10-25 09:20   
In my opinion, we need some proof that these methods are useful, and code that tests them, before they can be integrated.

Within OCCT, move constructors and assignments are called only for TCollection and NCollection strings (checked by compilation with VS 2017 while declaring all these methods deprecated), in around 1000 places. Thus, these seem to make sense.

For other classes move constructors and assignments never get called. This means they are useless, at least within current code of OCCT. I believe they could be useful in some circumstances, e.g. when you have a map of such objects and add a new object to the map. However, currently this does not seem to happen. Perhaps something should be done to enable this opportunity (e.g. add overloaded method Add() for map supporting move semantics), but if can also happen that this does not make sense. This is to be investigated.
(0071768)
git   
2017-10-25 10:56   
Branch CR29230 has been updated forcibly by kgv.

SHA-1: 3eb05f0cf0e7bf946e6c52dea308ab4590c41a0c
(0071770)
git   
2017-10-25 11:08   
Branch CR29230_1 has been created by kgv.

SHA-1: 5634d1e5c2ae2b2b9c231f9c8e645dff779990ce


Detailed log of new commits:

Author: kgv
Date: Wed Oct 25 11:08:13 2017 +0300

    0029230: Foundation Classes - provide move constructors for basic collections
    
    NCollection_Array1 - added method Swap().
    
    NCollection_Array2 - added methods Resize(), Move(), Swap()
    and move constructor + operator.
    
    NCollection_Map, NCollection_DataMap, NCollection_DoubleMap,
    NCollection_IndexedDataMap, NCollection_IndexedMap - added
    method Move() and move constructor + operator.
    
    NCollection_Sequence, NCollection_Vector, NCollection_List - added methods
    Move(), Swap() and move constructor + operator.
    
    NCollection_SparseArray - added method Move().