Should std :: chrono :: stable_clock :: be good now?

I noticed that std::chrono::steady_clock::now has a noexcept in the noexcept documentation. However, I did not find any provisions for this in the latest C ++ 11 project (unfortunately, I do not have a copy of the standard).

Is this a mistake in cplusplus.com or std::chrono::steady_clock::now has a noexcept ?

+1
source share
1 answer

ยง 20.11.7.2 of the standard definition of C ++ 11 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 this is not a documentation error. The cppreference seems to say the same thing .

+8
source

Source: https://habr.com/ru/post/1495800/


All Articles