diff --git a/doc/reference.html b/doc/reference.html
index db9e205..51d73e6 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -17,8 +17,6 @@
{
typedef implementation-defined safe_bool;
bool empty() const;
- operator safe_bool() const;
- safe_bool operator!() const;
};
// For N in [0, MAX_ARGS]
@@ -66,6 +64,10 @@
void swap(functionN&);
void clear();
+ // Boolean context
+ operator safe_bool() const;
+ bool operator!() const;
+
// Invocation
result_type operator()(Arg1 a1, Arg2 a2, ..., ArgN aN) const;
};
@@ -146,20 +148,6 @@
Throws: will not throw.
- operator safe_bool() const
-
- - Returns:
safe_bool
equivalent of !empty()
- - Throws: will not throw.
- - Notes: The
safe_bool
type can be used in contexts where a bool is expected (e.g., an if condition); however, implicit conversions (e.g., to int) that can occur with bool are not allowed, eliminating some sources of user error.
-
-
- safe_bool operator!() const
-
-
Class template functionN
is actually a family of related classes function0
, function1
, etc., up to some implementation-defined maximum. In this context, N
refers to the number of parameters and f
refers to the implicit object parameter.
@@ -239,6 +227,19 @@
Postconditions: empty()
.
+ operator safe_bool() const
+
+ - Returns:
safe_bool
equivalent of !empty()
+ - Throws: will not throw.
+ - Notes: The
safe_bool
type can be used in contexts where a bool is expected (e.g., an if condition); however, implicit conversions (e.g., to int) that can occur with bool are not allowed, eliminating some sources of user error.
+
+
+ bool operator!() const
+
+ - Returns:
this->empty()
+ - Throws: will not throw.
+
+
result_type operator()(Arg1 a1, Arg2 a2, ..., ArgN aN) const;
- Requires:
!empty()
.
diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp
index 04e0a6e..27002c9 100644
--- a/include/boost/function/function_base.hpp
+++ b/include/boost/function/function_base.hpp
@@ -278,25 +278,6 @@ namespace boost {
detail::function::any_pointer,
detail::function::functor_manager_operation_type);
detail::function::any_pointer functor;
-
-#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG)
- // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it
- operator bool () const { return !this->empty(); }
-#else
- private:
- struct dummy {
- void nonnull() {};
- };
-
- typedef void (dummy::*safe_bool)();
-
- public:
- operator safe_bool () const
- { return (this->empty())? 0 : &dummy::nonnull; }
-
- safe_bool operator!() const
- { return (this->empty())? &dummy::nonnull : 0; }
-#endif
};
/* Poison comparison between Boost.Function objects (because it is
diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp
index 7358bd8..488d845 100644
--- a/include/boost/function/function_template.hpp
+++ b/include/boost/function/function_template.hpp
@@ -419,6 +419,25 @@ namespace boost {
invoker = 0;
}
+#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG)
+ // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it
+ operator bool () const { return !this->empty(); }
+#else
+ private:
+ struct dummy {
+ void nonnull() {};
+ };
+
+ typedef void (dummy::*safe_bool)();
+
+ public:
+ operator safe_bool () const
+ { return (this->empty())? 0 : &dummy::nonnull; }
+
+ bool operator!() const
+ { return this->empty(); }
+#endif
+
private:
void assign_to_own(const BOOST_FUNCTION_FUNCTION& f)
{