<chrono>
işleçleri
operator+
Aşağıdaki türler için toplama işleci:
day
duration
month
time_point
weekday
year
year_month
year_month_day
year_month_day_last
year_month_weekday
year_month_weekday_last
1)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator+(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
2)
template <class Clock, class Duration1, class Rep2, class Period2>
constexpr time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
operator+(
const time_point<Clock, Duration1>& Time,
const duration<Rep2, Period2>& Dur);
3)
template <class Rep1, class Period1, class Clock, class Duration2>
time_point<Clock, constexpr typename common_type<duration<Rep1, Period1>, Duration2>::type>
operator+(
const duration<Rep1, Period1>& Dur,
const time_point<Clock, Duration2>& Time);
4)
constexpr day operator+(const day& d, const days& ds) noexcept; // C++20
constexpr day operator+(const days& ds, const day& d) noexcept; // C++20
5)
constexpr month operator+(const month& m, const months& ms) noexcept; // C++20
constexpr month operator+(const months& ms, const month& m) noexcept; // C++20
6)
constexpr weekday operator+(const weekday& wd, const days& wds) noexcept // C++20
constexpr weekday operator+(const days& ds, const weekday& wd) noexcept; // C++20
7)
constexpr year operator+(const year& y, const years& ys) noexcept; // C++20
constexpr year operator+(const years& ys, const year& y) noexcept; // C++20
8)
constexpr year_month operator+(const year_month& ym, const months& dm) noexcept; // C++20
constexpr year_month operator+(const months& dm, const year_month& ym) noexcept; // C++20
constexpr year_month operator+(const year_month& ym, const years& dy) noexcept; // C++20
constexpr year_month operator+(const years& dy, const year_month& ym) noexcept; // C++20
9)
constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept; // C++20
constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept; // C++20
constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept; // C++20
constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept; // C++20
10)
constexpr year_month_day_last operator+(const year_month_day_last& ymdl, const months& dm) noexcept; // C++20
11)
constexpr year_month_day_last operator+(const months& dm, const year_month_day_last& ymdl) noexcept; // C++20
12)
constexpr year_month_day_last operator+(const year_month_day_last& ymdl, const years& dy) noexcept; // C++20
constexpr year_month_day_last operator+(const years& dy, const year_month_day_last& ymdl) noexcept; // C++20
13)
constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const months& dm) noexcept; // C++20
constexpr year_month_weekday operator+(const months& dm, const year_month_weekday& ymwd) noexcept; // C++20
14)
constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const years& dy) noexcept; // C++20
15)
constexpr year_month_weekday operator+(const years& dy, const year_month_weekday& ymwd) noexcept; // C++20
16)
constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept; // C++20
constexpr year_month_weekday_last operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept; // C++20
17)
constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept; // C++20
constexpr year_month_weekday_last operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept; // C++20
Dönüş değeri
1) ve Right
ortak türlerine dönüştürdükten Left
sonra, dönüştürülen değer sayısı toplamına eşit bir değer sayısı ile bir duration
döndürür.
2-3) Zaman noktasından zaman aralığından Dur
Time
ayrılan bir noktayı temsil eden bir nesne döndürürtime_point
.
4) sonucunu d+ds.count()
döndürür. Sonuç [0, 255] aralığının dışındaysa, sonuç belirtilmez.
5) sonucunu m+ms.count()
döndürür. Sonuç [1, 12] aralığının dışındaysa modulo 12 ve ardından +1 azaltılır.
6) gün ve hafta içi weekday
gün sayısını öğesine eklemenin sonucunu döndürür. Sonuç modulo 7 olacaktır, bu nedenle her zaman aralıkta [0,6]
7) Yılı belirtilen yıl sayısına eklemenin sonucunu döndürür.
8) Belirtilen ay ve yıla ay ve yıl sayısını eklemenin sonucunu döndürür.
9) bir öğesine ay veya yıl year_month_day
eklemenin sonucunu döndürür. ve [1d, 28d] aralığında değilseymd.month()
, ok()
toplamanın sonucu olarak döndürülebilirfalse
.February
ymd.day()
10) döndürür (ymdl.year() / ymdl.month() + dm) / last
. Not: /
Burada kullanılan bölüm işleci değildir. Bu tarih işlecidir.
11) döndürür ymdl + dm
.
12) Döndürür {ymdl.year()+dy, ymdl.month_day_last()}
13) döndürür ymwd + dm.count()
.
14-15) döndürür {ymwd.year()+dy, ymwd.month(), ymwd.weekday_indexed()}
.
16) döndürür (ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()
. Not: /
Burada kullanılan bir bölme işleci değil tarih işlecidir.
17) Döndürür: ymwdl + dy
Örnek: operator+
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main()
{
// day
day d{1};
std::cout << d + days(2) << '\n'; // 03
// month
month m{11};
std::cout << m + months(3)<< '\n'; // Feb
// weekday
weekday wd = Thursday;
std::cout << wd + days(1) << '\n'; // Fri
// year_month_day_last
year_month_day_last ymdl{June / last / 2021};
std::cout << ymdl + years{1} + months{1} << '\n'; // 2022/Jul/last
// year_month_weekday
year_month_weekday ymw{ year(1997) / January / Wednesday[1] };
std::cout << ymw + months{1} << '\n'; // 1997/Feb/Wed[1]
std::cout << ymw + years{1} << '\n'; // 1998/Jan/Wed[1]
// year_month_weekday_last
year_month_weekday_last ymwl{ year(1997) / January / Wednesday[last] };
std::cout << ymwl + months{ 1 } << '\n'; // 1997/Feb/Wed[last]
std::cout << ymwl + years{ 1 } << '\n'; // 1998/Jan/Wed[last]
return 0;
}
03
Feb
Fri
2022/Jul/last
1997/Feb/Wed[1]
1998/Jan/Wed[1]
1997/Feb/Wed[last]
1998/Jan/Wed[last]
Tekli operator+
Aşağıdaki türlere birli artı uygulayın:
// duration
constexpr common_type_t<duration> operator+() const // C++20
Dönüş değeri
Döndürür *this
operator-
Aşağıdaki türler için çıkarma işleci:
day
duration
month
time_point
weekday
year
year_month
year_month_day
year_month_day_last
year_month_weekday
year_month_weekday_last
1)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator-(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
2)
template <class Clock, class Duration1, class Rep2, class Period2>
constexpr time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type
operator-(
const time_point<Clock, Duration1>& Time,
const duration<Rep2, Period2>& Dur);
3)
template <class Clock, class Duration1, class Duration2>
constexpr typename common_type<Duration1, Duration2>::type
operator-(
const time_point<Clock, Duration1>& Left,
const time_point<Clock, Duration2>& Right);
4)
constexpr day operator-(const day& d, days& ds) noexcept; // C++20
constexpr day operator-(const day& d, const day& d) noexcept; // C++20
5)
constexpr month operator-(const month& m, const months& ms) noexcept; // C++20
constexpr month operator-(const month& m, const month& ms) noexcept; // C++20
6)
constexpr months operator-(const year_month& Left, const year_month& Right) noexcept; // C++20
7)
constexpr weekday operator-(const weekday& Left, const days& Right) noexcept; // C++20
8)
constexpr days operator-(const weekday& Left, const weekday& Right) noexcept; // C++20
9)
constexpr year operator-(const year& y, const years& ys) noexcept; // C++20
10)
constexpr years operator-(const year& y, const year& y2) noexcept; // C++20
11)
constexpr year_month operator-(const year_month& ym, const months& dm) noexcept; // C++20
constexpr year_month operator-(const year_month& ym, const years& dy) noexcept; // C++20
12)
constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept; // C++20
constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept; // C++20
13)
constexpr year_month_day_last operator-(const year_month_day_last& ymdl, const months& dm) noexcept; // C++20
14)
constexpr year_month_day_last operator-(const year_month_day_last& ymdl, const years& dy) noexcept; // C++20
15)
constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const months& dm) noexcept; // C++20
16)
constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const years& dy) noexcept; // C++20
17)
constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept; // C++20
18)
constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept; // C++20
Dönüş değeri
1) Çıkarılmakta olan süreleri ortak türlerine dönüştürdükten sonra, içindeki kene sayısından çıkarılmış kene sayısına eşit bir değer Right
Left
sayısı içeren bir duration
döndürür.
2) ile temsil edilen zaman aralığının tarafından belirtilen Time
zaman noktasından olumsuzlanmasıyla Dur
yer değiştiren bir zaman noktasını temsil eden bir döndürürtime_point
.
3) ile Right
arasındaki Left
zaman aralığını temsil eden bir duration
nesne döndürür.
4) sonucunu d-ds.count()
döndürür. Sonuç [0, 255] aralığının dışındaysa, sonuç belirtilmez.
5) if m.ok() == true
ve ms.ok() == true
ise, iki aylık değerleri çıkarmanın veya ay sayısını çıkarmanın sonucunu döndürür. Sonuç [1, 12] aralığında olacaktır. Sonuç negatifse çevresinde kaydırılır. Örneğin, Ocak ayından bir ay çıkarma (month m1{1} - months{1};
12 (Aralık) ile sonuçlanabilir.
6) ile arasındaki Left
ay cinsinden farkı verir Right
7) if Left.ok() == true
ve Right.ok() == true
ise , [days{0}
, days{6}
] aralığında bir weekday
döndürür.
8) İki haftanın günü arasındaki gün sayısını verir.
9) Döndürür year(int(y)-ys.count)())
10) döndürür years(int(y) - int(y2))
. İki year
değerin çıkarılması, ile y2
arasındaki y
yılların farkını temsil eden bir std::chrono::years
ile sonuç verir. Örneğin, 2021y-2000y
üretir years(21)
.
11) Bir year_month
değerden ayları veya yılları çıkarmanın sonucunu verir.
12) Bir değerden year_month_day
ayları çıkarmanın sonucunu döndürür.
13) Değerden year_month_day_last
ay sayısını çıkarmanın sonucunu döndürür. Temelde: ymdl-dm
.
14) Yıl sayısını değerden year_month_day_last
çıkarmanın sonucunu döndürür. Temelde: ymdl-dy
.
15) Değerden year_month_weekday
ay sayısını çıkarmanın sonucunu döndürür. Temelde: ymwd-dm
.
16) Yıl sayısını değerden year_month_weekday
çıkarmanın sonucunu döndürür. Temelde: ymwd-dy
.
17) Değerden year_month_weekday_last
ay sayısını çıkarmanın sonucunu döndürür. Temelde: ymwdl-dm
.
18) Değerden year_month_weekday_last
yıl sayısını çıkarmanın sonucunu döndürür. Temelde: ymwdl-dy
.
Örnek: operator-
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main()
{
// day
day d{10};
d = d - days(5);
std::cout << d << '\n'; // 05
// month
month m{2};
m = m - months{1};
std::cout << m << '\n'; // Jan
m = m - months{1};
std::cout << m << '\n'; // Dec
// year
auto diff1 = 2021y-2000y;
auto diff2 = 2021y-years{1};
std::cout << diff1.count() << '\n'; // 21
std::cout << diff2 << '\n'; // 2020
// year_month
const year theYear{ 2021 };
year_month ym1{theYear, June};
year_month ym2 = ym1 - months{2};
std::cout << ym2 << '\n'; // 2021/Apr
year_month ym3 = ym1 - years{2};
std::cout << ym3 << '\n'; // 2019/Jun
// year_month_day_last
year_month_day_last ymdl = June / last / 2021;
std::cout << ymdl - years{1} - months{1} << '\n'; // 2022/Jul/last
// year_month_weekday
year_month_weekday ymw{ year(1997) / January / Wednesday[1] };
std::cout << ymw - months{1} << '\n'; // 1996/Dec/Wed[1]
std::cout << ymw - years{1} << '\n'; // 1996/Jan/Wed[1]
// year_month_weekday_last
year_month_weekday_last ymwl{ year(1997) / January / Wednesday[last] };
std::cout << ymwl - months{ 1 } << '\n'; // 1996/Dec/Wed[last]
std::cout << ymwl - years{ 1 } << '\n'; // 1996/Jan/Wed[last]
return 0;
}
05
Jan
Dec
21
2020
2021/Apr
2019/Jun
2020/May/last
1996/Dec/Wed[1]
1996/Jan/Wed[1]
1996/Dec/Wed[last]
1996/Jan/Wed[last]
Tekli operator-
bir duration
öğesini olumsuzlar.
constexpr common_type_t<duration> operator-() const;
Dönüş değeri
Öğesinin olumsuzlanmış bir kopyasını döndürür *this
Örnek: birli operator-
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main()
{
duration<int, std::milli> milliseconds(120);
std::cout << -milliseconds << '\n';
return 0;
}
-120ms
operator!=
Belirler:
1) İki duration
nesne aynı sayıda keneyi temsil etmemektedir.
2) İki time_point
nesne aynı zaman noktasını temsil etmediğinden.
1)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator!=(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
2)
template <class Clock, class Duration1, class Duration2>
constexpr bool operator!=(
const time_point<Clock, Duration1>& Left,
const time_point<Clock, Duration2>& Right);
Parametreler
Left
Sol duration
veya time_point
nesne.
Right
Sağ duration
veya time_point
nesne.
Dönüş değeri
1) Ortak Left
olan ve Right
eşit olmayan türün onay işareti sayısını döndürürtrue
. Aksi takdirde döndürür false
.
2) İki time_point
nesne aynı zaman noktasını temsil etmediyse döndürürtrue
. Aksi takdirde döndürür false
.
operator*
Nesneler için duration
çarpma işleci. Çarpılmakta duration
olan değerleri ortak türlerine dönüştürdükten sonra, dönüştürülen değer çizgisi sayılarının çarpmasına eşit bir değer sayısı içeren bir duration
döndürür.
1)
template <class Rep1, class Period1, class Rep2>
constexpr duration<typename common_type<Rep1, Rep2>::type, Period1>
operator*(
const duration<Rep1, Period1>& Dur,
const Rep2& Mult);
2)
template <class Rep1, class Rep2, class Period2>
constexpr duration<typename common_type<Rep1, Rep2>::type, Period2>
operator*(
const Rep1& Mult,
const duration<Rep2,
Period2>& Dur);
Parametreler
Dur
Bir duration
nesnesi.
Mult
İntegral değer.
Dönüş değeri
Aralık uzunluğu Mult
uzunluğu Dur
ile çarpılmış bir duration
nesne döndürür.
1) tutmadığı true
süreceis_convertible<Rep2, common_type<Rep1, Rep2>>
, bu işlev aşırı yükleme çözümlemeye katılmaz. Daha fazla bilgi için bkz <. type_traits>.
2) tutmadığı true
süreceis_convertible<Rep1, common_type<Rep1, Rep2>>
, bu işlev aşırı yükleme çözümlemeye katılmaz. Daha fazla bilgi için bkz <. type_traits>.
operator<
1) S'leri ortak türlerine göre dönüştürdükten duration
sonra, için Left
kene sayısının için Right
değerinden daha az olup olmadığını belirler.
2) döneminin süresinden bu yana geçen zaman noktasının Left
time_point
içindeki döneminin tarihinden bu yana geçen süreden time_point
Right
küçük olup olmadığını belirler.
1)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator<(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
2)
template <class Clock, class Duration1, class Duration2>
constexpr bool operator<(
const time_point<Clock, Duration1>& Left,
const time_point<Clock, Duration2>& Right);
Parametreler
Left
Sol duration
veya time_point
nesne.
Right
Sağ duration
veya time_point
nesne.
Dönüş değeri
1) için onay işareti sayısı için Left
değer işareti Right
sayısından azsa döndürürtrue
. Aksi takdirde işlevi döndürür false
.
2) öncesindeyse Left
Right
döndürürtrue
. Aksi takdirde döndürür false
.
operator<=
1) Varlıklarını ortak türlerine göre dönüştürdükten duration
sonra, için Left
kene sayısının daha az mı yoksa ile aynı Right
mı olduğunu belirler.
2) döneminin tarihinden bu yana geçen zaman noktasının Left
time_point
içindeki döneminin tarihinden bu yana geçen süreden time_point
Right
küçük veya buna eşit olup olmadığını belirler.
1)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator<=(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
2)
template <class Clock, class Duration1, class Duration2>
constexpr bool operator<=(
const time_point<Clock, Duration1>& Left,
const time_point<Clock, Duration2>& Right);
Parametreler
Left
Sol duration
veya time_point
nesne.
Right
Sağ duration
veya time_point
nesne.
Dönüş değeri
1) için kene sayısı için Left
kene Right
sayısından küçük veya buna eşitse döndürürtrue
. Aksi takdirde işlevi döndürür false
.
2) Önceyse veya değerine eşitse Left
döndürür true
Right
. Aksi takdirde döndürür false
.
operator==
Belirler:
1) duration
nesneler aynı uzunlukta zaman aralıklarını temsil eder.
2) time_point
nesneler zaman içinde aynı noktayı temsil eder.
3) day
nesneleri aynı günü temsil eder.
4) month
nesneleri aynı ayı temsil eder.
5) month_day
nesneleri aynı ay ve günü temsil eder.
6) month_day_last
nesneleri aynı ayı temsil eder.
7) month_weekday
nesneleri aynı ay ve n. haftanın gününü temsil eder.
8) month_weekday_last
nesneleri aynı ayı ve geçen haftanın gününü temsil eder.
9) weekday
nesneleri aynı haftanın gününü temsil eder.
10) weekday_last
nesneleri ayın son hafta gününü temsil eder.
11) weekday_indexed
aynı hafta içi endeksini temsil etmektedir.
12) year
aynı yılı temsil eden bir yıldır.
13) year_month
aynı yıl ve ayı temsil eden.
14) year_month_day
aynı yılı, ayı ve günü temsil eden bir değerdir.
15) year_month_day_last
yılın ve ayın aynı son gününü temsil eden.
16) year_month_weekday
aynı hafta içi, yıl ve ayı temsil ediyor.
17) year_month_weekday_last
ayın, yılın ve ayın son hafta gününü temsil ediyor.
18) time_zone_link
aynı name
. Ad target
dikkate alınmaz.
19) zoned_time
aynı saat ve saat dilimini temsil eder.
// 1) duration<Rep, Period>
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator==(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
// 2) time_point
template <class Clock, class Duration1, class Duration2>
constexpr bool operator==(
const time_point<Clock, Duration1>& Left,
const time_point<Clock, Duration2>& Right);
// 3) day
constexpr bool operator==(const day& Left, const day& Right) noexcept; // C++20
// 4) month
constexpr bool operator==(const month& Left, const month& Right) noexcept; // C++20
// 5) month_day
constexpr bool operator==(const month_day& Left, const month_day& Right) noexcept; // C++20
// 6) month_day_last
constexpr bool operator==(const month_day_last& Left, const month_day_last& Right) noexcept; // C++20
// 7) month_weekday
constexpr bool operator==(const month_weekday& Left, const month_weekday& Right) noexcept; // C++20
// 8) month_weekday_last
constexpr bool operator==(const month_weekday_last& Left, const month_weekday_last& Right) noexcept; // C++20
// 9) weekday
constexpr bool operator==(const weekday& Left, const weekday& Right) noexcept; // C++20
// 10) weekday_last
constexpr bool operator==(const weekday_last& Left, const weekday_last& Right) noexcept; // C++20
// 11) weekday_indexed
constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; // C++20
// 12) year
constexpr bool operator==(const year& Left, const year& y ) noexcept; // C++20
// 13) year_month
constexpr bool operator==(const year_month& Left, const year_month& Right) noexcept; // C++20
// 14) year_month_day
constexpr bool operator==(const year_month_day& Left, const year_month_day& Right) noexcept; // C++20
// 15) year_month_day_last
constexpr bool operator==(const year_month_day_last& Left, const year_month_day_last& Right) noexcept; // C++20
// 16) year_month_weekday
constexpr bool operator==(const year_month_weekday& Left, const year_month_weekday& Right) noexcept; // C++20
// 17) year_month_weekday_last
constexpr bool operator==(const year_month_weekday_last& Left, const year_month_weekday_last& Right) noexcept; // C++20
// 18) time_zone_link
bool operator==(const time_zone_link& Left, const time_zone_link& Right) noexcept; // C++20
// 19) zoned_time
template <class Duration1, class Duration2, class TimeZonePtr>
bool operator==(const zoned_time<Duration1, TimeZonePtr>& Left, const zoned_time<Duration2, TimeZonePtr>& Right); // C++20
Parametreler
Left
Karşılaştıracak sol nesne, örneğin, Left
== Right
Right
Karşılaştıracak doğru nesne.
Dönüş değeri
1) ortak Left
olan ve Right
türü için kene sayısı eşitse verirtrue
. Aksi takdirde döndürür false
.
2) Aynı zaman noktasının if Left
ve Right
temsilini döndürürtrue
. Aksi takdirde döndürür false
.
3-17) Aynı değere sahip olup Right
olmadığını Left
döndürürtrue
. Aksi takdirde döndürür false
.
18) ise Left.name() == Right.name()
döndürürtrue
. Aksi takdirde döndürür *false*
.
19) Şunu döndürür true
: Left.get_time_zone() == _Right.get_time_zone() && Left.get_sys_time() == Right.get_sys_time();
operator>
1) Varlıklarını ortak türlerine göre dönüştürdükten duration
sonra, için kene Left
sayısının için Right
değerinden büyük olup olmadığını belirler.
2) döneminin tarihinden bu yana geçen zaman noktasının Left
time_point
içindeki döneminin tarihinden bu yana geçen süreden time_point
Right
büyük olup olmadığını belirler.
1)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator>(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
2)
template <class Clock, class Duration1, class Duration2>
constexpr bool operator>(
const time_point<Clock, Duration1>& Left,
const time_point<Clock, Duration2>& Right);
Parametreler
Left
Sol duration
veya time_point
nesne.
Right
Sağ duration
veya time_point
nesne.
Dönüş değeri
1) için onay işareti sayısı için Left
değer değerlerinden Right
büyükse döndürürtrue
. Aksi takdirde işlevi döndürür false
.
2) sonrasında Right
gelirse Left
döndürürtrue
. Aksi takdirde döndürür false
.
operator>=
1) Varlıklarını ortak türlerine göre dönüştürdükten duration
sonra, için Left
kene sayısının değerinden büyük veya eşit Right
olup olmadığını belirler.
2) döneminin tarihinden bu yana geçen zaman noktasının Left
time_point
içindeki döneminin tarihinden bu yana geçen süreden time_point
Right
büyük veya buna eşit olup olmadığını belirler.
1)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr bool operator>=(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
2)
template <class Clock, class Duration1, class Duration2>
constexpr bool operator>=(
const time_point<Clock, Duration1>& Left,
const time_point<Clock, Duration2>& Right);
Parametreler
Left
Sol duration
veya time_point
nesne.
Right
Sağ duration
veya time_point
nesne.
Dönüş değeri
1) için Left
kene sayısı için kene sayısından Right
büyük veya buna eşitse döndürürtrue
. Aksi takdirde işlevi döndürür false
.
2) Sonra gelirse veya değerine eşitse Left
döndürür true
Right
. Aksi takdirde döndürür false
.
operator<=>
ile operator==
uzay gemisi işleci, , , >
, >=
ve !=
için aşağıdaki türler için işleçleri <
<=
sentezler:
day
duration
month
month_day
month_day_last
time_point
time_zone_link
year
year_month
year_month_day_last
1)
constexpr bool operator<=>(const day& Left, const day& Right) noexcept; // C++20
constexpr std::strong_ordering operator<=>(const month& Left, const month& Right) noexcept; // C++20
constexpr strong_ordering operator<=>(const month_day& Left, const month_day& Right) noexcept; // C++20
constexpr std::strong_ordering operator<=>(const year& Left, const year& Right ) noexcept; // C++20
constexpr strong_ordering operator<=>(const year_month& Left, const year_month& Right) noexcept; // C++20
template<class Clock, class Duration1, three_way_comparable_with<Duration1> Duration2>
constexpr auto operator<=>(const time_point<Clock, Duration1>& Left, const time_point<Clock, Duration2>& Right); // C++20
template<class Rep1, class Period1, class Rep2, class Period2>
requires three_way_comparable<typename CT::rep>
constexpr auto operator<=>(const duration<Rep1, Period1>& Left, const duration<Rep2, Period2>& Right);
2)
constexpr strong_ordering operator<=>(const month_day_last& Left, const month_day_last& Right) noexcept;
3)
constexpr strong_ordering operator<=>(const year_month_day_last& Left, const year_month_day_last& Right) noexcept;
4)
strong_ordering operator<=>(const time_zone_link& Left, const time_zone_link& Right) noexcept;
Parametreler
Left
, Right
Karşılaştıracak day
, duration
, month_day
month
, month_day_last
, , time_point
, time_zone_link
, year
, year_month
, year_month_day
, year_month_day_last
.
Dönüş değeri
1)
0
eğer Left == Right
< 0
eğer Left < Right
> 0
eğer Left > Right
2)
Eşdeğeri: Left.month() <=> Right.month()
3)
Eşdeğeri:
if (auto c = Left.year() <=> Right.year(); c != 0) return c;
return Left.month_day_last() <=> Right.month_day_last();
4)
Eşdeğeri:
Left.name() <=> Right.name()
Örnek: operator<=>
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono; // for day and 'd' literals
int main()
{
day d1{3};
day d2{2};
if ((d1 <=> d2) == 0)
{
std::cout << "equal\n";
}
else if ((d1 <=> d2) < 0)
{
std::cout << "d1 < d2\n";
}
else if ((d1 <=> d2) > 0)
{
std::cout << "d1 > d2\n";
}
std::cout << std::boolalpha << (1d <= 1d) << ' ' << (1d != 2d) << ' ' << (2d > 3d);
return 0;
}
d1 < d2
true true false
operator<<
Bir akışa aşağıdaki türlerin çıkışını yapın:
day
file_time
gps_time
hh_mm_ss
local_time
local_info
month
month_day
month_day_last
month_weekday
month_weekday_last
sys_info
tai_time
utc_time
weekday
weekday_indexed
weekday_last
year
year_month
year_month_day
year_month_day_last
year_month_weekday
year_month_weekday_last
zoned_time
// 1) day
template <class CharT, class Traits>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const day& d); // C++20
// 2) hh_mm_ss
template<class CharT, class traits, class Duration>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const hh_mm_ss<Duration>& hms); // C++20
// 3) month
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const month& m); // C++20
// 4) month_day
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const month_day& md); // C++20
// 5) month_day_last
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const month_day_last& mdl); // C++20
// 6) month_weekday
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const month_weekday& mwd); // C++20
// 7) month_weekday_last
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const month_weekday_last& mwdl); // C++20
// 8) weekday
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const weekday& wd); // C++20
// 9) weekday_indexed
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const weekday_indexed& wdi); // C++20
// 10) weekday_last
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const weekday_last& wdl); // C++20
// 11) year
template <class CharT, class Traits>
std::basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const year& y); // C++20
// 12) year_month
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const year_month& ym); // C++20
// 13) year_month_day
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const year_month_day& ymd); // C++20
// 14) year_month_day_last
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const year_month_day_last& ymdl); // C++20
// 15) year_month_weekday
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const year_month_weekday& ymwd); // C++20
// 16) year_month_weekday_last
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const year_month_weekday_last& ymwdl); // C++20
// 17) tai_time
template<class CharT, class Traits, class Duration>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const tai_time<Duration>& t); // C++20
// 18) utc_time
template<class CharT, class Traits, class Duration>
basic_ostream<CharT, traits>&
operator<<(basic_ostream<CharT, Traits>& os, const utc_time<Duration>& t); // C++20
// 19) gps_time
template<class CharT, class Traits, class Duration>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const gps_time<Duration>& t); // C++20
// 20) local_time
template<class CharT, class Traits, class Duration>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const local_time<Duration>& t); // C++20
// 21) sys_info
template<class CharT, class Traits>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const sys_info& si);
// 22) local_info
template<class CharT, class Traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<CharT, Traits>& os, const local_info& li);
// 23) zoned_time
template<class CharT, class Traits, class Duration, class TimeZonePtr>
basic_ostream<CharT, Traits>&
operator<<(basic_ostream<CharT, Traits>& os, const zoned_time<Duration, TimeZonePtr>& zt);
Parametreler
CharT
Akıştan okunacak ve dizede depolanacak tek bir karakterin veri türü. C++ Standart Kitaplığı, bu sınıf şablonunun, için , wstring
u16string
wchar_t
, için char16_t
ve u32string
char32_t
için türündeki öğelerin tür char
tanımlarıyla string
birlikte uzmanlıklar sağlar.
Traits
CharT
ve basic_istream
uzmanlık özniteliklerini basic_string
açıklar.
os
Değerinin yayılabileceği day
çıkış akışı.
d
Çıkışa day
.
hms
Çıkışa hh_mm_ss
.
li
Çıkışa local_info
.
m
Çıkışa month
.
md
Çıkışa month_day
.
mdl
Çıkışa month_day_last
.
mwd
Çıkışa month_weekday
.
mwdl
Çıkışa month_weekday_last
.
si
Çıkışa sys_info
.
t
Çıkış local_time
için , gps_time
, tai_time
veya utc_time
.
TimeZonePtr
içinde depolanan time_zone işaretçisi.zoned_time
wd
Çıkışa weekday
.
wdi
Çıkışa weekday_indexed
.
wdl
Çıkışa weekday_last
.
y
Çıkışa year
.
ym
Çıkışa year_month
.
ymd
Çıkışa year_month_day
.
ymdl
Çıkışa year_month_day_last
.
ymwd
Çıkışa year_month_weekday
.
ymwdl
Çıkışa year_month_weekday_last
.
zt
Çıkışa zoned_time
.
Dönüş değeri
Geçirdiğiniz çıkış akışı, os
Açıklamalar
1) Değer day
ondalık sayı olarak çıkıştır ve sonuç tek basamaklı olursa başında sıfır olur. çıkışa "geçerli bir gün değil" ifadesi eklenirse !d.ok()
.
2) hh_mm_ss
Değer hours:minutes:seconds:thousandths of seconds olarak çıkıştır. Örneğin, "00:00:05.721
"
3) ile os
ilişkili yerel ayarı kullanan kısaltılmış ay adı çıktıdır. Örneğin, Jan
. " is not a valid month"
ise !m.ok()
çıkışa eklenir.
4) ile ilişkilendirilmiş os
yerel ayarın kullanıldığı, ardından tarihin kullanıldığı, sonucun tek basamaklı olması durumunda başında sıfır bulunan kısaltılmış ay adı çıkıştır. Örneğin, Jan/05
. ise !md.ok()
, " is not a valid month"
ayın çıkışına eklenebilir ve "is not a valid day"
günün çıkışına eklenebilir. Örneğin, 204 is not a valid month/204 is not a valid day
.
5) ile os
ilişkilendirilmiş yerel ayarın kullanıldığı kısaltılmış ay adı ve ardından /last
. Örneğin, Jan/last
.
6) ile os
ilişkilendirilmiş yerel ayarın kullanıldığı kısaltılmış hafta içi adı ve ayraç içinde temsil ettiği ayın n. hafta içi günü. Örneğin, Mon[1]
.
7) ile os
ilişkilendirilmiş yerel ayarı kullanan, ardından köşeli ayraç içinde temsil ettiği ayın son haftanın günü olan kısaltılmış hafta içi adı. Örneğin, Jan/Mon[last]
.
8) ile os
ilişkilendirilmiş yerel ayarı kullanan kısaltılmış haftanın günü adı çıktıdır. " is not a valid weekday"
ise !wd.ok()
çıkışa eklenir.
9) ile os
ilişkili yerel ayarı kullanan kısaltılmış hafta içi adı çıktıdır ve ayraç içinde ayın hafta içidir. Örneğin, Mon[3]
. ise !wd.ok()
, haftanın " is not a valid weekday"
günü çıkışına eklenebilir ve "is not a valid index"
hafta içi dizin çıkışına eklenebilir.
10) bir ayın son hafta günü, ile os
ilişkilendirilmiş yerel ayar kullanılarak çıkış, ardından [last]
ve ardından tarih kullanılır. Örneğin, Tue[last] 2019-10-29
. ise !wd.ok()
, haftanın " is not a valid weekday"
günü çıkışına eklenebilir ve "is not a valid index"
hafta içi dizin çıkışına eklenebilir.
11) Sonuç bundan küçükse yıl 0 (sıfır) ile dört basamak arası sola doldurulur. " is not a valid year"
ise !y.ok()
çıkışa eklenir.
12) year_month
yyy-mm-dd biçiminde çıkıştır. döndürürse ym.ok
false
" is not a valid date"
eklenir.
13) year_month_day
y-mm-dd biçiminde çıkıştır. döndürürse ymd.ok
false
" is not a valid date"
eklenir.
14) year_month_day_last
yy/month/last biçiminde çıktıdır. Örneğin, 2020/May/last
.
15) year_month_weekday
yyyy/month/weekday[index] biçiminde çıktıdır. Örneğin 1996/Jan/Wed[1]
16) year_month_weekday_last
yyyy/month/weekday[last] biçiminde çıktıdır. Örneğin 1996/Jan/Wed[last]
17) tai_time
yyyy-mm-dd hh:mm:ss.sss biçiminde çıkıştır. Örneğin 2021-08-13 23:23:08.4358666
18) utc_time
yyyy-mm-dd hh:mm:ss.ss biçiminde çıkıştır. Örneğin 2021-08-13 23:23:08.4358666
19) gps_time
yyyy-mm-dd hh:mm:ss.ss biçiminde çıkıştır. Örneğin 2021-08-13 23:23:08.4358666
20) çıkış local_time
, saatin devrinden bu yana geçen saniye sayısıdır. tarafından çıktısını alır os << std::chrono::sys_time<Duration>(some_local_time.time_since_epoch());
. Örneğin, some_local_time
18 Ağustos 2021 15:13 ise çıkış olur 1597792380
.
21) Microsoft'un uygulamasında , , offset
end
, save
ve abbrev
alanları olarak begin
bir sys_info
çıktıdır. Örneğin: begin: 2021-03-14 10:00:00, end: 2021-11-07 09:00:00, offset: -25200s, save: 60min, abbrev: PDT
22) Microsoft'un uygulamasında, a local_info
yyyy-mm-dd hh:mm::ss.ss olarak çıktıdır. Örneğin 2021-09-17 13:55:59.6590120
23) içindeki zoned_time
yerel saat (olarak zt.get_local_time()
elde edilir) yyyy-mm-dd hh:mm:ss saat dilimi kullanılarak çıkıştır. Örneğin 2021-09-15 10:45:00 GMT-6
Örnek: operator<<
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main()
{
std::cout << utc_clock::now() << '\n';
year_month ym{ 2021y / April };
std::cout << ym;
return 0;
}
2021-08-16 20:47:05.6299822
2021/Apr
operator modulo
üzerinde duration
modulo işlemleri için işleç.
1)
template <class Rep1, class Period1, class Rep2>
constexpr duration<Rep1, Period1, Rep2>::type
operator%(
const duration<Rep1, Period1>& Dur,
const Rep2& Div);
2)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr typename common_type<duration<Rep1, _Period1>, duration<Rep2, Period2>>::type
operator%(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
Parametreler
Dur
Bir duration
nesnesi.
Div
İntegral değer.
Left
Kar payı. Bölme bölen tarafından bölündükten sonra kalan moddur.
Right
Doğru duration
nesne, bölen.
Dönüş değeri
1) Aralık uzunluğu modulo Div
olan Dur
bir duration
nesne döndürür.
2) modulo Right
değerini temsil Left
eden bir değer döndürür.
duration
için operator/
Nesneler için duration
bölme işleci.
1)
template <class Rep1, class Period1, class Rep2>
constexpr duration<typename common_type<Rep1, Rep2>::type, Period1>
operator/(
const duration<Rep1, Period1>& Dur,
const Rep2& Div);
2)
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr typename common_type<Rep1, Rep2>::type
operator/(
const duration<Rep1, Period1>& Left,
const duration<Rep2, Period2>& Right);
Parametreler
Dur
Bir duration
nesnesi.
Div
İntegral değer.
Left
\w Sol duration
nesne.
Right
Doğru duration
nesne.
Dönüş değeri
1) Aralık uzunluğu değerine Div
bölünen uzunluk Dur
olan bir süre nesnesi.
2) ve Right
aralık uzunluklarının Left
oranı.
True tutmadığı ve Rep2
örneğini duration
oluşturmadığı süreceis_convertible<Rep2, common_type<Rep1, Rep2>>
, ilk işleç aşırı yükleme çözümlemesine katılmaz. Daha fazla bilgi için bkz <. type_traits>.
operator/
takvim tarihleri için
Aşağıdaki formlarda takvim tarihleri oluşturmak için söz dizimi sağlar:
ay/gün/yıl
gün/ay/yıl
yıl/ay/gün
Gün değerini şununla değiştirebilirsiniz:
last
weekday[n]
ayın n. günü için
weekday[last]
ayın son weekday
ayı için.
Kısmi tarihler aşağıdaki gibi oluşturulabilir:
year_month ym = 2015y/April;
month_day md1 = April/4;
month_day md2 = 4d/April;
Yorumlama belirsiz olmadığı sürece tamsayılar kullanılabilir.
///////// returns year_month
// 1
constexpr year_month
operator/(const year& y, const month& m) noexcept; // C++20
// 2
constexpr year_month
operator/(const year& y, int m) noexcept; // C++20
///////// returns month_day
// 3
constexpr month_day
operator/(const month& m, const day& d) noexcept; // C++20
// 4
constexpr month_day
operator/(const month& m, int d) noexcept; // C++20
// 5
constexpr month_day
operator/(int m, const day& d) noexcept; // C++20
// 6
constexpr month_day
operator/(const day& d, const month& m) noexcept; // C++20
// 7
constexpr month_day
operator/(const day& d, int m) noexcept; // C++20
///////// returns month_day_last
// 8
constexpr month_day_last
operator/(const month& m, last_spec) noexcept; // C++20
// 9
constexpr month_day_last
operator/(int m, last_spec) noexcept; // C++20
// 10
constexpr month_day_last
operator/(last_spec, const month& m) noexcept; // C++20
// 11
constexpr month_day_last
operator/(last_spec, int m) noexcept; // C++20
///////// returns month_weekday
// 12
constexpr month_weekday
operator/(const month& m, const weekday_indexed& wdi) noexcept; // C++20
// 13
constexpr month_weekday
operator/(int m, const weekday_indexed& wdi) noexcept; // C++20
// 14
constexpr month_weekday
operator/(const weekday_indexed& wdi, const month& m) noexcept; // C++20
// 15
constexpr month_weekday
operator/(const weekday_indexed& wdi, int m) noexcept; // C++20
///////// returns month_weekday_last
// 16
constexpr month_weekday_last
operator/(const month& m, const weekday_last& wdl) noexcept; // C++20
// 17
constexpr month_weekday_last
operator/(int m, const weekday_last& wdl) noexcept; // C++20
// 18
constexpr month_weekday_last
operator/(const weekday_last& wdl, const month& m) noexcept; // C++20
// 19
constexpr month_weekday_last
operator/(const weekday_last& wdl, int m) noexcept; // C++20
///////// returns year_month_day
// 20
constexpr year_month_day
operator/(const year_month& ym, const day& d) noexcept; // C++20
// 21
constexpr year_month_day
operator/(const year_month& ym, int d) noexcept; // C++20
// 22
constexpr year_month_day
operator/(const year& y, const month_day& md) noexcept; // C++20
// 23
constexpr year_month_day
operator/(int y, const month_day& md) noexcept; // C++20
// 24
constexpr year_month_day
operator/(const month_day& md, const year& y) noexcept; // C++20
// 25
constexpr year_month_day
operator/(const month_day& md, int y) noexcept; // C++20
///////// returns year_month_day_last
// 26
constexpr year_month_day_last
operator/(const year_month& ym, last_spec) noexcept; // C++20
// 27
constexpr year_month_day_last
operator/(const year& y, const month_day_last& mdl) noexcept; // C++20
// 28
constexpr year_month_day_last
operator/(int y, const month_day_last& mdl) noexcept; // C++20
// 29
constexpr year_month_day_last
operator/(const month_day_last& mdl, const year& y) noexcept; // C++20
// 30
constexpr year_month_day_last
operator/(const month_day_last& mdl, int y) noexcept; // C++20
///////// returns year_month_weekday
// 31
constexpr year_month_weekday
operator/(const year_month& ym, const weekday_indexed& wdi) noexcept; // C++20
// 32
constexpr year_month_weekday
operator/(const year& y, const month_weekday& mwd) noexcept; // C++20
// 33
constexpr year_month_weekday
operator/(int y, const month_weekday& mwd) noexcept; // C++20
// 34
constexpr year_month_weekday
operator/(const month_weekday& mwd, const year& y) noexcept; // C++20
// 35
constexpr year_month_weekday
operator/(const month_weekday& mwd, int y) noexcept; // C++20
///////// returns year_month_weekday_last
// 36
constexpr year_month_weekday_last
operator/(const year_month& ym, const weekday_last& wdl) noexcept; // C++20
// 37
constexpr year_month_weekday_last
operator/(const year& y, const month_weekday_last& mwdl) noexcept; // C++20
// 38
constexpr year_month_weekday_last
operator/(int y, const month_weekday_last& mwdl) noexcept; // C++20
// 39
constexpr year_month_weekday_last
operator/(const month_weekday_last& mwdl, const year& y) noexcept; // C++20
// 40
constexpr year_month_weekday_last
operator/(const month_weekday_last& mwdl, int y) noexcept; // C++20
Parametreler
d
O gün. [1,31] aralığında tamsayı olarak veya olarak day
sağlanır.
lastspec
Dizideki son öğeyi gösteren boş bir etiket türü. Örneğin, 2021y/May/last
Mayıs 2021'in son günüdür.
m
Ay. [1,12] aralığında tamsayı olarak veya olarak month
sağlanır.
md
Ay ve gün.
mdl
Belirtilen ayın son günü.
mwd
Belirtilen ayın n. hafta içi günü.
mwdl
Belirtilen ayın son hafta günü.
wdi
Hafta içi dizini (weekday_indexed
). Örneğin, weekday_indexed(Monday, 1)
ayın ilk Pazartesi günüdür.
wdl
Ayın son haftası. Örneğin, Monday[last]
ayın son Pazartesi günüdür.
y
Yıl. Tamsayı veya olarak year
sağlanır.
ym
Yıl ve ay.
Dönüş değeri
1) year_month(y, m)
2) year_month(y, month(m))
3) month_day(m, d)
4) month_day(m, day(d))
5) month_day(month(m), d)
6) month_day(m, d)
7) month_day(month(m), d)
8) month_day_last(m)
9) month_day_last(month(m))
10) month_day_last(m)
11) month_day_last(month(m))
12) month_weekday(m, wdi)
13) month_weekday(month(m), wdi)
14) month_weekday(m, wdi)
15) month_weekday(month(m), wdi)
16) month_weekday_last(m, wdl)
17) month_weekday_last(month(m), wdl)
18) month_weekday_last(m, wdl)
19) month_weekday_last(month(m), wdl)
20) year_month_day(ym.year(), ym.month(), d)
21) year_month_day(ym.year(), ym.month(), day(d))
22) year_month_day(y, md.month(), md.day())
23) year_month_day(year(y), md.month(), md.day())
24) year_month_day(y, md.month(), md.day())
25) year_month_day(year(y), md.month(), md.day())
26) year_month_day_last(ym.year(), month_day_last(ym.month()))
27) year_month_day_last(y, mdl)
28) year_month_day_last(year(y), mdl)
29) year_month_day_last(y, mdl)
30) year_month_day_last(year(y), mdl)
31) year_month_weekday(ym.year(), ym.month(), wdi)
32) year_month_weekday(y, mwd.month(), mwd.weekday_indexed())
33) year_month_weekday(year(y), mwd.month(), mwd.weekday_indexed())
34) year_month_weekday(y, mwd.month(), mwd.weekday_indexed())
35) year_month_weekday(year(y), mwd.month(), mwd.weekday_indexed())
36) year_month_weekday_last(ym.year(), ym.month(), wdl)
37) year_month_weekday_last(y, mwdl.month(), mwdl.weekday_last())
38) year_month_weekday_last(year(y), mwdl.month(), mwdl.weekday_last())
39) year_month_weekday_last(y, mwdl.month(), mwdl.weekday_last())
40) year_month_weekday_last(year(y), mwdl.month(), mwdl.weekday_last())
Örnek: operator/
takvim tarihleri için
// compile using: /std:c++latest
#include <iostream>
#include <chrono>
using namespace std::chrono;
int main()
{
month m{ July }; // Jul
month_day md{ April / 4 }; // Apr/04
month_day md2{ 4d / April }; // Apr/04
month_day_last mdl{ January / last }; // Jan/last
month_weekday mw{ 11 / Monday[1] }; // Nov/Mon[1]
month_weekday_last mwl{ January / Monday[last] }; // Jan/Mon[last]
weekday wd{ Monday }; // Mon
weekday_indexed wdi{ Monday, 1 }; // Mon[1]
year_month ym{ 2021y / April }; // 2021/Apr
year_month_day ymd{ January / 1d / 2021y }; // 2021-01-01
year_month_day ymd2{ 2021y / 5 / 7 }; // 2021-05-07
year_month_day_last ymdl{ April / last / 1975 }; // 1975/Apr/last
year_month_weekday ymw{ 1997y / January / Wednesday[1] }; // 1997/Jan/Wed[1]
year_month_weekday_last ymwl{ 1997y / January / Wednesday[last] }; // 1997/Jan/Wed[last]
int yearValue{ 2021 / 4 / 4 }; // 126
std::cout << m << '\n' << md << '\n' << md2 << '\n' << mdl << '\n' << mw
<< '\n' << mwl << '\n' << wd << '\n' << wdi << '\n'
<< ym << '\n' << ymd << '\n' << ymd2 << '\n' << ymdl
<< '\n' << ymw << '\n' << ymwl << '\n' << yearValue;
return 0;
}
Jul
Apr/04
Apr/04
Jan/last
Nov/Mon[1]
Jan/Mon[last]
Mon
Mon[1]
2021/Apr
2021-01-01
2021-05-07
1975/Apr/last
1997/Jan/Wed[1]
1997/Jan/Wed[last]
126
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin