File indexing completed on 2025-01-18 09:51:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_RANGE_SAFE_BOOL_INCLUDED_HPP
0011 #define BOOST_RANGE_SAFE_BOOL_INCLUDED_HPP
0012
0013 #include <boost/config.hpp>
0014 #include <boost/range/config.hpp>
0015
0016 namespace boost
0017 {
0018 namespace range_detail
0019 {
0020
0021 template<class DataMemberPtr>
0022 class safe_bool
0023 {
0024 public:
0025 typedef safe_bool this_type;
0026
0027 #if (defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570)) || defined(__CINT_)
0028 typedef bool unspecified_bool_type;
0029 static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr)
0030 {
0031 return x;
0032 }
0033 #elif defined(_MANAGED)
0034 static void unspecified_bool(this_type***)
0035 {
0036 }
0037 typedef void(*unspecified_bool_type)(this_type***);
0038 static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr)
0039 {
0040 return x ? unspecified_bool : 0;
0041 }
0042 #elif \
0043 ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
0044 ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
0045 ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
0046
0047 typedef bool (this_type::*unspecified_bool_type)() const;
0048
0049 static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr)
0050 {
0051 return x ? &this_type::detail_safe_bool_member_fn : 0;
0052 }
0053 private:
0054 bool detail_safe_bool_member_fn() const { return false; }
0055 #else
0056 typedef DataMemberPtr unspecified_bool_type;
0057 static unspecified_bool_type to_unspecified_bool(const bool x, DataMemberPtr p)
0058 {
0059 return x ? p : 0;
0060 }
0061 #endif
0062 private:
0063 safe_bool();
0064 safe_bool(const safe_bool&);
0065 void operator=(const safe_bool&);
0066 ~safe_bool();
0067 };
0068
0069 }
0070 }
0071
0072 #endif