diff --git a/doc/reference.html b/doc/reference.html index a245198..f96bcf1 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -15,8 +15,10 @@ namespace boost { class function_base { + typedef implementation-defined safe_bool; bool empty() const; - operator bool() const; + operator safe_bool() const; + safe_bool operator!() const; }; // For N in [0, MAX_ARGS] @@ -65,8 +67,8 @@ typename Policy, typename Mixin, typename Allocator> - void swap(const function<Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>&, - const function<Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>&); + void swap(const functionN<Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>&, + const functionN<Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>&); // For any N in [0, MAX_ARGS] template<typename ResultType, @@ -105,6 +107,43 @@ } +
+
f
is compatible if for the given set of argument types Arg1
, Arg2
, ..., ArgN
and a return type ResultType
, the appropriate following function is well-formed:
++ // if ResultType is not void + ResultType foo(Arg1 arg1, Arg2 arg2, ..., ArgN argN) + { + return f(arg1, arg2, ..., argN); + } + + // if ResultType is void + ResultType foo(Arg1 arg1, Arg2 arg2, ..., ArgN argN) + { + f(arg1, arg2, ..., argN); + } ++
A special provision is made for pointers to member functions. Though they are not function objects, Boost.Function will adapt them internally to function objects. This requires that a pointer to member function of the form R (X::*mf)(Arg1, Arg2, ..., ArgN) cv-quals
be adapted to a function object with the following function call operator overloads:
+
+ R operator()(cv-quals X& x, Arg1 arg1, Arg2 arg2, ..., ArgN argN) const + { + return x.*mf(arg1, arg2, ..., argN); + } + + R operator()(cv-quals X* x, Arg1 arg1, Arg2 arg2, ..., ArgN argN) const + { + return x->*mf(arg1, arg2, ..., argN); + } + + template<typename P> + R operator()(cv-quals P& x, Arg1 arg1, Arg2 arg2, ..., ArgN argN) const + { + return (*x).*mf(arg1, arg2, ..., argN); + } ++
function_base
Class function_base
is the common base class for all Boost.Function objects. Objects of type function_base
may not be created directly.
@@ -114,10 +153,18 @@
!empty()
safe_bool
equivalent of !empty()
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
equivalent of empty()
safe_bool
conversion
functionN
template<typename F> functionN(const F& g, const Mixin& = Mixin());
g
is a compatible function object.g
is a compatible function object.Mixin
subobject from the given mixin.f
targets a copy of g
if g
is nonempty, or f.empty()
if g
is empty.g
is a reference-to-const
because it is a portable, efficient, and concise way to accept any function object or function pointer. In the case of a function pointer, the type of g
is reference-to-const
pointer-to-function. template<typename F> functionN& operator=(const F& g);
g
is a compatible function object.g
is a compatible function object.f
targets a copy of g
if g
is nonempty, or f.empty()
if g
is empty.*this
.g
is a reference-to-const
because it is a portable, efficient, and concise way to accept any function object or function pointer. In the case of a function pointer, the type of g
is reference-to-const
pointer-to-function.