auto m = chrono::October;
I wonder is it worth adding a literal suffix of *same name* to the former?, which allows us to
auto m = chrono::October;
m += 8months;
I personally find this valuable because it makes the code simple and intuitive, and it's not too difficult to implement:
constexpr chrono::days
operator""days(unsigned long long d) noexcept
{ return chrono::days{static_cast<unsigned>(d)}; }
constexpr chrono::weeks
operator""weeks(unsigned long long w) noexcept
{ return chrono::weeks{static_cast<unsigned>(w)}; }
constexpr chrono::months
operator""months(unsigned long long m) noexcept
{ return chrono::months{static_cast<unsigned>(m)}; }
constexpr chrono::years
operator""years(unsigned long long y) noexcept
{ return chrono::years{static_cast<unsigned>(y)}; }
This allows us to write:
2004y += 300years;
100d += 20days;
auto w = chrono::Sunday;
w += 2days;
What do you experts think of this? Is this worth adding into the standard?
Hewill