vendredi 6 mars 2015

Creating a function alias


EDIT: This question was originally titled "Using std::bind to create inline function," but that's not really what I'm after: I just want a simple way to alias functions.


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