std::chrono::year::operator int
From cppreference.com
explicit constexpr operator int() const noexcept; |
(since C++20) | |
Returns the year value stored in *this
.
Return value
The year value stored in *this
.
Example
Run this code
#include <iostream> #include <chrono> int main() { std::chrono::year y {2020}; auto year = (int)y; std::cout << "The year is: " << year << "\n"; }
Output:
The year is: 2020