|
Boost : |
From: Schoenborn, Oliver (Oliver.Schoenborn_at_[hidden])
Date: 2002-07-13 09:37:58
We use a function isNull(const T&) where T is a smart pointer, and body of
function calls appropriate method of smart pointer. This leads to code that
is clear and greppable:
if (isNull(ptr)) { ... }
Best,
Oliver
> -----Original Message-----
> From: Richard Hadsell [mailto:hadsell_at_[hidden]]
> Sent: Thursday, July 11, 2002 10:30 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Syntactic sugar for scoped_ptr
>
>
> Ed Brey wrote:
> >
> > I like the operator! and implicit pointer conversion
> operators that are part of the current shared_ptr. They are
> convenient for testing whether the pointer is null or not
> with minimal verbosity. I think it would be a good idea to
> add the same to scoped_ptr and scoped_array. What do others think?
>
> I'd like it, too. I have just started using scoped_ptr and
> scoped_array, and my
> code is now littered with "if (ptr.get ())" everywhere that
> it used to read "if
> (ptr)". (and "if (! ptr.get ())")
>
> --
> Dick Hadsell 914-259-6320 Fax: 914-259-6499
> Reply-to: hadsell_at_[hidden]
> Blue Sky Studios http://www.blueskystudios.com
> 44 South Broadway, White Plains, NY 10601
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk