A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../../cpp/chrono/last_spec.html below:

std::chrono::last_spec, std::chrono::last - cppreference.com

struct last_spec

{
    explicit last_spec() = default;

};
(since C++20)

inline constexpr last_spec last{};

(since C++20)

last_spec is an empty tag type that is used in conjunction with other calendar types to indicate the last thing in a sequence. Depending on context, it may indicate the last day of a month (as in 2018y/February/last, for last day of February 2018, i.e., 2018-02-28) or the last day of the week in a month (as in 2018/February/Sunday[last], for last Sunday of February 2018, i.e., 2018-02-25).

[edit] Example
#include <chrono>
 
int main()
{
    using namespace std::chrono;
 
    constexpr auto mdl {June/last};
    static_assert(mdl == month_day_last(month(6)));
 
    constexpr auto ymwdl {year(2023)/December/Tuesday[last]};
    static_assert(ymwdl ==
        year_month_weekday_last(year(2023), month(12), weekday_last(Tuesday)));
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4