Skip to content

Commit ddab348

Browse files
committed
P0548R1 common_type and duration
1 parent 49caa2b commit ddab348

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

source/utilities.tex

+10-13
Original file line numberDiff line numberDiff line change
@@ -16776,7 +16776,8 @@
1677616776
\item If \tcode{sizeof...(T)} is one, let \tcode{T0} denote the sole type
1677716777
constituting the pack \tcode{T}.
1677816778
The member \grammarterm{typedef-name} \tcode{type} shall denote the same
16779-
type as \tcode{decay_t<T0>}.
16779+
type, if any, as \tcode{common_type_t<T0, T0>};
16780+
otherwise there shall be no member \tcode{type}.
1678016781

1678116782
\item If \tcode{sizeof...(T)} is two,
1678216783
let the first and second types constituting \tcode{T} be denoted
@@ -16798,10 +16799,6 @@
1679816799
In either case, the member \grammarterm{typedef-name} \tcode{type} shall denote
1679916800
the same type, if any, as \tcode{C}.
1680016801
Otherwise, there shall be no member \tcode{type}.
16801-
\begin{note}
16802-
When \tcode{is_same_v<T1, T2>} is \tcode{true},
16803-
the effect is equivalent to that of \tcode{common_type<T1>}.
16804-
\end{note}
1680516802

1680616803
\item If \tcode{sizeof...(T)} is greater than two,
1680716804
let \tcode{T1}, \tcode{T2}, and \tcode{R}, respectively,
@@ -16816,7 +16813,7 @@
1681616813
Note B: Notwithstanding the provisions of \ref{meta.type.synop}, and
1681716814
pursuant to \ref{namespace.std},
1681816815
a program may specialize \tcode{common_type<T1, T2>}
16819-
for distinct types \tcode{T1} and \tcode{T2} such that
16816+
for types \tcode{T1} and \tcode{T2} such that
1682016817
\tcode{is_same_v<T1, decay_t<T1>>} and
1682116818
\tcode{is_same_v<T2, decay_t<T2>>} are each \tcode{true}.
1682216819
\begin{note}
@@ -17629,7 +17626,7 @@
1762917626
class duration {
1763017627
public:
1763117628
using rep = Rep;
17632-
using period = Period;
17629+
using period = typename Period::type;
1763317630
private:
1763417631
rep rep_; // \expos
1763517632
public:
@@ -17647,8 +17644,8 @@
1764717644
constexpr rep count() const;
1764817645

1764917646
// \ref{time.duration.arithmetic}, arithmetic
17650-
constexpr duration operator+() const;
17651-
constexpr duration operator-() const;
17647+
constexpr common_type_t<duration> operator+() const;
17648+
constexpr common_type_t<duration> operator-() const;
1765217649
constexpr duration& operator++();
1765317650
constexpr duration operator++(int);
1765417651
constexpr duration& operator--();
@@ -17774,22 +17771,22 @@
1777417771

1777517772
\indexlibrarymember{operator+}{duration}%
1777617773
\begin{itemdecl}
17777-
constexpr duration operator+() const;
17774+
constexpr common_type_t<duration> operator+() const;
1777817775
\end{itemdecl}
1777917776

1778017777
\begin{itemdescr}
1778117778
\pnum
17782-
\returns \tcode{*this}.
17779+
\returns \tcode{common_type_t<duration>(*this)}.
1778317780
\end{itemdescr}
1778417781

1778517782
\indexlibrarymember{operator-}{duration}%
1778617783
\begin{itemdecl}
17787-
constexpr duration operator-() const;
17784+
constexpr common_type_t<duration> operator-() const;
1778817785
\end{itemdecl}
1778917786

1779017787
\begin{itemdescr}
1779117788
\pnum
17792-
\returns \tcode{duration(-rep_)}.
17789+
\returns \tcode{common_type_t<duration>(-rep_)}.
1779317790
\end{itemdescr}
1779417791

1779517792
\indexlibrarymember{operator++}{duration}%

0 commit comments

Comments
 (0)