blob: 809eff55b43ca4c6698586e1ac1175ebd20d9ae9 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001// 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 Thompson3d613fd2013-10-15 15:39:04 -07009#if !defined( NDNBOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( NDNBOOST_NO_CXX11_NULLPTR )
Jeff Thompsonf7d49942013-08-01 16:47:40 -070010
Jeff Thompson3d613fd2013-10-15 15:39:04 -070011 explicit operator bool () const NDNBOOST_NOEXCEPT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070012 {
13 return px != 0;
14 }
15
Jeff Thompson3d613fd2013-10-15 15:39:04 -070016#elif ( defined(__SUNPRO_CC) && NDNBOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070017
Jeff Thompson3d613fd2013-10-15 15:39:04 -070018 operator bool () const NDNBOOST_NOEXCEPT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070019 {
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 Thompson3d613fd2013-10-15 15:39:04 -070031 operator unspecified_bool_type() const NDNBOOST_NOEXCEPT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070032 {
33 return px == 0? 0: unspecified_bool;
34 }
35
36#elif \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070037 ( defined(__MWERKS__) && NDNBOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070038 ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070039 ( defined(__SUNPRO_CC) && NDNBOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
Jeff Thompsonf7d49942013-08-01 16:47:40 -070040
41 typedef element_type * (this_type::*unspecified_bool_type)() const;
42
Jeff Thompson3d613fd2013-10-15 15:39:04 -070043 operator unspecified_bool_type() const NDNBOOST_NOEXCEPT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070044 {
45 return px == 0? 0: &this_type::get;
46 }
47
48#else
49
50 typedef element_type * this_type::*unspecified_bool_type;
51
Jeff Thompson3d613fd2013-10-15 15:39:04 -070052 operator unspecified_bool_type() const NDNBOOST_NOEXCEPT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070053 {
54 return px == 0? 0: &this_type::px;
55 }
56
57#endif
58
59 // operator! is redundant, but some compilers need it
Jeff Thompson3d613fd2013-10-15 15:39:04 -070060 bool operator! () const NDNBOOST_NOEXCEPT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070061 {
62 return px == 0;
63 }