Boost logo

Boost Users :

From: Matthias Kaeppler (noreply_at_[hidden])
Date: 2005-08-27 09:22:04


Hi,

I was wondering why e.g. boost:shared_ptr has an explicit constructor.
This makes automatic conversion from T* to shared_ptr<T> impossible.
The lack of the opposite conversion is covered by the FAQ and
reasonable; however, I couldn't think of a good reason why I shouldn't
be able to do something like this:

std::set< boost::shared_ptr<Foo> > coll;
coll.insert(new Foo); // error: No implicit conversion from Foo* to
shared_ptr<Foo>

Best regards,
Matthias


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