1 // This header intentionally has no include guards. 2 // 3 // Copyright (c) 2001-2009 Peter Dimov 4 // 5 // Distributed under the Boost Software License, Version 1.0. 6 // See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt 8 9 #if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) 10 operator bool() const11 operator bool () const 12 { 13 return px != 0; 14 } 15 16 #elif defined( _MANAGED ) 17 unspecified_bool(this_type ***)18 static void unspecified_bool( this_type*** ) 19 { 20 } 21 22 typedef void (*unspecified_bool_type)( this_type*** ); 23 operator unspecified_bool_type() const24 operator unspecified_bool_type() const // never throws 25 { 26 return px == 0? 0: unspecified_bool; 27 } 28 29 #elif \ 30 ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ 31 ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ 32 ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) 33 34 typedef T * (this_type::*unspecified_bool_type)() const; 35 operator unspecified_bool_type() const36 operator unspecified_bool_type() const // never throws 37 { 38 return px == 0? 0: &this_type::get; 39 } 40 41 #else 42 43 typedef T * this_type::*unspecified_bool_type; 44 operator unspecified_bool_type() const45 operator unspecified_bool_type() const // never throws 46 { 47 return px == 0? 0: &this_type::px; 48 } 49 50 #endif 51 52 // operator! is redundant, but some compilers need it operator !() const53 bool operator! () const // never throws 54 { 55 return px == 0; 56 } 57