2 ms·
Does this really define a new range-checked type? I never used in_range, but it seems a function [1] that you must call whenever you want to do the check on one
by ziotom78 3y ago
Does this really define a new range-checked type? I never used in_range, but it seems a function [1] that you must call whenever you want to do the check on one variable, while in Pascal all the checks are injected automatically every time you modify a variable of that type.
[1] https://en.cppreference.com/w/cpp/utility/in_range https://en.cppreference.com/w/cpp/utility/in_range
- Rexxar 3y agoIf I understand correctly the other comments, they just say it's possible to do in c++ with templates/operator overloading/constexpr. It's not an existing type of the standard library. This type could work in simple situations but will probably not be as good as a native type in more complex situations.