DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0029961

Foundation Classes - NCollection_Shared constructor passes arguments by copy

Open CASCADEOCCT:Foundation Classesclosed6 public notes

Search issues

Description

The following code:
  Standard_Mutex aMutex;
  Handle(NCollection_Shared<Standard_Mutex::Sentry>) aLock = new NCollection_Shared<Standard_Mutex::Sentry> (aMutex);
  aLock.Nullify();

produces compilation error:
error: C2248: 'Standard_Mutex::Standard_Mutex': cannot access private member declared in class 'Standard_Mutex'

Steps to reproduce

  Standard_Mutex aMutex;
  Handle(NCollection_Shared<Standard_Mutex::Sentry>) aLock
    = new NCollection_Shared<Standard_Mutex::Sentry> (aMutex);

  struct Dummy1 { Dummy1 (Standard_Mutex& , int ) {} };
  Handle(NCollection_Shared<Dummy1>) aLock1
    = new NCollection_Shared<Dummy1> (aMutex, 2);

  struct Dummy2 { Dummy2 (int , Standard_Mutex& ) {} };
  Handle(NCollection_Shared<Dummy2>) aLock2
    = new NCollection_Shared<Dummy2> (2, aMutex);

  struct Dummy3 { Dummy3 (int , const double& ) {} };
  Handle(NCollection_Shared<Dummy3>) aLock3
    = new NCollection_Shared<Dummy3> (2, 3);

  struct Dummy4 { Dummy4 (Standard_Mutex& , Standard_Mutex& ) {} };
  Handle(NCollection_Shared<Dummy4>) aLock4
    = new NCollection_Shared<Dummy4> (aMutex, aMutex);

Public activity

6 archived notes

Participants are labeled by their role within this record.

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

[revision removed]


Detailed log of new commits:

Author: Author
Date: Sun Jul 15 11:35:12 2018 +0300

    0029961: Foundation Classes - NCollection_Shared constructor passes arguments by copy
02Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
03Author
04Commenter 4
No remarks, please integrate
05Commenter 1
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings
06Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records