Feature #1692
Suggestion: Add "JumpTo" function to prime iterators
Description
Consider adding a JumpTo
mem fn to iterators (for prime numbers)
PrimeSeq pseq; pseq.myJumpTo(1000000); cout << *pseq << end; // print a prime number close to 1000000 ++pseq; // advance to next prime number... etc
If we do this, it may make PrimeSeqForCRT
redundant [check!]
Related issues
History
#1 Updated by John Abbott over 1 year ago
I implemented a prototype PrimeSeq1ModN
class for a student, and he needed something like a JumpTo
function.
So I implemented one... it wasn't too hard, and seems like it could be useful for other prime iterators.
It might be nice to be able to remove PrimeSeqForCRT
which is a bit of an oddity.
Perhaps PrimeSeq
ctor could have an optional arg when used for CRT? ...to avoid
having to call myJumpTo
?
#2 Updated by John Abbott over 1 year ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
What should the mem fn be called?
Current prototype calls it JumpTo
, so that a mem fn call would look like pseq.JumpTo(n)
.
This does not follow the rule that mem fns have names beginning with my
or Iam
.
What name should we use?
#3 Updated by John Abbott 2 months ago
- Target version changed from CoCoALib-0.99850 to CoCoALib-0.99900
#4 Updated by John Abbott about 2 months ago
- Related to Design #1787: Iterator design: compatible with C++STL? Advancing beyond end? added