Boost logo

Boost Users :

From: Pablo Aguilar (pablo.aguilar_at_[hidden])
Date: 2005-08-29 19:05:41


"BRIDGES Dick" <Dick.Bridges_at_[hidden]> wrote in message
news:2714C5D60037C64E92E047B1903F3C9CA7E0E1_at_taus-ies1.dom1.taus.us.thales...
> After I figured out I had to use boost::ref(f) with my real
> class, the second form worked fine. I had a problem with the
> first form though.
> <code>
> boost::thread doit( boost::bind(Foo::operator(),&f)() );
> </code>
> Yielded the following [edited to fit] result:
> <result>
> g++ -D_REENTRANT -I/usr/local -I/usr/local/boost_1_33_0
> -I/usr/local/include
> -O0 -g3 -Wall -c -fmessage-length=0 -Wno-non-virtual-dtor -omain.o
> ../main.cpp
> ../main.cpp: In function `int main(int, char**)':
> ../main.cpp:22: error: invalid use of non-static member function
> `void my_namespace::Foo::operator()()'
[snipped a lot]
> Regards,
> Dick Bridges

You need to write &Foo::operator() [note the address-of operator], to mean a
member function pointer, while Foo::operator() means trying to call
operator() as if it were a static method of the Foo class.

HTH

Pablo


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