Forcing use of SharedPtr ?

Please post support and help requests here.
Posts: 52
Joined: 09 Feb 2009, 19:20
Location: San Francisco bay area.

Forcing use of SharedPtr ?

Postby rmoffer » 20 Apr 2012, 21:22

We seem to be seeing some issues with mixing a bare pointer with a shared pointer and I wondered if there's a way to generate a compile time error in that case ?

The scenario is that we're using an LRU cache - which returns a SharedPtr from a item lookup. But some developers (not me :-) stored the results of a cache lookup in a bare pointer. When the cache item was replaced the code paths that used bare pointers had issues, those (mine :-) that used SharedPtr's were okay.

Since this has happened multiple times I'd like to solve it mechanically...

Any thoughts ?


Posts: 89
Joined: 08 Nov 2010, 17:29

Re: Forcing use of SharedPtr ?

Postby marlowabnp » 24 Apr 2012, 09:34

I too have been nobbled by this. See viewtopic.php?f=12&t=5299. I reckon the poco shared ptr ctor needs to be declared explicit to prevent accidental creation from a naked ptr.

Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest