
30 Jul
2006
30 Jul
'06
1:31 p.m.
Michael Nicolella wrote:
Having trouble compiling this code. Only tested in VC8:
Removing 'const' from only the static class function seems to allow it to compile. Below is the error messages...
#include
#include struct A { static void foo( const int ) { } };
void bar( const int ) { }
int main() { boost::bind( &A::foo, _1 ) ; boost::bind( &bar, _1 ) ; }
This is a compiler bug. My advice is to avoid top-level const in signatures. You can still use it in the definition if you insist (although I've never seen its utility): struct A { static void foo( int ); }; int main() { boost::bind( &A::foo, _1 ) ; } void A::foo( const int ) { }