John Maddock wrote:
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.
The question is: what is the minimal conforming implementation of a type trait? Is it template<class T> struct something { bool const value = false; } or is it, instead, template<class T> struct something: mpl::false_ { }; For C++11, the answer to this question determines whether the std type traits are conforming type traits for us. In other words, whether "using std::is_pointer;" is a conforming implementation of boost::is_pointer. For C++03, the answer determines whether I can specialize a type trait for my type without including the header that defines mpl::true_ and mpl::false_. I prefer the first definition for reasons already stated. This doesn't mean however that going with the second, along with a lean and mean mpl::bool_, will not going to be a considerable improvement as well. Far from it.
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.
That's certainly true. If we remove the obsolete workarounds from MPL and TypeTraits things will start looking much better.
In fact in C++11 it makes sense to me have:
namespace boost{ namespace mpl{
template <bool b> using bool_ = std::integral_constant
;
Interesting. This makes the std type traits conform to my second definition above, so that "using std::is_member_pointer;" (say) is a legitimate implementation of boost::is_member_pointer even when derivation from mpl::bool_ is required. I'm not sure that this is a conforming mpl::bool_ though. It almost is. But mpl integral constants need to have a nested ::tag (integral_c_tag), and std::integral_constant doesn't have one. Maybe this requirement can be dropped. Maybe it can't. I don't know.