How do you safely deal with range.front?
Tony
tonytdominguez at aol.com
Sun Dec 31 01:03:17 UTC 2017
For me, front() should throw a pre-defined exception when called
on an empty range in order to eliminate undefined behavior. It
does take some time to make a check, but D does array bounds
checking by default. Ideally the front() check could be turned
off somehow ("-boundschecks=off") by the user for those who want
maximum speed, but I guess there is no way to do that when using
pre-compiled functions in a library.
More information about the Digitalmars-d-learn
mailing list