Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more classification/traits #179

Open
gpeterhoff opened this issue May 1, 2023 · 0 comments
Open

more classification/traits #179

gpeterhoff opened this issue May 1, 2023 · 0 comments

Comments

@gpeterhoff
Copy link

For more precise classifications it is still useful to provide these traits:

  • is_character -> char32/char16/char8/wchar/char
  • is_integer -> signed and unsigned int128..8
  • is_unsigned_integer -> is_integer && is_unsigned
  • is_signed_integer -> is_integer && is_signed
  • is_bool -> only bool
  • is_logic -> is_bool || boost::tribool (specialized for tribool in boost::logic)
    I intend to provide a 4-valued logic (https://en.wikipedia.org/wiki/Many-valued_logic#Belnap_logic_(B4)) and a more modern variant of a 3-valued logic (instead of boost::tribool) (and for completeness "normal 2-valued logic"):
  • is_logic -> is_bool4 || is_bool3 || is_bool2 || is_bool
  • is_numeric -> is_floating_point || is_integer
  • is_function_pointer (like is_member_function_pointer) -> is_pointer && is_function<remove_pointer>
  • dependent_false -> "always false" idiom: template <typename... Types> struct dependent_false : public false_type{};
  • is_quotrem_order -> is std::Xdiv_t implemented as {quot, rem} or {rem, quot} ? https://en.cppreference.com/w/cpp/numeric/math/div
    This is needed at https://en.cppreference.com/w/cpp/language/structured_binding
    auto [a, b] = std::div(x, y)
    -> is a quot or rem or is b quot or rem ?
    (PS: maybe you could submit a proposal to the C++ standard committee to set Xdiv_t to a unique order).

exact/specific traits eg

  • is_char32, is_wchar, ...
  • is_uint64, is_int16, ...
  • is_std_longdouble/double/float
  • is_std_float128/64/32/16, is_std_bfloat16
  • is_boost_float128/80/64/32/16
  • is_float64 -> is_std_float64 || is_boost_float64, ...

thx
Gero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant