vendredi 6 mars 2015

Using `std::bind` to create inline function

I would like to expose std::chrono::high_resolution_clock::now as a standalone function. That is, I would like to do the following:



auto current_time = std::bind(std::chrono::high_resolution_clock::now);


Unfortunately, since this is in a header file, it results in multiple definitions of current_time at link-time. Is there a way to return an inline function from std::bind?


Aucun commentaire:

Enregistrer un commentaire