Boost logo

Boost Users :

Subject: [Boost-users] [fusion]Is it possible to wrap a function template into a function object?
From: someguy (nkljnuiub_at_[hidden])
Date: 2011-08-10 23:28:24


If there is a function template:
     template<typename T> T f(T t);
then f is not a type and cannot be passed to fusion::for_each() as the
second argument.
But I can't write fusion::for_each(someSequence,&f<SomeType>) either since
elements of someSequence has different types.
While I can write f as a functor fo
     struct fo{ template<typename T> T operator()(T t); };
and call fusion::for_each(someSequence,fo()), sometimes I need to use
function templates in libraries ( say, I have a fusion::vector whose
elements are ranges ) and the only solution seems to be writing a lot of
functors to wrap the function templates. I tried to find a wrapper class
template that can wrap arbitary function templates to functors in boost but
I didn't find any. Then I tried to write such a wrapper using constructs
like
     template&lt;template&lt;typename T0&gt; class F>struct temp_fun_1;
 but the code made my MSVC2008 compiler crash(really!). Is there such a
wrapper in boost or any other library, or is it even possible?

--
View this message in context: http://boost.2283326.n4.nabble.com/fusion-Is-it-possible-to-wrap-a-function-template-into-a-function-object-tp3734880p3734880.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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