MikeLankamp / fpm

C++ header-only fixed-point math library
https://mikelankamp.github.io/fpm
MIT License
673 stars 85 forks source link

Unary type trait `fpm::is_fixed` #68

Closed AbitTheGray closed 1 month ago

AbitTheGray commented 1 month ago

I could not find any "unary type trait", similar to std::is_integral for fpm::fixed<> so I wrote it. There may be more that would be good to implement but this was just the one I needed. fpm::is_fixed_v is behind #ifdef as it requires C++17

I hope this is the correct approach and naming (matches std better than fpm::is_fixed_number). I've placed it at the end of fixed.hpp as I did not want to mess any of your formatting or layout.

I recommend checking <type_traits> as there may be some official one you may want to implement (I don't have enough experience in those but std::is_arithmetic seems like one of those).