CppCMS
booster/smart_ptr/operator_bool.h
00001 //  This header intentionally has no include guards.
00002 //
00003 //  Copyright (c) 2001-2009 Peter Dimov
00004 //
00005 //  Distributed under the Boost Software License, Version 1.0.
00006 //  See accompanying file LICENSE_1_0.txt or copy at
00007 //  http://www.boost.org/LICENSE_1_0.txt
00008 
00009 
00010     typedef T * this_type::*unspecified_bool_type;
00011 
00012     operator unspecified_bool_type() const // never throws
00013     {
00014         return px == 0? 0: &this_type::px;
00015     }
00016 
00017     // operator! is redundant, but some compilers need it
00018     bool operator! () const // never throws
00019     {
00020         return px == 0;
00021     }