|
I disagree for two reasons: 1. enforce() generates so much code that it's likely that very few compilers would inline it, and then also inline the function calling it. 2. Even if enforce() does get inlined and the checks become cheaper, IMHO ranges need to be a lightweight enough abstraction that there's zero overhead in release mode, kind of like arrays (which are themselves ranges). A major goal of ranges is that they are supposed to be an extremely lightweight abstraction that can be used even in the most performance-critical code. I generally agree with the view that input to a public API should be checked come Hell or high water, but I think exceptions can be made for things that are intended to be very efficient, lightweight abstractions. Builtin arrays are one of these. Ranges should be another. On 8/21/2010 7:19 PM, Brad Roberts wrote: On 8/21/2010 2:29 PM, Andrei Alexandrescu wrote: |
_______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
