what is the correct way to make sure user use share_ptr and not regular ptr?

Posted by eriks on Stack Overflow See other posts from Stack Overflow or by eriks
Published on 2010-03-15T07:59:25Z Indexed on 2010/03/15 8:09 UTC
Read the original article Hit count: 293

Filed under:
|
|

In my class the constructor is private and i added a static method "CreateMyClassPtr" that uses the constructor and returns a share_ptr of it.

Is it the correct implementation?

Do you think i even have to make sure that shared_ptr will be used? Maybe i should leave it to the user to decide?

© Stack Overflow or respective owner

Related posts about c++

Related posts about shared-ptr