Le 13/06/14 20:27, Peter Dimov a écrit :
Eric Niebler wrote:
Eric Niebler wrote:
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.
I can't help but note that you're focusing on the wrong aspect of
On 06/13/2014 10:48 AM, Peter Dimov wrote: the > problem. In the C++11 world, we have type traits in std and none of this > matters. Use of Boost type traits is motivated by the need to support > C++03.
I'm focusing on a larger set of problems. And use use of mpl isn't restricted to C++03 code. Nor is boost.type_traits for that matter; it's used in code that must be portable, like boost libraries.
That's exactly what I said. Boost type traits are used in code that needs to compile under C++03.
I agree with you that ::tag as a requirement for the integral constant concept is a terrible idea. I do not agree with your C++11-based arguments, neither do I agree that type traits should inherit from std::true_type. Type traits should NOT inherit from anything.
The only requirement for a type trait (or a metaprogramming predicate, in general) should be to have a ::value with a value of 0 or 1. Nothing more. No ::tags. No required base classes. No mandatory dependencies of any kind. What should be and what it is a quite different concern. The current documentation says that a boolean type traits inherits from boost::true_type or boost::false_type.
If you want to dispatch, type traits with a ::value == 0 should be _convertible_ to false_type, and type traits with a ::value == 1 should be convertible to true_type, but they should not be required to derive from them. This convertibility can be achieved from the true_type/false_type side. I don't see how.
The base classes in the standard are a mistake. The base classes in Boost are a mistake.
You are surely right, but the status is that these traits inherits. I think that the issue is not a major one and that compatibility between the Boost type traits and the standard ones is more important. Just my 2 cts, Vicente