id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 41,smart_ptr: (auto_ptr) constructor,d-elf,Peter Dimov,"{{{ I'm wondering why the smart_ptr's (auto_ptr) constructor is defined as explicit? In smart_ptr's documentation this constructor is not explicit: --cut-- template shared_ptr(std::auto_ptr& r); --cut-- but in source: --cut-- template explicit shared_ptr(std::auto_ptr& r) { pn = new long(1); // may throw px = r.release(); // fix: moved here to stop leak if new throws } --cut-- explicit shared_ptr(std::auto_ptr& r) { pn = new long(1); // may throw px = r.release(); // fix: moved here to stop leak if new throws } --cut-- It would be nice to do for example following without initializing an shared_ptr instance by myself: // START void func_that_eats_both_ap_and_sp(const boost::shared_ptr& sp) { // ... } int main(void) { std::auto_ptr ap(0); func_that_eats_both_ap_and_sp(ap); } // END auto_ptr's constructor should not be the reason why this is defined as it is, since it is defined as explicit... -d-elf }}}",Feature Requests,closed,,smart_ptr,None,,None,,