Boost logo

Boost :

Subject: Re: [boost] New dependency report
From: Eric Niebler (eniebler_at_[hidden])
Date: 2014-06-13 12:49:53


On 06/13/2014 09:42 AM, Andrey Semashev wrote:
> On Friday 13 June 2014 09:27:04 Eric Niebler wrote:
>> I am in favor of adding an mpl::tag_of metafunction which retrieves the
>> tag type of the passed mpl entity.
>
> I think, mpl::tag already implements that. See mpl/tag.hpp.
>
>> It can be specialized for
>> std::integral_constant to do the right thing. In addition, it would fix
>> the issues raised here:
>>
>> http://lists.boost.org/Archives/boost/2009/01/147045.php
>>
>> and here:
>>
>> https://svn.boost.org/trac/boost/ticket/7192
>>
>> I think in the C++11 world, boost type_traits should *all* inherit from
>> std::true_type. That's easily accomplished by aliasing mpl::true_ to
>> std::true_type. It fixes everything.
>
> Well, technically that would still be a breaking change, even though a
> relatively safe one. I think if the goal is to add support for
> std::integral_constant to MPL, it can be achieved with a less radical
> solution.

There are a great many goals that this change would address:

* Make the minimum requirements for type traits sensible in C++11 by
using std:: facilities where appropriate

* Breaking the dependency of TypeTraits on MPL.[^1]

* Making boost type traits play nicely with code written for C++11 that
dispatches to std::true_type or std::false_type

* Make the mpl meta-functions work with std::integral_constants

* Make it possible to define mpl Sequence types without reserving a very
generic and common identifier like "tag".

This solution is not radical. It's a matter of grepping the source for
"::tag" and replacing with uses of mpl::tag.

Eric

[^1]: TypeTraits has other mpl dependencies like if_ and friends. Those
would need to be addressed regardless of this change. <sigh>


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