tmp/tmp0w08c1js/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Class `weekday_indexed` <a id="time.cal.wdidx">[[time.cal.wdidx]]</a>
|
| 2 |
+
|
| 3 |
+
#### Overview <a id="time.cal.wdidx.overview">[[time.cal.wdidx.overview]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
namespace std::chrono {
|
| 7 |
+
class weekday_indexed {
|
| 8 |
+
chrono::weekday wd_; // exposition only
|
| 9 |
+
unsigned char index_; // exposition only
|
| 10 |
+
|
| 11 |
+
public:
|
| 12 |
+
weekday_indexed() = default;
|
| 13 |
+
constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
|
| 14 |
+
|
| 15 |
+
constexpr chrono::weekday weekday() const noexcept;
|
| 16 |
+
constexpr unsigned index() const noexcept;
|
| 17 |
+
constexpr bool ok() const noexcept;
|
| 18 |
+
};
|
| 19 |
+
}
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
`weekday_indexed` represents a `weekday` and a small index in the range
|
| 23 |
+
1 to 5. This class is used to represent the first, second, third,
|
| 24 |
+
fourth, or fifth weekday of a month.
|
| 25 |
+
|
| 26 |
+
[*Note 1*: A `weekday_indexed` object can be constructed by indexing a
|
| 27 |
+
`weekday` with an `unsigned`. — *end note*]
|
| 28 |
+
|
| 29 |
+
[*Example 1*:
|
| 30 |
+
|
| 31 |
+
``` cpp
|
| 32 |
+
constexpr auto wdi = Sunday[2]; // wdi is the second Sunday of an as yet unspecified month
|
| 33 |
+
static_assert(wdi.weekday() == Sunday);
|
| 34 |
+
static_assert(wdi.index() == 2);
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
— *end example*]
|
| 38 |
+
|
| 39 |
+
`weekday_indexed` is a trivially copyable and standard-layout class
|
| 40 |
+
type.
|
| 41 |
+
|
| 42 |
+
#### Member functions <a id="time.cal.wdidx.members">[[time.cal.wdidx.members]]</a>
|
| 43 |
+
|
| 44 |
+
``` cpp
|
| 45 |
+
constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
*Effects:* Initializes `wd_` with `wd` and `index_` with `index`. The
|
| 49 |
+
values held are unspecified if `!wd.ok()` or `index` is not in the range
|
| 50 |
+
\[`0`, `7`\].
|
| 51 |
+
|
| 52 |
+
``` cpp
|
| 53 |
+
constexpr chrono::weekday weekday() const noexcept;
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
*Returns:* `wd_`.
|
| 57 |
+
|
| 58 |
+
``` cpp
|
| 59 |
+
constexpr unsigned index() const noexcept;
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
*Returns:* `index_`.
|
| 63 |
+
|
| 64 |
+
``` cpp
|
| 65 |
+
constexpr bool ok() const noexcept;
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
*Returns:* `wd_.ok() && 1 <= index_ && index_ <= 5`.
|
| 69 |
+
|
| 70 |
+
#### Non-member functions <a id="time.cal.wdidx.nonmembers">[[time.cal.wdidx.nonmembers]]</a>
|
| 71 |
+
|
| 72 |
+
``` cpp
|
| 73 |
+
constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
*Returns:* `x.weekday() == y.weekday() && x.index() == y.index()`.
|
| 77 |
+
|
| 78 |
+
``` cpp
|
| 79 |
+
template<class charT, class traits>
|
| 80 |
+
basic_ostream<charT, traits>&
|
| 81 |
+
operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi);
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
*Effects:* Equivalent to:
|
| 85 |
+
|
| 86 |
+
``` cpp
|
| 87 |
+
auto i = wdi.index();
|
| 88 |
+
return os << (i >= 1 && i <= 5 ?
|
| 89 |
+
format(os.getloc(), STATICALLY-WIDEN<charT>("{}[{}]"), wdi.weekday(), i) :
|
| 90 |
+
format(os.getloc(), STATICALLY-WIDEN<charT>("{}[{} is not a valid index]"),
|
| 91 |
+
wdi.weekday(), i));
|
| 92 |
+
```
|
| 93 |
+
|