4 ms·
Consider dropping the specializations for the type traits, given that it's undefined behavior: https://en.cppreference.com/w/cpp/types/is_fundamental https://e
by listeria 2y ago
Consider dropping the specializations for the type traits, given that it's undefined behavior:
https://en.cppreference.com/w/cpp/types/is_fundamental https://en.cppreference.com/w/cpp/types/is_fundamental
https://en.cppreference.com/w/cpp/types/is_floating_point https://en.cppreference.com/w/cpp/types/is_floating_point
https://en.cppreference.com/w/cpp/types/is_arithmetic https://en.cppreference.com/w/cpp/types/is_arithmetic
https://en.cppreference.com/w/cpp/types/is_scalar https://en.cppreference.com/w/cpp/types/is_scalar
https://en.cppreference.com/w/cpp/types/is_object https://en.cppreference.com/w/cpp/types/is_object
- seg_fault 2y agoI don't get what you mean. I thought they specify how the type can be used?
- secondcoming 2y agoTechnically, you're not supposed to add your own specialisations to the `std` namespace
- pmalynin 2y agoIn general this isn’t true (i guess it is in this specific context). For example I believe it’s totally expected to specialize std hash
- badmintonbaseba 2y agoThe cppreference page says: > If the program adds specializations for std::is_fundamental or std::is_fundamental_v, the behavior is undefined. This is an oversimplification. The actual rule is https://eel.is/c++draft/library#namespace.std-2 https://eel.is/c++draft/library#namespace.std-2 . > the specialization meets the standard library requirements for the original template. For is_fundamental<YourClassType> it means that is_fundamental<YourClassType>::value must be false, as YourClassType is not a fundamental type, as defined in https://eel.is/c++draft/basic.fundamental#17 https://eel.is/c++draft/basic.fundamental#17 . Some traits are just not designed to be customization points.
- dataflow 2y agoWhy is std::is_object even specialized here? Isn't it always true regardless?