1

I'm interested in doing some thing like this.

template<typename Clock>
struct A {
    Clock::time_point time;
}

A<chrono::steady_clock> a;

However this is not possible. How can I achieve this?

I think there maybe away around using this method in Clock's context but what is the proper way to do this in general?

en4bz
  • 1,092
  • 14
  • 18

1 Answers1

3

Since Clock::time_point is a dependent type, you need the typename keyword

template<typename Clock>
struct A {
    typename Clock::time_point time;
};
Marco A.
  • 43,032
  • 26
  • 132
  • 246