Search code examples
c++literalsc++20c++-chrono

How can I initialize a std::chrono::duration constant without using namespace chrono?


I want to use this code

static constexpr auto set_time = 1s;

But I don't want to use using namespace chrono;

Error C3688 invalid literal suffix "s"; could not find the literal operator or pattern of the literal operator " operator ""s"


Solution

  • using namespace std::chrono_literals;