Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-10-11 05:08:18


Johan Torp:

> The following code compiles fine in MSVC 8.0 and gcc 3.4.4 but MSVC 7.1
> renders the errors found below.
>
> struct X {
> template<class T> void bar() {}
> };
>
> void foo() {
> X x;
> boost::bind(&X::bar<int>, x);
> }
>
> I'm using boost 1.34.0. Is this a known problem of MSVC 7x?

Function templates have been known to confuse earlier versions of MSVC. I
don't think that this specific problem has been known, but now it is. :-)
The usual workaround is to help the compiler by using

    void (X::*pmf) () = &X::bar<int>;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk