DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0026549

Provide move constructors and operators for basic classes

Open CASCADEOCCT:Foundation Classesclosed6 public notes

Search issues

Description

C++11 introduces notion of rvalue references which can be used to avoid unnecessary copying of temporary objects, see http://www.artima.com/cppsource/rvalue.html

Rvalue references are supported by VC++ 10 and above, and by GCC 4.3 and above, thus they can be used in modern OCCT (since #0024023).

The first candidates for this improvement are Handles and collections.

Public activity

6 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Tue Aug 11 23:01:05 2015 +0300

    0026549: Provide move constructors and operators for basic classes
    
    Move constructor and operator added for opencascade::handle<>
02Commenter 2
First version is pushed to CR26549. It provides move semantics for Handles. Though it does not give noticeable change in performance in tests, it reduces number of calls to Standard_Transient::IncrementRefCounter() methods of Handle, and thus is potentially useful (especially in multithreaded programs, as each call sets a lock).

The measured numbers of calls are:

| Operation | master | CR26549 |
|----------------------------------|
| DRAW start | 4075 | 4075 |
| pload ALL | 137767 | 128967 |
| bottle.tcl | 30749697 | 30440160 |
03Commenter 3
Other classes for which move semantics would be useful are vector and matrix classes from math package.

04Commenter 2
Related modification within CR27111_6 has been reviewed without remarks.
Should be tested in scope of #0027111.
05Commenter 3
Tested in framework of branch CR27111_6
06Commenter 1
Branch [archived branch] has been deleted by Commenter 2.

[revision removed]

Related records