tmp/tmpk8u69ozq/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Parsing <a id="time.parse">[[time.parse]]</a>
|
| 2 |
+
|
| 3 |
+
Each `parse` overload specified in this subclause calls `from_stream`
|
| 4 |
+
unqualified, so as to enable argument dependent lookup
|
| 5 |
+
[[basic.lookup.argdep]]. In the following paragraphs, let `is` denote an
|
| 6 |
+
object of type `basic_istream<charT, traits>` and let `I` be
|
| 7 |
+
`basic_istream<charT, traits>&`, where `charT` and `traits` are template
|
| 8 |
+
parameters in that context.
|
| 9 |
+
|
| 10 |
+
``` cpp
|
| 11 |
+
template<class charT, class traits, class Alloc, class Parsable>
|
| 12 |
+
unspecified
|
| 13 |
+
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp);
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
*Constraints:* The expression
|
| 17 |
+
|
| 18 |
+
``` cpp
|
| 19 |
+
from_stream(declval<basic_istream<charT, traits>&>(), fmt.c_str(), tp)
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
is well-formed when treated as an unevaluated operand.
|
| 23 |
+
|
| 24 |
+
*Returns:* A manipulator such that the expression `is >> parse(fmt, tp)`
|
| 25 |
+
has type `I`, has value `is`, and calls
|
| 26 |
+
`from_stream(is, fmt.c_str(), tp)`.
|
| 27 |
+
|
| 28 |
+
``` cpp
|
| 29 |
+
template<class charT, class traits, class Alloc, class Parsable>
|
| 30 |
+
unspecified
|
| 31 |
+
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
|
| 32 |
+
basic_string<charT, traits, Alloc>& abbrev);
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
*Constraints:* The expression
|
| 36 |
+
|
| 37 |
+
``` cpp
|
| 38 |
+
from_stream(declval<basic_istream<charT, traits>&>(), fmt.c_str(), tp, addressof(abbrev))
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
is well-formed when treated as an unevaluated operand.
|
| 42 |
+
|
| 43 |
+
*Returns:* A manipulator such that the expression
|
| 44 |
+
`is >> parse(fmt, tp, abbrev)` has type `I`, has value `is`, and calls
|
| 45 |
+
`from_stream(is, fmt.c_str(), tp, addressof(abbrev))`.
|
| 46 |
+
|
| 47 |
+
``` cpp
|
| 48 |
+
template<class charT, class traits, class Alloc, class Parsable>
|
| 49 |
+
unspecified
|
| 50 |
+
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
|
| 51 |
+
minutes& offset);
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
*Constraints:* The expression
|
| 55 |
+
|
| 56 |
+
``` cpp
|
| 57 |
+
from_stream(declval<basic_istream<charT, traits>&>(),
|
| 58 |
+
fmt.c_str(), tp,
|
| 59 |
+
declval<basic_string<charT, traits, Alloc>*>(),
|
| 60 |
+
&offset)
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
is well-formed when treated as an unevaluated operand.
|
| 64 |
+
|
| 65 |
+
*Returns:* A manipulator such that the expression
|
| 66 |
+
`is >> parse(fmt, tp, offset)` has type `I`, has value `is`, and calls:
|
| 67 |
+
|
| 68 |
+
``` cpp
|
| 69 |
+
from_stream(is,
|
| 70 |
+
fmt.c_str(), tp,
|
| 71 |
+
static_cast<basic_string<charT, traits, Alloc>*>(nullptr),
|
| 72 |
+
&offset)
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
``` cpp
|
| 76 |
+
template<class charT, class traits, class Alloc, class Parsable>
|
| 77 |
+
unspecified
|
| 78 |
+
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
|
| 79 |
+
basic_string<charT, traits, Alloc>& abbrev, minutes& offset);
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
*Constraints:* The expression
|
| 83 |
+
|
| 84 |
+
``` cpp
|
| 85 |
+
from_stream(declval<basic_istream<charT, traits>&>(),
|
| 86 |
+
fmt.c_str(), tp, addressof(abbrev), &offset)
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
is well-formed when treated as an unevaluated operand.
|
| 90 |
+
|
| 91 |
+
*Returns:* A manipulator such that the expression
|
| 92 |
+
`is >> parse(fmt, tp, abbrev, offset)` has type `I`, has value `is`, and
|
| 93 |
+
calls `from_stream(is, fmt.c_str(), tp, addressof(abbrev), &offset)`.
|
| 94 |
+
|
| 95 |
+
All `from_stream` overloads behave as unformatted input functions,
|
| 96 |
+
except that they have an unspecified effect on the value returned by
|
| 97 |
+
subsequent calls to `basic_istream<>::gcount()`. Each overload takes a
|
| 98 |
+
format string containing ordinary characters and flags which have
|
| 99 |
+
special meaning. Each flag begins with a `%`. Some flags can be modified
|
| 100 |
+
by `E` or `O`. During parsing each flag interprets characters as parts
|
| 101 |
+
of date and time types according to [[time.parse.spec]]. Some flags can
|
| 102 |
+
be modified by a width parameter given as a positive decimal integer
|
| 103 |
+
called out as `N` below which governs how many characters are parsed
|
| 104 |
+
from the stream in interpreting the flag. All characters in the format
|
| 105 |
+
string that are not represented in [[time.parse.spec]], except for
|
| 106 |
+
white space, are parsed unchanged from the stream. A white space
|
| 107 |
+
character matches zero or more white space characters in the input
|
| 108 |
+
stream.
|
| 109 |
+
|
| 110 |
+
If the type being parsed cannot represent the information that the
|
| 111 |
+
format flag refers to, `is.setstate(ios_base::failbit)` is called.
|
| 112 |
+
|
| 113 |
+
[*Example 1*: A `duration` cannot represent a
|
| 114 |
+
`weekday`. — *end example*]
|
| 115 |
+
|
| 116 |
+
However, if a flag refers to a “time of day” (e.g. `%H`, `%I`, `%p`,
|
| 117 |
+
etc.), then a specialization of `duration` is parsed as the time of day
|
| 118 |
+
elapsed since midnight.
|
| 119 |
+
|
| 120 |
+
If the `from_stream` overload fails to parse everything specified by the
|
| 121 |
+
format string, or if insufficient information is parsed to specify a
|
| 122 |
+
complete duration, time point, or calendrical data structure,
|
| 123 |
+
`setstate(ios_base::failbit)` is called on the `basic_istream`.
|
| 124 |
+
|
| 125 |
+
[*Note 1*: `%n`, `%t`, and a space can be combined to match a wide
|
| 126 |
+
range of white-space patterns. For example, `"%n "` matches one or more
|
| 127 |
+
white space characters, and `"%n%t%t"` matches one to three white space
|
| 128 |
+
characters. — *end note*]
|
| 129 |
+
|