3 ms·
At the risk of getting nerd-sniped hard and opening VS up and actually playing around with it, isn't this what type traits and static asserts are for? It shoul
by krapp 5y ago
At the risk of getting nerd-sniped hard and opening VS up and actually playing around with it, isn't this what type traits and static asserts are for?
It should be possible to template a class that only accepts positive integers.
- clappski 5y agoIt’s only possible to do that if your positive integers are passed via template parameters. All your type traits/SFAINE/concepts/static_asserts happen at compile time, you can’t use them to do any checks on the value of a type, unless it’s a value available at compile time.