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 <SHartmann@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@yahoogroups.com> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
participants (1)
-
dick.bridges@tais.com