1

I've noticed that std::chrono::steady_clock::now has the noexcept specifier in the documentation at cplusplus.com. However, I haven't found any provision for this in the latest C++11 draft (unfortunately I don't have a copy of the standard).

Is it a mistake in the cplusplus.com documenation or should std::chrono::steady_clock::now have the noexcept specifier?

vitaut
  • 49,672
  • 25
  • 199
  • 336

1 Answers1

8

§ 20.11.7.2 of the C++11 standard's definition of steady_clock:

class steady_clock {
public:
    typedef unspecified rep;
    typedef ratio<unspecified , unspecified > period;
    typedef chrono::duration<rep, period> duration;
    typedef chrono::time_point<unspecified, duration> time_point;
    static const bool is_steady = true;
    static time_point now() noexcept;
};

So yes, std::steady_clock::now() should be noexcept and it isn't an error in the documentation. It seems cppreference says the same.

Rapptz
  • 20,807
  • 5
  • 72
  • 86