
Thorsten Ottosen wrote:
Mika Heiskanen skrev:
Mathias Gaunard wrote:
Mika Heiskanen wrote:
If the value must be checked beforehand, why bother using a constrained type at all?
Because it performs checking in debug mode to make sure the invariant is indeed true.
I do not believe boost should accept a library which would only work in debug mode.
How different users want to respond to errors should not be mandated by the library. Therefore it is very good that this library allows you to customize it.
There is a difference between protecting against accidental misuse and deliberate misuse of a component. Why can rarely protect against the latter.
Having invariants checked only in debug mode is very common, FWIW.
I did not express my thoughts very well the last time. Retry: I am not against having invariants checked only in debug mode, if the user so chooses. I am however against it being the default mode. I believe the most sensible default would be to throw an exception both in debug and release modes, since I believe this to be the most common use case. --> Mika Heiskanen