std::chrono supertype, function argument passing
c++, c++-chrono, c++11
Solution
The `std::chrono::time_point` is a templated class, that needs at least a `clock` template parameter.
Either explicitly set the clock, like
void my_function(std::chrono::time_point<std::chrono::high_resolution_clock> time_point);
Or you can make your function a template itself:
template<typename Clock>
void my_function(std::chrono::time_point<Clock> time_point);
In the last case you actually don't have to specify the template parameter when calling the function, the compiler figures it out for you:
my_function(now);
Problem
I have ``` auto now = std::chrono::high_resolution_clock::now(); ``` and i want to pass it to a function using a general type for a time point. I do not want specify the resolution or type of clock used. I've tried using ``` void my_function(std::chrono::time_point time_point); ``` but without success. Since apparently std::chrono::time_point isn't a type.