From Jason Turner

[time.duration.literals]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpigwp17ap/{from.md → to.md} +11 -7
tmp/tmpigwp17ap/{from.md → to.md} RENAMED
@@ -4,27 +4,31 @@ This section describes literal suffixes for constructing duration
4
  literals. The suffixes `h`, `min`, `s`, `ms`, `us`, `ns` denote duration
5
  values of the corresponding types `hours`, `minutes`, `seconds`,
6
  `milliseconds`, `microseconds`, and `nanoseconds` respectively if they
7
  are applied to integral literals.
8
 
9
- If any of these suffixes are applied to a floating point literal the
10
- result is a `chrono::duration` literal with an unspecified floating
11
- point representation.
12
 
13
  If any of these suffixes are applied to an integer literal and the
14
  resulting `chrono::duration` value cannot be represented in the result
15
  type because of overflow, the program is ill-formed.
16
 
 
 
17
  The following code shows some duration literals.
18
 
19
  ``` cpp
20
  using namespace std::chrono_literals;
21
  auto constexpr aday=24h;
22
  auto constexpr lesson=45min;
23
  auto constexpr halfanhour=0.5h;
24
  ```
25
 
 
 
26
  ``` cpp
27
  constexpr chrono::hours operator""h(unsigned long long hours);
28
  constexpr chrono::duration<unspecified, ratio<3600, 1>> operator""h(long double hours);
29
  ```
30
 
@@ -36,19 +40,19 @@ constexpr chrono::duration<unspecified, ratio<60,1>> operator "" min(long double
36
  ```
37
 
38
  *Returns:* A `duration` literal representing `minutes` minutes.
39
 
40
  ``` cpp
41
- constexpr chrono::seconds operator "" s(unsigned long long sec);
42
  constexpr chrono::duration<unspecified> operator""s(long double sec);
43
  ```
44
 
45
  *Returns:* A `duration` literal representing `sec` seconds.
46
 
47
- The same suffix `s` is used for `basic_string` but there is no conflict,
48
- since duration suffixes apply to numbers and string literal suffixes
49
- apply to character array literals.
50
 
51
  ``` cpp
52
  constexpr chrono::milliseconds operator""ms(unsigned long long msec);
53
  constexpr chrono::duration<unspecified, milli> operator""ms(long double msec);
54
  ```
 
4
  literals. The suffixes `h`, `min`, `s`, `ms`, `us`, `ns` denote duration
5
  values of the corresponding types `hours`, `minutes`, `seconds`,
6
  `milliseconds`, `microseconds`, and `nanoseconds` respectively if they
7
  are applied to integral literals.
8
 
9
+ If any of these suffixes are applied to a floating-point literal the
10
+ result is a `chrono::duration` literal with an unspecified
11
+ floating-point representation.
12
 
13
  If any of these suffixes are applied to an integer literal and the
14
  resulting `chrono::duration` value cannot be represented in the result
15
  type because of overflow, the program is ill-formed.
16
 
17
+ [*Example 1*:
18
+
19
  The following code shows some duration literals.
20
 
21
  ``` cpp
22
  using namespace std::chrono_literals;
23
  auto constexpr aday=24h;
24
  auto constexpr lesson=45min;
25
  auto constexpr halfanhour=0.5h;
26
  ```
27
 
28
+ — *end example*]
29
+
30
  ``` cpp
31
  constexpr chrono::hours operator""h(unsigned long long hours);
32
  constexpr chrono::duration<unspecified, ratio<3600, 1>> operator""h(long double hours);
33
  ```
34
 
 
40
  ```
41
 
42
  *Returns:* A `duration` literal representing `minutes` minutes.
43
 
44
  ``` cpp
45
+ constexpr chrono::seconds \itcorr operator""s(unsigned long long sec);
46
  constexpr chrono::duration<unspecified> operator""s(long double sec);
47
  ```
48
 
49
  *Returns:* A `duration` literal representing `sec` seconds.
50
 
51
+ [*Note 1*: The same suffix `s` is used for `basic_string` but there is
52
+ no conflict, since duration suffixes apply to numbers and string literal
53
+ suffixes apply to character array literals. — *end note*]
54
 
55
  ``` cpp
56
  constexpr chrono::milliseconds operator""ms(unsigned long long msec);
57
  constexpr chrono::duration<unspecified, milli> operator""ms(long double msec);
58
  ```