Help with deduced template parameters

Forgive me if the answer ends up being strictly C++, rather than
Boost. But, I have a template class that I would rather be able to
deduce it's single [current] template parameter rather than having to
specify it. I'm wondering if boost::function or boost::functional might
make this easier for me to accomplish.
My functor class is passed to a method similar to std::for_each, and
that template functor class is:
/*! Detach all members of the EntityList via stop_messaging.
* \todo I suspect there's a way to make this not require template
* arguments at instantiation, but at the moment it's being used
* as:
* mutexed_for_each(detach_all

Chris Ross escreveu:
Normally in those cases you could create a function to determine the template parameters and pass it to the class. The function then returns a class object correctly instantiated, for instance: (say you renamed your class to detached_all_t) template <class List> detach_all_t<List> detach_all(const List &e) { return detach_all_t<List>(e); } That should do the trick, you can use detach_all without specifying the template parameter. Regards, rod

Chris Ross:
...
struct detach_all
{
typedef void result_type;
template
participants (3)
-
Chris Ross
-
Peter Dimov
-
Rodolfo Lima