Boost logo

Boost :

From: Vugts, Robert (robert.vugts_at_[hidden])
Date: 2000-09-04 09:27:15


Whilst we are on the subject: Why is the constructor
that accepts an std::auto_ptr not explicit ?

    -- Rob

-----Original Message-----
From: Gernot Neppert [mailto:gn_at_[hidden]]
Sent: 04 September 2000 15:12
To: boost_at_[hidden]
Subject: [boost] Always explicit , why?

I've been using a reference-counted pointer class extensively in my
c++ programs, and I'd like to switch completely to boost::shared_ptr.
But there's one thing that puts me off: The constructor that accepts
a raw pointer is declared "explicit".
When you're passing around pointers as shared_ptr parameters, it's
just unnerving always having to provide the explicit ctor-call.
I couldn't come up with a compelling reason why this should be
necessary. When there's a function that expects a shared_ptr<Type>,
why not provide it simply a "new Type()"?
Am I overlooking any ambiguities or unexpected behavour that could
result from removing the "explicit" from shared_ptr's ctor?
Or is it plainly considered heresy to deviate from Standard
Library's "auto_ptr" pattern ;-)

[INFO] -- Content Manager:
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and all
copies of it from your system, destroy any hard copies of it and notify the
sender. You must not, directly or indirectly, use, disclose, distribute,
print, or copy any part of this message if you are not the intended
recipient. CREDIT SUISSE GROUP and each of its subsidiaries each reserve
the right to monitor all e-mail communications through its networks. Any
views expressed in this message are those of the individual sender, except
where the message states otherwise and the sender is authorised to state
them to be the views of any such entity.
Unless otherwise stated, any pricing information given in this message is
indicative only, is subject to change and does not constitute an offer to
deal at any price quoted.
Any reference to the terms of executed transactions should be treated as
preliminary only and subject to our formal written confirmation.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk