You just have to change your line:

Car * carPtr = &car;

with

const Car * carPtr = &car;

Philippe

On Thu, 20 Sep 2018 10:40:01 +0200
Michal Lazo <xlazo...@gmail.com> wrote:


> Hello
> example
> https://pastebin.com/xL9yWhKe
> 
> 
> 
> I never used QSharedDataPointer in my code but is is heavily used in Qt
> My problem is that I found that QSharedDataPointer prefer non const operator 
> for access raw pointer to object instead of const variant.
> And at the end non const variant call detach() = cloning object
> Look at my example and plz debug if conditions
> 
> 
> I use compiler MSVC 2015, 2017
> 
> 
> My problem is that for example QTextCursor use this constructions and it 
> heavily call detach. And simple call const variant of method should fix this.
> 
> 
> Anybody can explain this behaviour?  
> 
> 
> 
> 
> 
> 
> 

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to