Boost logo

Boost :

From: Chris Byrne (chris_at_[hidden])
Date: 2003-10-02 00:35:24


On Thu, 02 Oct 2003 00:14:34 -0400
Stefan Seefeld <seefeld_at_[hidden]> wrote:
 
> > GCC 3.2.2:
> > boostthreads.cpp: In function `int main()':
> > boostthreads.cpp:45: request for member `join' in `thrd2(MyThread)', which is of non-aggregate type `boost::thread ()(MyThread)
>
> ...it interprets the above declaration of 'thrd2' as the declaration
> of a function taking a 'MyThread' argument and returning a 'boost::thread'.
>
> No wonder no thread is created !
>
> As you discovered, changing the expression not to use an 'unnamed > temporary' will solve the problem. The other errors you report all
> seem to be of the same kind. Optimization is never the issue, just a
> misunderstanding of the expression.

oh right, but...

if this is a function declaration:
boost::thread thrd2(MyThread(idx))

then why are neither of these?
boost::thread thrd2(MyThread(1))
boost::thread thrd2(MyThread((int)idx))

Futher more, how can an instantiated variable idx actually be used in a function declaration?

- Chris


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