This seems to be the cleanest C++11 way to do it.