
On Thu, 20 Oct 2005 23:09:58 +0200, Robert Kawulak wrote
Hi,
From: Neal Becker <...> I'm more interested in bound specified at runtime. I believe (without proof) that for many applications there will be little performance difference. I say this because I'm expecting in many (most?) cases the actual integral values will be known to the compiler.
Has any thought been given to adding this? Or, perhaps even making this the default bounded_int, (wrapping_int, etc.) type?
Yes, I'm still thinking about this. The difference between static and run-time bounds is that in the latter case a bounded object needs to store the bounds which makes its size at least 3 times bigger. Another one is that with static bounds many checking operations may be optimised-away or at least inlined. Therefore I'd rather not make run-time bounds the default. I'm working on this as an optional feature, but this is a little bit harder than it seems to unite the two concepts.
Catching up with really old email... I'll just say that for my money I *only* care about compile time types. The extra storage Robert cites for an application like date-time is unacceptable. I'll also state that I believe there will be a performance hit as well on construction of the type (probably 3 integer copies instead of 1 in the constructor). I'll try to find some time to look over the latest implementation soon.... Jeff