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?
§ 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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.