2.2.9. Function.h

The template class Function is used throughout the library to represent functors.

2.2.9.1. Class template<typename R, typename ...Args> Function<R(Args...)>

template<typename R, typename ...Args>
class Function<R(Args...)>

Abstract base class template for fuctors used in the library.

2.2.9.1.1. Synopsis

template<typename Sig>
struct Function {
};
template<typename R, typename ...Args>
struct Function<R(Args...)> {
    virtual ~Function() { };
    virtual std::shared_ptr<Function<R(Args...)> > clone() const = 0;
    virtual void print(std::ostream &s) const = 0;
    virtual R operator()(Args ...args) const = 0;
};

2.2.9.1.2. Details

virtual std::shared_ptr<Function<R(Args...)>> clone() const = 0

Cloning function used when a copy of a given functor is needed.

virtual void print(std::ostream &s) const = 0

Printing function used for describing the function in output from algorithms.

virtual R operator()(Args... args) const = 0

The actual function implementation of the function.