Boost logo

Boost Users :

Subject: Re: [Boost-users] [lamda] smart self binding of a function object
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-05-11 10:10:02


AMDG

alfC wrote:
> since I have access to f I would like to make f smart enough to handle
> its own binding. Eg.
>
> class f{
> ... // same as before
> function<double(double)> operator()(double x_value, YYYY y_arg){
> return bind(
> &f::operator(), //maybe needs cast to double(*)
> (double,double)
> *this,
> x_value,
> y_arg
> );
> }
> function<double(double)> operator()(XXXX x_arg, double y_value){
> return bind(
> &f::operator(), //maybe needs cast
> *this,
> x_arg,
> y_value
> );
> }
> };
>
> The question is: What should be the type of XXXX and YYYY?
>

You'll have to make operator() a template:

template<class T>
function<double(double)> operator()(const T& x_arg, double y_arg);

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net