|
Boost Users : |
From: dick.bridges_at_[hidden]
Date: 2002-12-12 11:07:23
>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_at_[hidden]
<SHartmann_at_aus.t cc:
elusa.com> Subject: [Boost-Users] testing if shared_ptr has been assigned
12/11/2002 11:01
AM
Please respond
to Boost-Users
I need some help in testing for the condition of whether a shared_ptr has
been assigned. In the following example, the "if( b != NULL ) does not
work. How would I do this test?
typedef boost::shared_ptr<int> IPtr;
int i( 0 );
IPtr a( i );
IPtr b;
if( some condition )
b = a;
if( b != NULL ) { // How should this really be coded?
}
Best Regards,
Steve
[Non-text portions of this message have been removed]
Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net