Boost logo

Boost :

Subject: Re: [boost] New dependency report
From: John Maddock (boost.regex_at_[hidden])
Date: 2014-06-06 11:39:13


>>>> May be it would be better to move boost/mpl/bool.hpp,
>>>> boost/mpl/bool_fwd.hpp, boost/mpl/integral_c.hpp, mpl/or.hpp,
>>>> mpl/identity.hpp, mpl/and.hpp into the Core library?
>>>
>>> No, a header called boost/mpl/something.hpp will never be part of Core,
>>> and neither will a component boost::mpl::something. We might duplicate
>>> these as boost/core/something.hpp and boost::core::something, but they
>>> will not be quite the same as their mpl counterparts, and will not
>>> magically make a module that includes a boost/mpl/ header drop its
>>> dependency to MPL.
>>
>> An option is to implement them into boost::core namespace and inject
>> them into boost::mpl namespace in boost/mpl/. Then each library can
>> break mpl dependencies incluing core headers and namespaces instead of
>> mpl ones. But this is not trivial.
>
> From dependencies standpoint, MPL does not add much, see our earlier exchange
> [1]. I think value_init can be moved to Core and changed to depend on
> TypeTraits.Core once it's ready. detail/endian.hpp has been handled already.
>
> Even now, looking at the report [2], the situation is much better than it was
> before, when we discussed it.
>
> MPL decomposition is also pending, but it's probably better to split it into
> two modules MPL and MPL.Core, similar to TypeTraits. For many cases dependency
> on MPL.Core would be enough.

I'm tied of saying this.... but if mpl::bool_ and int_ were moved out of
MPL full, either to core, or to some mpl_core, then there's no need to
split type_traits anymore.

Indeed I suspect there's a huge amount of obfuscated code inherited from
mpl's broken-compiler-workarounds that can now be removed: not only do
we not support those compilers any more, but given that they haven't
been tested in heaven knows how long they're unlikely to compile *any*
of modern Boost anyway.

In fact in C++11 it makes sense to me have:

namespace boost{ namespace mpl{

template <bool b>
using bool_ = std::integral_constant<bool, b>;
template <int i>
using int_ = std::integral_constant<int, i>;

}

// replaces boost::integral_constant:
using std::integral_constant;

}

Now any function or template that's overloaded/specialized on mpl::bool_
or int_ will also "just work" with std:: type_traits as well as boost ones.

John.


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