Boost logo

Boost :

Subject: Re: [boost] New dependency report
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2014-06-08 17:53:41


El 08/06/2014 8:23, Vicente J. Botet Escriba escribió:

> Which library needs bool_ in Core?
>
> IMO, what we need is integral_constant in Core and import it to Boost.
>
> //boost/core/intergral_constant.hpp
> namespace boost {
> namespace core {
> template <..> struct integral_constant {... };
> }
> }
>
> //boost/type_traits/intergral_constant.hpp
> namespace boost {
> using core::integral_constant;
> }
>
> Note that the current implementation of integral_constant using
> mpl::integral_c is not documented, so the changes are backward
> compatible (Of course, the user or Boost code that is using the
> implementation detail would be broken).
>
> This doesn't needs a change in MPL at all.

I think you are pointing to the right solution. I'm strongly against
using MPL::bool_ as a basic building block for traits. If possible we
should have a boost::core::integral_type and
boost::core::true_type/false_type. I would even define them directly
into the boost namespace in Core. TypeTraits and MPL should depend on
the core integral_constant.

MPL integral_c has additional features so it could derive from core
integral_constant and add the needed features. Ideally, TypeTraits
should not depend on MPL, but this could break a lot of code, so we need
to maintain interoperability without adding an explicit dependency.

So to refine Vicente's idea, how about defining boost::integral_constant
boost::true_type / boost::false_type in core, with mpl's requirements:

http://www.boost.org/doc/libs/1_55_0/libs/mpl/doc/refmanual/integral-constant.html

then inject it into MPL and type_traits namespaces in each library.

This way, when defining our own trait, we only depend on Core but we are
still interoperable with MPL/TypeTraits. TypeTraits would not be MPL
dependant. MPL could depend on TypeTraits and Core.

Best,

Ion


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