operator_bool.hpp
Go to the documentation of this file.
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 #if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
00010 
00011     operator bool () const
00012     {
00013         return px != 0;
00014     }
00015 
00016 #elif defined( _MANAGED )
00017 
00018     static void unspecified_bool( this_type*** )
00019     {
00020     }
00021 
00022     typedef void (*unspecified_bool_type)( this_type*** );
00023 
00024     operator unspecified_bool_type() const // never throws
00025     {
00026         return px == 0? 0: unspecified_bool;
00027     }
00028 
00029 #elif \
00030     ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
00031     ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
00032     ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
00033 
00034     typedef T * (this_type::*unspecified_bool_type)() const;
00035 
00036     operator unspecified_bool_type() const // never throws
00037     {
00038         return px == 0? 0: &this_type::get;
00039     }
00040 
00041 #else
00042 
00043     typedef T * this_type::*unspecified_bool_type;
00044 
00045     operator unspecified_bool_type() const // never throws
00046     {
00047         return px == 0? 0: &this_type::px;
00048     }
00049 
00050 #endif
00051 
00052     // operator! is redundant, but some compilers need it
00053     bool operator! () const // never throws
00054     {
00055         return px == 0;
00056     }


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29