jeudi 24 novembre 2016

std::min of std::chrono::duration of different types

Consider following code:

using namespace std::chrono;
std::min(milliseconds(900), seconds(1));

It doesn't compile because compiler cannot instantiate correct version of std::min because of different argument types.

Of course, it's possible to specify type explicitly using std::min<milliseconds>. But what is the generic way?

Aucun commentaire:

Enregistrer un commentaire