Boost logo

Boost Users :

Subject: [Boost-users] boost::none for boost::shared_ptr
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2014-01-29 12:27:47


Hello,

Does boost::shared_ptr offer a way to create an empty shared pointer
without a lot of typing? Perhaps something analogous to boost::none.
I am not using c++11.

Thank you,

Chris

==

using boost::none;
using boost::optional;

// declare
f(optional<CSomeReallyLongClassName> Item);
g(shared_ptr<CSomeReallyLongClassName> pItem);

// invoke f with empty object
f(none);

// invoke g with empty object
g(shared_ptr<CSomeReallyLongClassName>());


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net