|
Boost Users : |
From: Seweryn Habdank-Wojewódzki (habdank_at_[hidden])
Date: 2007-03-26 16:28:03
Hi!
Douglas Gregor wrote:
>> Thanks for reply. However still I do not know how to proceed in that
>> case, because functions can not be partially specialized. Is there any
>> opportunity to prepare more less such a function which will automatically
>> detects arguments of boost::function template?
>
> You can write multiple overloads of your "test" function, each of which
> accepts boost::function instances with a different number of function
> arguments:
>
> template<typename R>
> void test (boost::function<T(void)>& f);
>
> template<typename R, typename T1>
> void test (boost::function<T(T1)>& f);
>
> template<typename R, typename T1, typename T2>
> void test (boost::function<T(T1, T2)>& f);
>
> template<typename R, typename T1, typename T2, typename T3>
> void test (boost::function<T(T1, T2, T3)>& f);
>
> Tedious, unfortunately, but it works.
Ok. It is long, but good enough.
Thanks and kind regards.
-- |\/\/| Seweryn Habdank-Wojewódzki \/\/
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