lundi 25 avril 2016

c++11 use chrono as semantic sugar

I use function from external library with interface like this:void f(int timeout);. Where timeout is in milliseconds. To make my code more readable, I want to use chrono in such form:

f(std::chrono::milliseconds(10).count());

  1. is it possible that std::chrono::milliseconds(10).count() != 10 ?

  2. is any "underwater rocks" that prevent modern compilers (clang, gcc, VC++) to convert f(std::chrono::milliseconds(10).count()) to f(10)?

Aucun commentaire:

Enregistrer un commentaire