pre-boost Home Libraries People FAQ More

PrevUpHomeNext

Rationale

1. Why does a binary operation on two safe<int> values not necessarily return another safe type ?
2. Why is there no policy driven design for handling overflows
3. Why is Boost.Convert not used.

1.

Why does a binary operation on two safe<int> values not necessarily return another safe type ?

There are a number of

  • it was hard to implement.

  • it doesn't really seem necessary. We always do SOMETHING with result of the operation. This will result in an assignment or a conversion to some other type where the result will be validated.

2.

Why is there no policy driven design for handling overflows

The question was - to which type does one apply it to? Consider the following example:

safe<int, overflow_policy_1> t1 = 2;
safe<int, overflow_policy_2> t2 = 4;
unsigned int x = t1 - t2; // which policy should be invoked?

3.

Why is Boost.Convert not used.

I couldn't figure out how to use it from the documentation.


PrevUpHomeNext