int priority();
void processWidget(std::tr1::shared_ptr<Widget> pw, int priority);
// it won't compile, tr1::shared_ptr constructor
// taking a raw pointer is explicit
processWidget(new Widget, priority());
processWidget(std::tr1::shared_ptr<Widget>(new Widget), priority());
the order of performing maybe
1. Execute “new Widget”.
2. Call priority.
3. Call the tr1::shared_ptr constructor.
If the call to priority yields an exception, the pointer returned from “new Widget” will be lost.
// Store newed objects in smart pointers in standalone statements
std::tr1::shared_ptr<Widget> pw(new Widget);
processWidget(pw, priority());