-
Notifications
You must be signed in to change notification settings - Fork 332
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
Observe multiple from generic input iterators #537
base: master
Are you sure you want to change the base?
Conversation
355fced
to
a7460b8
Compare
Hi, no thoughts about this PR? Thanks |
Not that my opinion matters here but I had a look anyway, and I like it. 😄 Still, I think this would be even better if
|
Thanks for your remarks!
To leverage above issues coming with generic iterators, I may specialize the function for random access iterators with your proposal. WDYT? |
Hello, |
Hi, OK, here is the first extracted PR with move constructors. |
0a84248
to
7e32408
Compare
…ences, observe from templated input it
7e32408
to
76880ac
Compare
The use case I have in mind for the extended API would use an std::array or maybe a std::vector to feed the new method, where an iterator is basically a pointer and std::distance boils down to a subtraction. For those cases doing the check upfront (or maybe even not at all; just mention it's UB in the documentation) would be preferable. I see there are situations where it's not so clear and a single forward iteration would be preferable. But then I still think the method should either throw an exception on illegal arguments or succeed completely. The proposed implementation would throw an exception after the "damage" has already been done, when some samples have already been merged into the histogram. I consider this problematic. But OTOH I really don't know what to do with this kind of iterators. Maybe it's better to use the old API in this case? |
Addition of an observe method from generic input iterator, with a new unit test.