Boost logo

Boost Users :

From: Ares Lagae (ares.lagae_at_[hidden])
Date: 2007-05-29 11:57:51


consider the following program:

template <typename T>
void function_template(T value)
{
  std::cout << __PRETTY_FUNCTION__ << std::endl;
}

struct function_template_wrapper
{
  template <typename T> static void call(T value)
  {
    function_template<T>(value);
  }
};

int main(int argc, char* argv[])
{
  int i;
  function_template_wrapper::call<int>(i);
}

Is it possible to somehow parameterize the struct function_template_wrapper
such that I can pass function_template as a parameter?

E.g. function_template_wrapper<function_template>::call<int>(i); would call
function_template<int>(i), and
function_template_wrapper<other_function_template>::call<int>(i); would
call other_function_template<int>(i)

Underlying problem: I want to somehow pass a name of a function template to
a class, that will instantiate the function template for a number of types
(known at compile time), and store these instantiations in function
objects, for later use.

Best regards,

-- 
Ares Lagae
Computer Graphics Research Group, Katholieke Universiteit Leuven
http://www.cs.kuleuven.be/~ares/

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