Add explicit narrowing cast for C++11 support

This reflects the existing behaviour but in C++11 the implicit cast is
no longer allowed.