This shows you the differences between two versions of the page.
dss:laboratoare:06 [2019/07/01 15:27] eduard.staniloiu [Exercises] |
dss:laboratoare:06 [2019/07/01 15:29] (current) eduard.staniloiu [Exercises] |
||
---|---|---|---|
Line 254: | Line 254: | ||
struct Checked(T, Hook) | struct Checked(T, Hook) | ||
</code> | </code> | ||
+ | |||
+ | In order to work with built-in types, you need to define: opAssign, opBinary, opBinaryRight, opCast, opCmp, opEquals, opOpAssign, opUnary. | ||
CheckedInt has customizable behavior with the help of a second type parameter, Hook. Depending on the Hook type, core operations on the underlying integral may be verified for overflow or completely redefined. Implement the following predefined hooks: | CheckedInt has customizable behavior with the help of a second type parameter, Hook. Depending on the Hook type, core operations on the underlying integral may be verified for overflow or completely redefined. Implement the following predefined hooks: |