Sampling algorithms for D
bearophile
bearophileHUGS at lycos.com
Thu Apr 12 16:44:44 PDT 2012
Joseph Rushton Wakeling:
> >> final size_t select(ref UniformRNG urng)
> >> {
> >> assert(_recordsRemaining > 0);
> >> assert(_sampleRemaining > 0);
> >
> > Probably it's better to move those asserts in preconditions/postconditions or in
> > class/struct invariants.
>
> Those asserts are deliberately intended for the function.
Then use a function/method precondition:
final size_t select(ref UniformRNG urng)
in {
assert(_recordsRemaining > 0);
assert(_sampleRemaining > 0);
} body {
...
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list