std::chrono...hrono::last(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

Okay bestie, welcome to the std::chrono...hrono::last(3) page from the C++ Standard Libary manual β€” yes, that manual name is spelled exactly like that, and we're keeping it, no cap. This is the whole std::chrono::last_spec,std::chrono::last situation, and it's giving iconic empty-tag-type energy ✨.

std::chrono::last_spec,std::chrono::last β€” std::chrono::last_spec,std::chrono::last (the description is literally the name again, and honestly? self-referential queen behavior πŸ’…).


✨ Synopsis ✨

Defined in header <chrono> β€” that's where this cutie lives πŸ¦‹.

struct last_spec

{                                    (since C++20)
    explicit last_spec() = default;

};
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) πŸ—“οΈπŸ’–.


πŸŽ€ Example πŸŽ€

Run this code, bestie β€” it's literally right here πŸ‘‘

       // Run this code

        #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)));
        }

Source/version/date check, bestie: http://cppreference.com, 2024.06.10, and the page is std::chrono...hrono::last(3). That's the whole footer wrapped in a bow πŸŽ€. Byeee! πŸ’–

πŸ“¦ where this page comes from