Re: shared_ptr implicit cast to bool?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Borislav Trifonov <bdt@xxxxxxx> writes:

> ----- Original Message -----
> From: Borislav Trifonov <bdt at shaw dot ca>
> To: gcc-help at gcc dot gnu dot org
> Date: Wed, 31 Mar 2010 23:40:55 -0700
> Subject: shared_ptr implicit cast to bool?
>
>> Is it possible to do a check for null without doing .get() == 0 ?
>> In MSVC's std::tr1::shared_ptr for example there is a cast operator as part of the class that allows writing if (mySharedPtr) ...
>> Will this work in gcc or will I need to modify my code when porting?
>
> Hi, I am still hoping someone will help me out here...

Are you asking whether it works today?  If so, which version of gcc
are you interested in?  It seems to work with current gcc.

Or are you asking what the standard says?  My reading of the C++0x
draft is that shared_ptr should implicitly convert to bool.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux