Patch to allow finding the position of a nonempty_iterator
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
Hi!
It's useful when scanning over a table with the nonempty_iterator to be able to
calculate the current position of the iterator in the table. Simple API:
sparsetable<int> table(100);
// Add things to table
for (sparsetable<int>::nonempty_iterator it=table.nonempty_
begin(),ite=table.nonempty_end();it!=ite;++it){
int pos = table.get_pos(it);
// Do stuff with pos
}
Attached a patch, plenty of room for optimisation by removing branch perhaps?
The repetition of bits_in is a bit cumbersome too. Not sure how to place that
outside of a static function...
Let me know if you what any changes!
Cheers,
Donovan.
Original issue reported on code.google.com by DonovanH...@gmail.com
on 10 Jul 2011 at 6:22
Attachments:
Google Code Exporter commented
Oops, missed out the tests. Please refer to this attached diff instead.
Original comment by DonovanH...@gmail.com
on 10 Jul 2011 at 6:39
Attachments:
Google Code Exporter commented
I'm obviously not very good with attachments!
Please use this one (fingers crossed!)
Original comment by DonovanH...@gmail.com
on 10 Jul 2011 at 6:42
Attachments:
Google Code Exporter commented
Thanks for the patch! It looks good to me. I'll pass it by someone here who
is good at optimizing to see if they have any recommendations, but I'll look to
get it into svn-trunk sometime this week.
Original comment by csilv...@gmail.com
on 11 Jul 2011 at 10:43
- Changed state: Accepted
- Added labels: Priority-Medium, Type-Patch
Google Code Exporter commented
Original comment by csilv...@gmail.com
on 12 Jul 2011 at 12:55
- Changed state: Started
Google Code Exporter commented
btw, can you please sign the CLA at
http://code.google.com/legal/individual-cla-v1.0.html
if you haven't already? Thanks!
Original comment by csilv...@gmail.com
on 12 Jul 2011 at 12:57
Google Code Exporter commented
That's done, signed and submitted!
Original comment by DonovanH...@gmail.com
on 12 Jul 2011 at 1:18
Google Code Exporter commented
Fixed in r76
Original comment by csilv...@gmail.com
on 26 Aug 2011 at 1:27
- Changed state: Fixed