|
Boost : |
From: Marco Costalba (mcostalba_at_[hidden])
Date: 2007-10-01 13:39:28
And finally (sorry for the noise ;-) I would like to write instead of this
>
> int main()
> {
> typedef boost::tuple<
> int(char)
> , double(int, char)
> , char(std::string)
> , void(std::string, std::string, std::string)
> >
> Signatures;
>
> boost::overload<Signatures> f;
>
> f.set<0>(&foo1);
> f.set<1>(&foo2);
> f.set<2>(&foo3);
> f.set<3>(&foo4);
>
Something like
?? type_of ?? f = get_overload(foo1, foo2, foo3, foo4);
where 'get_overload' is something along the lines of:
template <typename T1, typename T2, typename T3, typename T4> inline
overload<tuple<T1, T2, T3, T4> >
get_overload(T1 const& f1, T2 const& f2, T3 const& f3, T4 const& f4)
{
typedef overload<tuple<T1, T2, T3, T4> > F;
return F(f1, f2, f3, f4); // well, overload c'tor is still to define ;-)
}
So to avoid the user to specify the signatures for each function he
wants to use.
The problem is that I don't know what is the best way to define
variable 'f', (type_of ?). There is a way to avoid user to type the
signatures, given that he already has the functions (fooX) ?
Thanks
Marco
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk