|
Boost Users : |
From: Markus Werle (yg-boost-users_at_[hidden])
Date: 2002-12-05 04:21:50
Hi!
With the help of ConcreteEvoker I was
able to get an (indirect) address for
Test::Apply<double>.
This address is obtained via automatic
template instantiation, so I feel like
there must be a way to achiev the same thing
without ConcreteEvoker.
Any comments?
#include <iostream>
#include "boost/function.hpp"
#include "boost/bind.hpp"
struct Test
{
template <class T> static T Apply(T t1, T t2)
{
return t1 + t2;
}
};
template <class T, class OP> struct ConcreteEvoker
{
static T Apply(T d1, T d2)
{
return OP::Apply(d1, d2);
}
};
int main()
{
boost::function<double (double, double)> test =
&ConcreteEvoker<double, Test>::Apply;
std::cerr << test(1.0, 2.0) << std::endl;
}
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