Backported to C++03, made it compile with MSVC.