Home | Libraries | People | FAQ | More |
A function object 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:
template<typename P> R operator()(cv-quals P& x, Arg1 arg1, Arg2 arg2, ..., ArgN argN) const { return (*x).*mf(arg1, arg2, ..., argN); }
A function object f of type F is stateless if it is a function pointer or if boost::is_stateless<T> is true. The construction of or copy to a Boost.Function object from a stateless function object will not cause exceptions to be thrown and will not allocate any storage.
namespace boost { class bad_function_call; class function_base; template<typename R, typename T1, typename T2, ..., typename TN, typename Allocator = std::allocator<void> > class functionN; template<typename T1, typename T2, ..., typename TN, typename Allocator> void swap(functionN<T1, T2, ..., TN, Allocator>&, functionN<T1, T2, ..., TN, Allocator>&); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator==(const functionN<T1, T2, ..., TN, Allocator>&, Functor); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator==(Functor, const functionN<T1, T2, ..., TN, Allocator>&); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator==(const functionN<T1, T2, ..., TN, Allocator>&, reference_wrapper<Functor>); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator==(reference_wrapper<Functor>, const functionN<T1, T2, ..., TN, Allocator>&); template<typename T1, typename T2, ..., typename TN, typename Allocator1, typename U1, typename U2, ..., typename UN, typename Allocator2> void operator==(const functionN<T1, T2, ..., TN, Allocator1>&, const functionN<U1, U2, ..., UN, Allocator2>&); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator!=(const functionN<T1, T2, ..., TN, Allocator>&, Functor); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator!=(Functor, const functionN<T1, T2, ..., TN, Allocator>&); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator!=(const functionN<T1, T2, ..., TN, Allocator>&, reference_wrapper<Functor>); template<typename T1, typename T2, ..., typename TN, typename Allocator, typename Functor> bool operator!=(reference_wrapper<Functor>, const functionN<T1, T2, ..., TN, Allocator>&); template<typename T1, typename T2, ..., typename TN, typename Allocator1, typename U1, typename U2, ..., typename UN, typename Allocator2> void operator!=(const functionN<T1, T2, ..., TN, Allocator1>&, const functionN<U1, U2, ..., UN, Allocator2>&); template<typename Signature, typename Allocator = std::allocator<void> > class function; template<typename Signature, typename Allocator> void swap(function<Signature, Allocator>&, function<Signature, Allocator>&); template<typename Signature, typename Allocator, typename Functor> bool operator==(const function<Signature, Allocator>&, Functor); template<typename Signature, typename Allocator, typename Functor> bool operator==(Functor, const function<Signature, Allocator>&); template<typename Signature, typename Allocator, typename Functor> bool operator==(const function<Signature, Allocator>&, reference_wrapper<Functor>); template<typename Signature, typename Allocator, typename Functor> bool operator==(reference_wrapper<Functor>, const function<Signature, Allocator>&); template<typename Signature1, typename Allocator1, typename Signature2, typename Allocator2> void operator==(const function<Signature1, Allocator1>&, const function<Signature2, Allocator2>&); template<typename Signature, typename Allocator, typename Functor> bool operator!=(const function<Signature, Allocator>&, Functor); template<typename Signature, typename Allocator, typename Functor> bool operator!=(Functor, const function<Signature, Allocator>&); template<typename Signature, typename Allocator, typename Functor> bool operator!=(const function<Signature, Allocator>&, reference_wrapper<Functor>); template<typename Signature, typename Allocator, typename Functor> bool operator!=(reference_wrapper<Functor>, const function<Signature, Allocator>&); template<typename Signature1, typename Allocator1, typename Signature2, typename Allocator2> void operator!=(const function<Signature1, Allocator1>&, const function<Signature2, Allocator2>&); }
namespace boost { template<typename F, typename G> bool function_equal(const F&, const G&); }
Copyright © 2001-2004 Douglas Gregor |