A quick primer on type traits in modern C++
internalpointers.com
A quick primer on type traits in modern C++
1–10 of 38 posts
Re: A quick primer on type traits in modern C++
#2Re: A quick primer on type traits in modern C++
#3Re: A quick primer on type traits in modern C++
#4algorithm_signed() and algorithm_unsigned() in the conditional compilation example need to be templated functions for the example to make (more) sense.
Re: A quick primer on type traits in modern C++
#5algorithm_signed() and algorithm_unsigned() in the conditional compilation example need to be templated functions for the example to make (more) sense.
Is algorithm being templated not enough?
Re: A quick primer on type traits in modern C++
#6Re: A quick primer on type traits in modern C++
#7Earlier quoted context omitted.
Is algorithm being templated not enough?
Two points. 1) Currently, the code could be written with normal overloading (one for int and one for unsigned). No traits required. 2) The current code relies on an implicit cast to int or unsigned int. I’m not sure that’s good.
f( (uint8_t)0 ) will dispatch to the overload f(int) with overloads. The type-trait code will dispatch to f_unsigned(unsigned).