1 // This header intentionally has no include guards. 2 // 3 // Copyright (c) 2001-2009, 2012 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( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )\ 10 && !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130)) 11 operator bool() const12 explicit operator bool () const BOOST_SP_NOEXCEPT 13 { 14 return px != 0; 15 } 16 17 #elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) 18 operator bool() const19 operator bool () const BOOST_SP_NOEXCEPT 20 { 21 return px != 0; 22 } 23 24 #elif defined( _MANAGED ) 25 unspecified_bool(this_type ***)26 static void unspecified_bool( this_type*** ) 27 { 28 } 29 30 typedef void (*unspecified_bool_type)( this_type*** ); 31 operator unspecified_bool_type() const32 operator unspecified_bool_type() const BOOST_SP_NOEXCEPT 33 { 34 return px == 0? 0: unspecified_bool; 35 } 36 37 #elif \ 38 ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ 39 ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ 40 ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) 41 42 typedef element_type * (this_type::*unspecified_bool_type)() const; 43 operator unspecified_bool_type() const44 operator unspecified_bool_type() const BOOST_SP_NOEXCEPT 45 { 46 return px == 0? 0: &this_type::get; 47 } 48 49 #else 50 51 typedef element_type * this_type::*unspecified_bool_type; 52 operator unspecified_bool_type() const53 operator unspecified_bool_type() const BOOST_SP_NOEXCEPT 54 { 55 return px == 0? 0: &this_type::px; 56 } 57 58 #endif 59 60 // operator! is redundant, but some compilers need it operator !() const61 bool operator! () const BOOST_SP_NOEXCEPT 62 { 63 return px == 0; 64 } 65