std::chrono...day_last::ok(3)
πΈ NAME πΈ
std::chrono::month_day_last::ok β okay so this is the ok() member of std::chrono::month_day_last, and the page header is literally std::chrono...day_last::ok(3) from the C++ Standard Libary manual. Yes bestie, that's the whole vibe. π
β¨ Synopsis β¨
Here's the exact signature, no cap:
constexpr bool ok() const noexcept; (since C++20)
It's constexpr, it's noexcept, and it's been around since C++20. Slay. β¨
This function checks if the month object stored in *this is valid. That's the entire mission. π―
π Return value π
It returns month().ok(). That's it. That's the return value. π
π Example π
// Run this code
#include <cassert>
#include <chrono>
int main()
{
auto mdl{std::chrono::February/std::chrono::last};
assert(mdl.ok());
mdl = {std::chrono::month(42)/std::chrono::last};
assert(!mdl.ok());
}
The asserts are doing the vibe check: February/last passes, and month(42)/last does not. π«Ά
Source/version: http://cppreference.com, dated 2024.06.10 β mwah, bye bestie π
π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms