libcore: Better generic "for" pattern for C++11 style iterator methods