
Boost Users : 
From: Gero Peterhoff (g.peterhoff_at_[hidden])
Date: 20201004 21:09:24
Hello John,
you have probably already read that I think some new TypeTraits are useful. Here are the details:
a) very useful: precise type classification  this is the basis of every abstraction and should definitely be implemented
 is_character: contains only characters (char32/16/8_t, wchar_t, char); is_un/signed_character
 is_integer: contains only integers and no characters and no bool (u/int8..X_t); is_un/signed_integer
 is_logic: contains only logical types (bool and boost::tribool, *))
 is_string: contains everything that can be used as a string, but needs these specializations:
1) is_bounded_string (similar to is_bounded_array)
2) is_unbounded_string (similar to is_unbounded_array)
3) is_static_string (for boost::basic_static_string)
4) is_string_ref (for boost::basic_string ref)
5) is_string_view (for std::basic_string_view)
6) is_string_class (for std::basic_string)
 character_of: the underlying character type based on is_string
b) very useful
 remove_cv_ptr (similar to remove_cv_ref)
 make_same_signed (similar to make_un/signed): changes the sign depending on a type
 conditional_signed: changes the sign depending on a truth value
 is_same_signed: same sign
c) also makes sense
 is_tuple
 is_rational (similar to boost::is_complex)
 is_binary: if base==2 (numeric_limits::radix==2)
 is_decimal: if base==10 (numeric_limits::radix==10)
d)
 is_native: a type is natively available on the platform (e.g. int64_t: Linux32:false, Linux64:true; float80_t: x86:true, else:false)
 is_vectorisable: a type can be vectorized natively on the platform  there are basic SSE/AVX/SVE/... functions
However, I have a problem: boost/std::is_integral contain bool. Perhaps you can do that like this, but it leads to problems with is_arithmetic, since is_arithmetic is based on is_integral and thus contains bool. I think the point of is_arithmetic is to be able to calculate numerically with the type  so the scenarios are not useful: abs(bool), sin/cos/...(bool), etc. The same applies to characters.
There are two possible solutions:
 redefine is_arithmetic > is_integer  is_floating_point
 a new TypeTrait is_numeric (e.g.) > is_integer  is_floating_point
There are some differences between boost and stdTypeTraits. Can you please include that in the documentation?
Furthermore there seem to be errors with char8_t, e.g. boost::is_unsigned<char8_t> > false, std::is_unsigned<char8_t> > true (correct).
Summary
With these measures, a large number of template functions/classes can then be tailored precisely to the application and incorrect use can be prevented.
regards
Gero
*) I've written a couple of classes for logic: bool3_t (a modern variant of boost::tribool), bool4_t (http://www.filosofia.unimi.it/dagostino/wpcontent/uploads/2017/05/Belnap.pdf) and bool2_t (for completeness)
Boostusers list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net