Boost logo

Boost Users :

Subject: [Boost-users] [mpl - function_types] Generate typedef from operator() of a functor
From: Olivier Tournaire (olitour_at_[hidden])
Date: 2010-01-30 09:47:10


Hi all,

Given an mpl sequence of types such as: typedef mpl::vector<T0, T1, T2, T3>
arg_types;

1) the users of my library provide functors such as F (where T0 and T1 may
have been any of the types of arg_types:

class F {
 typedef mpl::pair<T0,T1> signature_type;
 double operator()(const T0& t0, T1& t1);
};
is there a way to generate signature_type automatically ?

2) if the operator() is overloaded, the user class currently has to typedef
an mpl::vector of mpl::pairs such as

class G {
 typedef mpl::vector<mpl::pair<T2,T3>, mpl::pair<T1,T1>, mpl::pair<T3,T1> >
signature_type;
 double operator()(const T2& t2, T3& t3);
 double operator()(const T1& t1, T1& t1);
 double operator()(const T3& t3, T1& t1);
};

in this case, is it also possible to generate signature_type automatically ?

Regrads,

Olivier



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