Itertools corrections and optimizations.

* ifilter and product optimization (no more useless copy)
* using random_access iterators when possible, forward iterators otherwise
* itertools tests now use complex generator expressions