
brangdon@cix.compulink.co.uk (Dave Harris) writes:
In-Reply-To: <200408061504.i76F4EW20044@entwistle.systems.susq.com> stewart@sig.com (Rob Stewart) wrote (abridged):
Note, however, that "rawptr" is rather terse for something you're trying to call attention to.
I liked the terseness. To be honest I am less likely to use new features if they are verbose. "boost::raw_ptr()" is already 16 characters. Surely the main benefit comes from being able to search for raw_ptr with tools like grep, rather than with eyeballs?
The later suggestion of writing:
boost::shared_ptr<Widget> p = boost::shared_ptr_cast<Widget>(new Widget);
is even more verbose and repetitive, the word "Widget" occurring 3 times. The original proposal:
boost::shared_ptr<Widget> wp2 = boost::raw_ptr(new Widget(a, b));
at least fits into 80 columns.
This is a bit similar to the borrowed( ... ) and null_ok( ... ) operators from Boost.Python
Is it time to wrap operator new()? For example:
boost::shared_ptr<Widget> wp2 = boost::make<Widget>(a, b);
with something like:
template <typename R, typename A, typename B> inline raw_ptr_t<R> make( A &a, B &b ) { return raw_ptr_t<R>( new R( a, b ) ); }
Users being allowed to specialise make<> with their own factory code if desired.
Yeah, except #define raw_ptr_t std::auto_ptr ;-) -- Dave Abrahams Boost Consulting http://www.boost-consulting.com