Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Reference

Definitions
Header <boost/function.hpp>
Header <boost/function_equal.hpp>

Definitions

  • 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> 
    class functionN;
  template<typename T1, typename T2, ..., typename TN> 
    void swap(functionN<T1, T2, ..., TN>&, functionN<T1, T2, ..., TN>&);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator==(const functionN<T1, T2, ..., TN>&, Functor);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator==(Functor, const functionN<T1, T2, ..., TN>&);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator==(const functionN<T1, T2, ..., TN>&, 
                    reference_wrapper<Functor>);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator==(reference_wrapper<Functor>, 
                    const functionN<T1, T2, ..., TN>&);
  template<typename T1, typename T2, ..., typename TN, typename U1, 
           typename U2, ..., typename UN> 
    void operator==(const functionN<T1, T2, ..., TN>&, 
                    const functionN<U1, U2, ..., UN>&);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator!=(const functionN<T1, T2, ..., TN>&, Functor);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator!=(Functor, const functionN<T1, T2, ..., TN>&);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator!=(const functionN<T1, T2, ..., TN>&, 
                    reference_wrapper<Functor>);
  template<typename T1, typename T2, ..., typename TN, typename Functor> 
    bool operator!=(reference_wrapper<Functor>, 
                    const functionN<T1, T2, ..., TN>&);
  template<typename T1, typename T2, ..., typename TN, typename U1, 
           typename U2, ..., typename UN> 
    void operator!=(const functionN<T1, T2, ..., TN>&, 
                    const functionN<U1, U2, ..., UN>&);
  template<typename Signature> class function;
  template<typename Signature> 
    void swap(function<Signature>&, function<Signature>&);
  template<typename Signature, typename Functor> 
    bool operator==(const function<Signature>&, Functor);
  template<typename Signature, typename Functor> 
    bool operator==(Functor, const function<Signature>&);
  template<typename Signature, typename Functor> 
    bool operator==(const function<Signature>&, reference_wrapper<Functor>);
  template<typename Signature, typename Functor> 
    bool operator==(reference_wrapper<Functor>, const function<Signature>&);
  template<typename Signature1, typename Signature2> 
    void operator==(const function<Signature1>&, const function<Signature2>&);
  template<typename Signature, typename Functor> 
    bool operator!=(const function<Signature>&, Functor);
  template<typename Signature, typename Functor> 
    bool operator!=(Functor, const function<Signature>&);
  template<typename Signature, typename Functor> 
    bool operator!=(const function<Signature>&, reference_wrapper<Functor>);
  template<typename Signature, typename Functor> 
    bool operator!=(reference_wrapper<Functor>, const function<Signature>&);
  template<typename Signature1, typename Signature2> 
    void operator!=(const function<Signature1>&, const function<Signature2>&);
}
namespace boost {
  template<typename F, typename G> bool function_equal(const F&, const G&);
}

PrevUpHomeNext