Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 9 | #if !defined( NDNBOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( NDNBOOST_NO_CXX11_NULLPTR ) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 10 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 11 | explicit operator bool () const NDNBOOST_NOEXCEPT |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 12 | { |
| 13 | return px != 0; |
| 14 | } |
| 15 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 16 | #elif ( defined(__SUNPRO_CC) && NDNBOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 17 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 18 | operator bool () const NDNBOOST_NOEXCEPT |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 19 | { |
| 20 | return px != 0; |
| 21 | } |
| 22 | |
| 23 | #elif defined( _MANAGED ) |
| 24 | |
| 25 | static void unspecified_bool( this_type*** ) |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | typedef void (*unspecified_bool_type)( this_type*** ); |
| 30 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 31 | operator unspecified_bool_type() const NDNBOOST_NOEXCEPT |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 32 | { |
| 33 | return px == 0? 0: unspecified_bool; |
| 34 | } |
| 35 | |
| 36 | #elif \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 37 | ( defined(__MWERKS__) && NDNBOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 38 | ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 39 | ( defined(__SUNPRO_CC) && NDNBOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 40 | |
| 41 | typedef element_type * (this_type::*unspecified_bool_type)() const; |
| 42 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 43 | operator unspecified_bool_type() const NDNBOOST_NOEXCEPT |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 44 | { |
| 45 | return px == 0? 0: &this_type::get; |
| 46 | } |
| 47 | |
| 48 | #else |
| 49 | |
| 50 | typedef element_type * this_type::*unspecified_bool_type; |
| 51 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 52 | operator unspecified_bool_type() const NDNBOOST_NOEXCEPT |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 53 | { |
| 54 | return px == 0? 0: &this_type::px; |
| 55 | } |
| 56 | |
| 57 | #endif |
| 58 | |
| 59 | // operator! is redundant, but some compilers need it |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 60 | bool operator! () const NDNBOOST_NOEXCEPT |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 61 | { |
| 62 | return px == 0; |
| 63 | } |