Namespaces
Variants

std::chrono:: operator/ (calendar)

From cppreference.net
헤더에 정의됨 <chrono>
year_month
constexpr auto operator / ( const std:: chrono :: year & y,

const std:: chrono :: month & m ) noexcept

- > std:: chrono :: year_month ;
(1) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: year & y, int m ) noexcept
- > std:: chrono :: year_month ;
(2) (C++20부터)
month_day
constexpr auto operator / ( const std:: chrono :: month & m,

const std:: chrono :: day & d ) noexcept

- > std:: chrono :: month_day ;
(3) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: month & m, int d ) noexcept
- > std:: chrono :: month_day ;
(4) (C++20 이후)
constexpr auto operator / ( int m, const std:: chrono :: day & d ) noexcept
- > std:: chrono :: month_day ;
(5) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: day & d,

const std:: chrono :: month & m ) noexcept

- > std:: chrono :: month_day ;
(6) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: day & d, int m ) noexcept
- > std:: chrono :: month_day ;
(7) (C++20 이후)
month_day_last
(8) (C++20 이후)
constexpr auto operator / ( int m, std:: chrono :: last_spec ) noexcept
- > std:: chrono :: month_day_last ;
(9) (C++20 이후)
constexpr auto operator / ( std:: chrono :: last_spec ,

const std:: chrono :: month & m ) noexcept

- > std:: chrono :: month_day_last ;
(10) (C++20 이후)
constexpr auto operator / ( std:: chrono :: last_spec , int m ) noexcept
- > std:: chrono :: month_day_last ;
(11) (C++20 이후)
month_weekday
constexpr auto operator / ( const std:: chrono :: month & m,

const std:: chrono :: weekday_indexed & wdi ) noexcept

- > std:: chrono :: month_weekday ;
(12) (C++20 이후)
constexpr auto operator / ( int m, const std:: chrono :: weekday_indexed & wdi ) noexcept
- > std:: chrono :: month_weekday ;
(13) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: weekday_indexed & wdi,

const std:: chrono :: month & m ) noexcept

- > std:: chrono :: month_weekday ;
(14) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: weekday_indexed & wdi, int m ) noexcept
- > std:: chrono :: month_weekday ;
(15) (C++20 이후)
month_weekday_last
constexpr auto operator / ( const std:: chrono :: month & m,

const std:: chrono :: weekday_last & wdl ) noexcept

- > std:: chrono :: month_weekday_last ;
(16) (C++20 이후)
constexpr auto operator / ( int m, const std:: chrono :: weekday_last & wdl ) noexcept
- > std:: chrono :: month_weekday_last ;
(17) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: weekday_last & wdl,

const std:: chrono :: month & m ) noexcept

- > std:: chrono :: month_weekday_last ;
(18) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: weekday_last & wdl, int m ) noexcept
- > std:: chrono :: month_weekday_last ;
(19) (C++20 이후)
year_month_day
constexpr auto operator / ( const std:: chrono :: year_month & ym,

const std:: chrono :: day & d ) noexcept

- > std:: chrono :: year_month_day ;
(20) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: year_month & ym, int d ) noexcept
- > std:: chrono :: year_month_day ;
(21) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: year & y,

const std:: chrono :: month_day & md ) noexcept

- > std:: chrono :: year_month_day ;
(22) (C++20 이후)
constexpr auto operator / ( int y, const std:: chrono :: month_day & md ) noexcept
- > std:: chrono :: year_month_day ;
(23) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: month_day & md,

const std:: chrono :: year & y ) noexcept

- > std:: chrono :: year_month_day ;
(24) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: month_day & md, int y ) noexcept
- > std:: chrono :: year_month_day ;
(25) (C++20 이후)
year_month_day_last
(26) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: year & y,

const std:: chrono :: month_day_last & mdl ) noexcept

- > std:: chrono :: year_month_day_last ;
(27) (C++20 이후)
constexpr auto operator / ( int y, const std:: chrono :: month_day_last & mdl ) noexcept
- > std:: chrono :: year_month_day_last ;
(28) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: month_day_last & mdl,

const std:: chrono :: year & y ) noexcept

- > std:: chrono :: year_month_day_last ;
(29) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: month_day_last & mdl, int y ) noexcept
- > std:: chrono :: year_month_day_last ;
(30) (C++20 이후)
year_month_weekday
constexpr auto operator / ( const std:: chrono :: year_month & ym,

const std:: chrono :: weekday_indexed & wdi ) noexcept

- > std:: chrono :: year_month_weekday ;
(31) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: year & y,

const std:: chrono :: month_weekday & mwd ) noexcept

- > std:: chrono :: year_month_weekday ;
(32) (C++20 이후)
constexpr auto operator / ( int y, const std:: chrono :: month_weekday & mwd ) noexcept
- > std:: chrono :: year_month_weekday ;
(33) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: month_weekday & mwd,

const std:: chrono :: year & y ) noexcept

- > std:: chrono :: year_month_weekday ;
(34) (C++20부터)
constexpr auto operator / ( const std:: chrono :: month_weekday & mwd, int y ) noexcept
- > std:: chrono :: year_month_weekday ;
(35) (C++20부터)
year_month_weekday_last
constexpr auto operator / ( const std:: chrono :: year_month & ym,

const std:: chrono :: weekday_last & wdl ) noexcept

- > std:: chrono :: year_month_weekday_last ;
(36) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: year & y,

const std:: chrono :: month_weekday_last & mwdl ) noexcept

- > std:: chrono :: year_month_weekday_last ;
(37) (C++20 이후)
constexpr auto operator / ( int y, const std:: chrono :: month_weekday_last & mwdl ) noexcept
- > std:: chrono :: year_month_weekday_last ;
(38) (C++20부터)
constexpr auto operator / ( const std:: chrono :: month_weekday_last & mwdl,

const std:: chrono :: year & y ) noexcept

- > std:: chrono :: year_month_weekday_last ;
(39) (C++20 이후)
constexpr auto operator / ( const std:: chrono :: month_weekday_last & mwdl, int y ) noexcept
- > std:: chrono :: year_month_weekday_last ;
(40) (C++20 이후)

이러한 operator / 오버로드는 Proleptic Gregorian calendar 날짜 생성을 위한 관례적인 구문을 제공합니다.

전체 날짜를 생성하기 위해 다음 세 가지 순서 중 어느 것이든 허용됩니다:

  • year/month/day ,
  • month/day/year ,
  • day/month/year .

각 경우에 day 는 다음 중 하나로 대체될 수 있습니다:

  • std::chrono::last , 해당 월의 마지막 날을 의미합니다;
  • weekday [ i ] , 해당 월의 i 번째 weekday 를 의미합니다;
  • weekday [ std::chrono::last ] , 해당 월의 마지막 weekday 를 의미합니다.

다른 피연산자들의 타입으로부터 그 의미가 명확한 경우 일반 정수는 허용됩니다: 2005y / 4 / 5 는 허용되지만, 5 / April / 2005 는 허용되지 않습니다.

부분 날짜 타입( year_month , month_day 등)은 세 가지 순서 중 어느 것에서도 두 번째 operator / 를 적용하지 않음으로써 생성할 수 있습니다.

반환값

20) std:: chrono :: year_month_day ( ym. year ( ) , ym. month ( ) , d )
21) std:: chrono :: year_month_day ( ym. year ( ) , ym. month ( ) , std:: chrono :: day ( d ) )
22,24) std:: chrono :: year_month_day ( y, md. month ( ) , md. day ( ) )
23,25) std:: chrono :: year_month_day ( std:: chrono :: year ( y ) , md. month ( ) , md. day ( ) )
31) std:: chrono :: year_month_weekday ( ym. year ( ) , ym. month ( ) , wdi )
32,34) std:: chrono :: year_month_weekday ( y, mwd. month ( ) , mwd. weekday_indexed ( ) )
33,35) std:: chrono :: year_month_weekday ( std:: chrono :: year ( y ) , mwd. month ( ) , mwd. weekday_indexed ( ) )
36) std:: chrono :: year_month_weekday_last ( ym. year ( ) , ym. month ( ) , wdl )
37,39) std:: chrono :: year_month_weekday_last ( y, mwdl. month ( ) , mwdl. weekday_last ( ) )
38,40) std:: chrono :: year_month_weekday_last ( std:: chrono :: year ( y ) , mwdl. month ( ) , mwdl. weekday_last ( ) )

예제

#include <chrono>
using namespace std::chrono;
constexpr auto ym{2021y/8};
static_assert(ym == year_month(year(2021), August));
constexpr auto md{9/15d};
static_assert(md == month_day(September, day(15)));
constexpr auto mdl{October/last};
static_assert(mdl == month_day_last(month(10)));
constexpr auto mw{11/Monday[3]};
static_assert(mw == month_weekday(November, Monday[3]));
constexpr auto mwdl{December/Sunday[last]};
static_assert(mwdl == month_weekday_last(month(12), weekday_last(Sunday)));
// 이 행성과 그 너머에서 실제로 사용되는 3가지 연/월/일 순서:
constexpr auto ymd{year(2021)/January/day(23)};
static_assert(ymd == month{1}/23/2021);
static_assert(ymd == day{23}/1/2021);
static_assert(ymd == year_month_day(2021y, month(January), 23d));
int main() {}