Namespaces
Variants

std::chrono::month_weekday:: ok

From cppreference.net
constexpr bool ok ( ) const noexcept ;
(depuis C++20)

Vérifie si les objets month et weekday_indexed contenus sont valides.

Valeur de retour

month ( ) . ok ( ) && weekday_indexed ( ) . ok ( )

Exemple

#include <cassert>
#include <chrono>
int main()
{
    auto mwdi{std::chrono::March/std::chrono::Friday[1]};
    assert(mwdi.ok());
    mwdi = {std::chrono::month(17)/std::chrono::Friday[1]}; 
    assert(not mwdi.ok());
    mwdi = {std::chrono::March/std::chrono::Friday[-4]}; 
    assert(not mwdi.ok());
}