$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-30 09:31:39
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 <boost/bind.hpp>
> #include <boost/function.hpp>
>
> 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 )
{
}