Boost logo

Geometry :

Subject: Re: [geometry] Why reverse_dispatch returns bool rather than mpl::bool_<T> ?
From: Barend Gehrels (barend_at_[hidden])
Date: 2014-05-20 16:05:54


Hi,

Menelaos Karavelas wrote On 20-5-2014 18:35:
> Hi Samuel.
>
> On 20/05/2014 05:43 μμ, Samuel Debionne wrote:
>>> reverse_dispatch<> is derived from integral_constant<bool, ...> so
>>> AFAIU
>>> it can be passed directly to the mpl metafunction. Or am I wrong about
>>> this?
>> Thanks Adam, I was just about to answer my question with an other (more
>> accurate) question :
>>
>> Why is the template parameter Reverse of say dispatch::distance of
>> non-type bool rather than mpl::bool_ ?
>>
>> template
>> <
>> ...
>> *bool* Reverse = reverse_dispatch<Geometry1,
>> Geometry2>::type::value
>
> Although I was not part of the design team of this, I would argue that
> it is like that because it works.

That is one reason indeed.
The other is that specifying bool as a template parameter prohibits
wrong usage, you can not enter any struct there. If you specify an mpl
bool, which is a struct, you can use it with any struct but will get
(other) compiler errors, or it will not be specialized correctly.

Having said that, main reason was that it works fine. But if there is a
good reason to change it, we can consider that.

Regards, Barend


Geometry list run by mateusz at loskot.net