MSVC 2013 compatibility: somehow std::reference_wrapper needs full def.

What the hell, again.
MSVC 2013 compatibility: avoid more compiler crashes.
GCC 4.5 compatibility: no range-based for loops.

Strangely enough the first loop affected MSVC 2013 parser as well, it
complained about unexpected } (which is inside the assertion). WTF?!
MSVC 2013 compatibility: work around bug with move-only types in vector.

The std::vector implementation somehow wants to copy the data even if
the type is move-only.