|
Boost : |
Subject: Re: [boost] [Thread] possible bug in Move emulation "portable interface"
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-09-07 09:32:20
Le 07/09/13 10:11, Vicente J. Botet Escriba a écrit :
> Le 07/09/13 10:00, Vicente J. Botet Escriba a écrit :
>> Le 04/09/13 07:53, Gavin Lambert a écrit :
>>> I tried submitting this via Trac but for some reason it was
>>> convinced that my bug report contained spam, while refusing to tell
>>> me what part it was objecting to, and also refusing to give me a
>>> captcha or anything to convince it otherwise.
>>>
>>> Anyways:
>>>
>>> Bug 1: the Boost.Thread documentation and release history indicate
>>> that BOOST_THREAD_VERSION==3 is the default since v1.52. As far as I
>>> can tell this has never been true in any released version; the
>>> latest code still has ==2. (I found a thread in boost-devel that was
>>> debating consequences of making breaking changes by default, which I
>>> assume is why this change was not actually made; but the docs need
>>> correcting.)
>> This was my intention, but this was not possible as the Boost
>> community didn't accept the breaking changes.
>> Please could you point me where in the documentation this
>> misinformation is still there?
>>>
>>> Bug 2: when writing code using the Boost.Thread "Portable Interface"
>>> for move support/emulation, it recommends using the
>>> BOOST_THREAD_DCL_MOVABLE_BEG macro to "avoid conflicts with
>>> Boost.Move". However regardless of C++11 or not or the
>>> BOOST_THREAD_VERSION it defines a template specialisation in a way
>>> that assumes that it is called only from "namespace boost".
>> You are right. The macro must be used inside the boost namesapce.
>>> As this usage is unlikely for any code outside the boost library
>>> itself, I think this is a bug.
>> Well, as the constraint is not on the documentation, I consider it a
>> bug.
>>>
>>> namespace user
>>> {
>>> template<typename T>
>>> class test
>>> {
>>> public:
>>> BOOST_THREAD_COPYABLE_AND_MOVABLE(test)
>>>
>>> test() {}
>>> test(const test&) {}
>>> test& operator=(BOOST_COPY_ASSIGN_REF(test) o) { return *this; }
>>> test(BOOST_THREAD_RV_REF(test) o) {}
>>> test& operator=(BOOST_THREAD_RV_REF(test) o) { return *this; }
>>> };
>>> BOOST_THREAD_DCL_MOVABLE_BEG(T) test<T> BOOST_THREAD_DCL_MOVABLE_END }
>>>
>>> The above code will not compile. It does compile if the DCL define
>>> is moved into a "namespace boost" block, but I do not regard this as
>>> an acceptable solution.
>>>
>>> Suggested fix is to explicitly specify the namespace in the macro,
>>> eg. replace "enable_move_utility_emulation" with
>>> "::boost::enable_move_utility_emulation".
>>>
>>>
>>>
>> Humm, I don't know if this is correct. In any case I didn't know that
>> we could specialize templates this way. Could some one confirm this
>> kind of specializations is portable?
>>
>>
> If I do the change I get the following error:
>
> ../../../boost/thread/lock_types.hpp:500:58: erreur: global
> qualification of class name is invalid before { token
>
>
> I suspect that you would need to make the specialization inside boost
> namespace. I will update the documentation.
>
>
It seems that someone else have found the needed feature useful (see
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3730.html).
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk