#include <iostream>
#include <functional>
 
template <typename UnaryFunction>
class ApplyValues
{
    typedef std::function<UnaryFunction> Performer;
    Performer performer;    
public: 
    typedef typename Performer::argument_type argument_type;
 
    ApplyValues( Performer p ) : performer( p ) { }
 
    void apply( argument_type low, argument_type up ) {
        performer( low ); performer( up );
    }
};
 
void print(double value) {
   std::cout << value << std::endl;
}
 
struct print2 {
   void operator()(double value) {
      std::cout << 2 * value << std::endl;
   }
};
 
int main() {
    using namespace std;
 
    ApplyValues<void(double)> a(print);
    a.apply( 1, 99 );
    cout << "---" << endl;
    ApplyValues<void(double)> b( (print2()) );
    b.apply( 2, 99 );
}