Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:15

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CHRONO_MONTH_WEEKDAY_H
0011 #define _LIBCPP___CHRONO_MONTH_WEEKDAY_H
0012 
0013 #include <__chrono/month.h>
0014 #include <__chrono/weekday.h>
0015 #include <__config>
0016 
0017 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0018 #  pragma GCC system_header
0019 #endif
0020 
0021 #if _LIBCPP_STD_VER >= 20
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 namespace chrono {
0026 
0027 class month_weekday {
0028 private:
0029   chrono::month __m_;
0030   chrono::weekday_indexed __wdi_;
0031 
0032 public:
0033   _LIBCPP_HIDE_FROM_ABI constexpr month_weekday(const chrono::month& __mval,
0034                                                 const chrono::weekday_indexed& __wdival) noexcept
0035       : __m_{__mval}, __wdi_{__wdival} {}
0036   _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
0037   _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi_; }
0038   _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdi_.ok(); }
0039 };
0040 
0041 _LIBCPP_HIDE_FROM_ABI inline constexpr bool
0042 operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept {
0043   return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed();
0044 }
0045 
0046 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
0047 operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept {
0048   return month_weekday{__lhs, __rhs};
0049 }
0050 
0051 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept {
0052   return month_weekday{month(__lhs), __rhs};
0053 }
0054 
0055 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday
0056 operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept {
0057   return month_weekday{__rhs, __lhs};
0058 }
0059 
0060 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept {
0061   return month_weekday{month(__rhs), __lhs};
0062 }
0063 
0064 class month_weekday_last {
0065   chrono::month __m_;
0066   chrono::weekday_last __wdl_;
0067 
0068 public:
0069   _LIBCPP_HIDE_FROM_ABI constexpr month_weekday_last(const chrono::month& __mval,
0070                                                      const chrono::weekday_last& __wdlval) noexcept
0071       : __m_{__mval}, __wdl_{__wdlval} {}
0072   _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::month month() const noexcept { return __m_; }
0073   _LIBCPP_HIDE_FROM_ABI inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl_; }
0074   _LIBCPP_HIDE_FROM_ABI inline constexpr bool ok() const noexcept { return __m_.ok() && __wdl_.ok(); }
0075 };
0076 
0077 _LIBCPP_HIDE_FROM_ABI inline constexpr bool
0078 operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept {
0079   return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last();
0080 }
0081 
0082 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
0083 operator/(const month& __lhs, const weekday_last& __rhs) noexcept {
0084   return month_weekday_last{__lhs, __rhs};
0085 }
0086 
0087 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept {
0088   return month_weekday_last{month(__lhs), __rhs};
0089 }
0090 
0091 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last
0092 operator/(const weekday_last& __lhs, const month& __rhs) noexcept {
0093   return month_weekday_last{__rhs, __lhs};
0094 }
0095 
0096 _LIBCPP_HIDE_FROM_ABI inline constexpr month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept {
0097   return month_weekday_last{month(__rhs), __lhs};
0098 }
0099 } // namespace chrono
0100 
0101 _LIBCPP_END_NAMESPACE_STD
0102 
0103 #endif // _LIBCPP_STD_VER >= 20
0104 
0105 #endif // _LIBCPP___CHRONO_MONTH_WEEKDAY_H