Boost logo

Boost Users :

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


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

Best regards,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at