I would like to create floats and integers types that enforce some upper and lower bounds but otherwise behave just like primitive float and integer values.
I thought about making structs with their own overloaded operator=
that enforces the bounds.
But I don't see a solution that doesn't involve making a float
/int
member variable and using that instead of a regular float
/int
.
Is there a way to make objects that can be used just like primitive types?