-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TupleCombinations
: size_hint
and count
#763
TupleCombinations
: size_hint
and count
#763
Conversation
`TupleCombinations` and `Tuple1Combination` merely wrap an iterator so I just call its `size_hint` method. `Tuple2Combination` chains a wrapped `Tuple1Combination` with a smaller `Tuple2Combination` but this one is not initialized yet so it is full and therefore has `binomial(n, k)` elements. Similar for `3..=12`, it's just recursive.
Same as `TupleCombinations::size_hint` but simpler.
@jswrenn Ooops... I missed that |
Yes, in adaptors/mod.rs is fine. |
Just cut/paste, and fixed imports. It is moved because it is now needed even without heap-allocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, could you add a specialization test for this to tests/specializations.rs
?
This was definitely simpler to implement than it was for
Combinations
(with vector items). The only difficulty is that it's recursive with a macro.According to my notes, all iterators that should have a
size_hint
specialization now have. I like that.The
count_ident
macro is moved to be available library-wide.