Re: [Boost-Users] testing if shared_ptr has been assigned
I should point out that I went 'back' to get() because I got tired of explaining the 'correct' way [ie, if( b ) ] Darin Adler provided in his answer. |---------+----------------------------------------------------> | | Dick | | | Bridges/CSE/IRV/CONTRACTOR/TOSHIBA-TAIS@T| | | OSHIBA-TAIS | | | | | | 12/12/2002 08:07 AM | | | Please respond to Boost-Users | | | | |---------+---------------------------------------------------->
----------------------------------------------------------------------------------------------| | | | To: Boost-Users@yahoogroups.com | | cc: | | Subject: Re: [Boost-Users] testing if shared_ptr has been assigned | ----------------------------------------------------------------------------------------------|
From the docs: <snippet> get
T * get() const; // never throws
Returns: the stored pointer.
Throws: nothing.
</snippet>
Therefore you can use
if( b.get() )
or
if( b.get() == NULL )
"TEA Hartmann,
Steven" To:
boost-users@yahoogroups.com
participants (1)
-
dick.bridges@tais.com