Boost logo

Boost :

Subject: Re: [boost] Boost.Fiber review January 6-15
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-01-22 14:30:38


Le 22/01/14 20:16, Oliver Kowalke a écrit :
> 2014/1/22 Vicente J. Botet Escriba <vicente.botet_at_[hidden]>
>
>> So when discussing the requested variadic fiber constructor, I will
>>> tease apart the C++11 and C++03 cases. I feel pretty comfortable
>>> stating that the former is much more important than the latter.
>>>
>> Agreed, but at least the C++03 must support movables types.
>>
> does boost::thread support moveable types? if I look at the source code
> (C++03 equivalent to
> variadic arguments):
>
> template <class F,class A1,class A2>
> thread(F f,A1 a1,A2 a2):
> thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2));
>
> The arguments are captured by boost::bind() which (as far as I know) does
> not support
> moveable types as arguments (in the example a1 and a2) - or do I miss
> something?
>
Right. Boost.Thread provides only a variadic version for copyables and
doesn't support movable types in C++03 for the variadic version, but
provides a constructor from a callable movable or copyable.

         template <class F>
         explicit thread(F f
         , typename disable_if_c<
boost::thread_detail::is_convertible<F&,BOOST_THREAD_RV_REF(F)>::value
            , dummy* >::type=0
         );
         template <class F>
         explicit thread(BOOST_THREAD_RV_REF(F) f
         , typename disable_if<is_same<typename decay<F>::type, thread>,
dummy* >::type=0
         );

As I said, implementing perfect forwarding is not possible in C++03 (See
Boost.Move documentation).

Best,
Vicente


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