|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-11-16 09:54:33
"Trent Hill" <trent.hill_at_[hidden]> writes:
> Hi all,
>
> I'm running into a compile error using bind with visual c++ 7.1 and am hoping
> some clever cookie here will be able to help. I've whittled the issue down to
> a few simple functions (you'll have to trust that it makes sense in the original
> context):
>
> template <typename T_Param>
> void foo(T_Param a_param)
> {
> }
>
> template <typename T_Param>
> void callFooWith(T_Param a_param)
> {
> boost::bind(&foo<T_Param>, a_param)(); // <- (1) ERROR HERE
try:
boost::bind(&foo<T_Param>, boost::protect(a_param))(); // <- (1) ERROR HERE
Don't forget to #include <boost/bind/protect.hpp>
> }
>
> void bar(int)
> {
> }
>
> int main(int a_argc, char *a_argv[])
> {
> callFooWith(42); // <- (2) FINE
> callFooWith(boost::bind(&bar, 10)); // <- (3) FAILS
> return 0;
> }
-- Dave Abrahams Boost Consulting http://www.boost-consulting.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