|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2005-09-16 17:58:06
From: "michael toksvig" <michaeltoksvig_at_[hidden]>
>
> matt, i don't think your code example disambiguates what rob and i are
> disagreeing on
>
> when you say:
> > MyCv c = a + b; // Should fail
>
> you don't say why you think it should fail. there are (at least) 3
> possibilities:
> a) at compile time (because it is an error to try to assign a 0-20 number to
> a 0-10 number)
> b) at runtime, during the assignment (because it is an error to assign a
> 0-20 number to a 0-10 number if it is outside the 0-10 range)
> c) at runtime, during the addition (because it is an error to add two 0-10
> numbers if they add up to more than 10)
>
> i think a) and b) are both useful, and i think rob is advocating c)
Yes, but using a checking policy, you can have all three, though
I'm not sure how to express the difference between a) and c).
"compile_time_check" and "run_time_check" are insufficient. You
might need separate policies to dictate how conversions and
operations are checked.
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk