1 /*=============================================================================
2 Copyright (c) 2003 Joel de Guzman
3 http://spirit.sourceforge.net/
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8 #if !defined(BOOST_SPIRIT_SAFE_BOOL_HPP)
9 #define BOOST_SPIRIT_SAFE_BOOL_HPP
11 #include <boost/config.hpp>
12 #include <boost/detail/workaround.hpp>
13 #include <boost/spirit/home/classic/namespace.hpp>
15 namespace boost { namespace spirit {
17 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
27 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
29 typedef void (safe_bool_impl::*type)(T*);
31 typedef T* TP; // workaround to make parsing easier
33 typedef TP safe_bool_impl::*type;
38 template <typename DerivedT, typename BaseT = impl::no_base<DerivedT> >
39 struct safe_bool : BaseT
42 typedef impl::safe_bool_impl<DerivedT> impl_t;
43 typedef typename impl_t::type bool_type;
46 operator bool_type() const
48 return static_cast<const DerivedT*>(this)->operator_bool() ?
54 return static_cast<DerivedT*>(this)->operator_bool() ?
59 BOOST_SPIRIT_CLASSIC_NAMESPACE_END