blob: 8ae1527e7ccaec77e3a8b218b02448ec319da37a [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
9#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )
10
11 explicit operator bool () const BOOST_NOEXCEPT
12 {
13 return px != 0;
14 }
15
16#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
17
18 operator bool () const BOOST_NOEXCEPT
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
31 operator unspecified_bool_type() const BOOST_NOEXCEPT
32 {
33 return px == 0? 0: unspecified_bool;
34 }
35
36#elif \
37 ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
38 ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
39 ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
40
41 typedef element_type * (this_type::*unspecified_bool_type)() const;
42
43 operator unspecified_bool_type() const BOOST_NOEXCEPT
44 {
45 return px == 0? 0: &this_type::get;
46 }
47
48#else
49
50 typedef element_type * this_type::*unspecified_bool_type;
51
52 operator unspecified_bool_type() const BOOST_NOEXCEPT
53 {
54 return px == 0? 0: &this_type::px;
55 }
56
57#endif
58
59 // operator! is redundant, but some compilers need it
60 bool operator! () const BOOST_NOEXCEPT
61 {
62 return px == 0;
63 }