|
Boost Users : |
From: Paul Elliott (pelliott_at_[hidden])
Date: 2004-11-24 23:06:10
This may be an general C++ question but:
I want to take the address of a member function
that happens to be an operator() operator, which is
defined with member templates in apply.hpp:
--------------quote----
namespace boost
{
template<class R> struct apply
{
typedef R result_type;
template<class F> result_type operator()(F & f) const
{
return f();
}
template<class F, class A1> result_type operator()(F & f, A1 & a1) const
{
return f(a1);
}
-------end quote.
I want to take the address of operator() for <int,int>
which is defined by the member template above.
----Quote---
// want to work with functions of the form int f(int);
typedef int P(int);
boost::function<int (P)> f =
// boost::bind(boost::apply<int>(),_1,5);
// above works but instead try below!
boost::bind(&boost::apply<int>::operator()<int,int>,5);
// above line produces error.
----end quote
I get error message:
exabind.cpp:23: error: no matching function for call to `bind(<unknown type>, boost::apply<int>, int)'
How do I specify a pointer to the member operator() method
defined with member template parameters <int,int> ?
I must be doing something wrong. My brain hurts.
-- Paul Elliott 1(512)837-1096 pelliott_at_[hidden] PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117
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