boost::bind question / bug(?)
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
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 ) { }
At 07:31 2006-07-30, Peter Dimov wrote:
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):
It tells the compiler that your code won't change the variable. and the compiler obligingly gives you an error if you accidently try. One presumes that it could also enable some optimizations if the compiler _knows_ the value can't be changed.
struct A { static void foo( int ); };
int main() { boost::bind( &A::foo, _1 ) ; }
void A::foo( const int ) { }
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"
participants (3)
-
Michael Nicolella
-
Peter Dimov
-
Victor A. Wagner Jr.