custom functors for foreach in extract.h