fix serious bug in generic pool iterator

The generic pool iterator is now similar to the typed cell_iterator,
there was a serious problem when trying to reach end iterator.
The helper structure has been reorganized to separate pool specific
operations, now support read-only db/*