How to fix C++ error: invalid use of template-name ‘std::chrono::time_point’ without an argument list
Problem:
You are trying to use std::chrono::time_point
in your C++ code, but the compiler throws an error message like
MyClass.hpp:58:5: error: invalid use of template-name ‘std::chrono::time_point’ without an argument list
58 | std::chrono::time_point t0;
Solution
std::chrono::time_point
is a template that requires two template arguments: the clock and the duration. The duration argument, however, defaults to Clock::duration
so you only have to explicitly specify the clock.
Typically you can just use std::chrono::system_clock
:
std::chrono::time_point<std::chrono::system_clock> t0;