| Home | Libraries | People | FAQ | More

## Class function_base

boost::function_base — The common base class for all Boost.Function objects. Objects of type function_base may not be created directly.

## Synopsis

    // In header: <boost/function.hpp>

    class function_base {
    public:

      // capacity
      bool empty() const;

      // target access
      template<typename Functor> Functor* target();
      template<typename Functor> const Functor* target() const;
      template<typename Functor> bool contains(const Functor&) const;
      const std::type_info& target_type() const;
    };

## Description

### `function_base` capacity

1.     bool empty() const;

   Returns: | `false` if `this` has a target, and `true` otherwise.
   Throws: | Will not throw.

### `function_base` target access

1.     template<typename Functor> Functor* target();
       template<typename Functor> const Functor* target() const;

   Returns: | If `this` stores a target of type `Functor`, returns the address of the target. Otherwise, returns the NULL pointer.
   Throws: | Will not throw.

2.     template<typename Functor> bool contains(const Functor& f) const;

   Returns: | `true` if `this->target<Functor>()` is non-NULL and `function_equal(*(this->target<Functor>()), f)`

3.     const std::type_info& target_type() const;

   Returns: | `typeid` of the target function object, or `typeid(void)` if `this->empty()`.
   Throws: | Will not throw.