Boost logo

Boost :

Subject: Re: [boost] Boost.Future & review of C++0x accepted librariesimplementations
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-11-21 01:35:33


----- Original Message -----
From: <k-oli_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, November 21, 2008 6:05 AM
Subject: Re: [boost] Boost.Future & review of C++0x accepted librariesimplementations

>
> Am Donnerstag, 20. November 2008 22:28:21 schrieb Anthony Williams:
>> k-oli_at_[hidden] writes:
>> > Am Donnerstag, 20. November 2008 18:19:12 schrieb Anthony Williams:
>> >> k-oli_at_[hidden] writes:
>> >> The latest C++0x working draft (which includes those papers, and which
>> >> is the "feature complete" committee draft out for voting at the
>> >> moment) is at:
>> >
>> > How has the jss::packaged_task to be used with boost::thread?
>> >
>> > X x;
>> > jss::packaged_task< std::string > tsk( boost::bind( & X::execute, x) );
>> > jss::shared_future< std::string > f( tsk.get_future() );
>> > boost::thread t(
>> > boost::bind(
>> > & jss::packaged_task< std::string >::operator(),
>> > tsk) );
>> > t.join();
>> > std::cout << f.get() << std::endl;
>> >
>> > Does not compile because packaged_task is noncopyable.
>> > In the C++0x working draft std::move( tsk) was used - but how to do it
>> > with the current boost release?
>>
>> boost::thread t(boost::move(tsk));
>
>
> Doesn't compile (gcc-4.3):
>
> conversion from 'jss::packaged_task<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > >' to non-scalar
> type 'boost::detail::thread_move_t<boost::thread>' requested
>
> Any ideas?

Try to decompose the probleme

detail::thread_move_t< jss::packaged_task< std::string > > mtsk(tsk)
boost::thread t(mtsk);

and see what is wrong.

HTH,

Vicente


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