Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 59d041e

Browse files
committed
NB US-15 (C++14 CD): Use the _t form of type traits.
Throughout the text, replace uses of traits of the form typename decay<T>::type with the shorter form decay_t<T> using the alias templates introduced in the CD. Do this for all type traits with such aliases. Closes #178.
1 parent afd1e4f commit 59d041e

File tree

2 files changed

+55
-57
lines changed

2 files changed

+55
-57
lines changed

source/threads.tex

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
result, where \tcode{decay_copy} is defined as follows:
277277

278278
\begin{codeblock}
279-
template <class T> typename decay<T>::type decay_copy(T&& v)
279+
template <class T> decay_t<T> decay_copy(T&& v)
280280
{ return std::forward<T>(v); }
281281
\end{codeblock}
282282

@@ -3506,10 +3506,10 @@
35063506
struct uses_allocator<packaged_task<R>, Alloc>;
35073507

35083508
template <class F, class... Args>
3509-
future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
3509+
future<result_of_t<decay_t<F>(decay_t<Args>...)>>
35103510
async(F&& f, Args&&... args);
35113511
template <class F, class... Args>
3512-
future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
3512+
future<result_of_t<decay_t<F>(decay_t<Args>...)>>
35133513
async(launch policy, F&& f, Args&&... args);
35143514
}
35153515
\end{codeblock}
@@ -4617,11 +4617,9 @@
46174617
\indexlibrary{\idxcode{async}}%
46184618
\begin{itemdecl}
46194619
template <class F, class... Args>
4620-
future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
4621-
async(F&& f, Args&&... args);
4620+
future<result_of_t<decay_t<F>(decay_t<Args>...)>> async(F&& f, Args&&... args);
46224621
template <class F, class... Args>
4623-
future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
4624-
async(launch policy, F&& f, Args&&... args);
4622+
future<result_of_t<decay_t<F>(decay_t<Args>...)>> async(launch policy, F&& f, Args&&... args);
46254623
\end{itemdecl}
46264624

46274625
\begin{itemdescr}
@@ -4694,7 +4692,7 @@
46944692

46954693
\pnum
46964694
\returns An object of type
4697-
\tcode{future<typename result_of<typename decay<F>::type(typename de\-cay<Args>::type...)>::type>} that refers
4695+
\tcode{future<result_of_t<decay_t<F>(decay_t<Args>...)>{>}} that refers
46984696
to the shared state created by this call to \tcode{async}.
46994697
\enternote If a future obtained from std::async is moved outside the local scope,
47004698
other code that uses the future must be aware that the future’s destructor may

source/utilities.tex

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@
6161

6262
// \ref{forward}, forward/move:
6363
template <class T>
64-
constexpr T&& forward(typename remove_reference<T>::type& t) noexcept;
64+
constexpr T&& forward(remove_reference_t<T>& t) noexcept;
6565
template <class T>
66-
constexpr T&& forward(typename remove_reference<T>::type&& t) noexcept;
66+
constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
6767
template <class T>
68-
constexpr typename remove_reference<T>::type&& move(T&&) noexcept;
68+
constexpr remove_reference_t<T>&& move(T&&) noexcept;
6969
template <class T>
70-
constexpr typename conditional<
70+
constexpr conditional_t<
7171
!is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
72-
const T&, T&&>::type move_if_noexcept(T& x) noexcept;
72+
const T&, T&&> move_if_noexcept(T& x) noexcept;
7373

7474
// \ref{declval}, declval:
7575
template <class T>
76-
typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand
76+
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
7777

7878
// \ref{pairs}, pairs:
7979
template <class T1, class T2> struct pair;
@@ -293,8 +293,8 @@
293293

294294
\indexlibrary{\idxcode{forward}}%
295295
\begin{itemdecl}
296-
template <class T> constexpr T&& forward(typename remove_reference<T>::type& t) noexcept;
297-
template <class T> constexpr T&& forward(typename remove_reference<T>::type&& t) noexcept;
296+
template <class T> constexpr T&& forward(remove_reference_t<T>& t) noexcept;
297+
template <class T> constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
298298
\end{itemdecl}
299299

300300
\begin{itemdescr}
@@ -338,13 +338,13 @@
338338

339339
\indexlibrary{\idxcode{move}}%
340340
\begin{itemdecl}
341-
template <class T> constexpr typename remove_reference<T>::type&& move(T&& t) noexcept;
341+
template <class T> constexpr remove_reference_t<T>&& move(T&& t) noexcept;
342342
\end{itemdecl}
343343

344344
\begin{itemdescr}
345345
\pnum
346346
\returns
347-
\tcode{static_cast<typename remove_reference<T>::type\&\&>(t)}.
347+
\tcode{static_cast<remove_reference_t<T>\&\&>(t)}.
348348

349349
\pnum
350350
\enterexample
@@ -383,9 +383,9 @@
383383

384384
\indexlibrary{\idxcode{move_if_noexcept}}%
385385
\begin{itemdecl}
386-
template <class T> constexpr typename conditional<
386+
template <class T> constexpr conditional_t<
387387
!is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
388-
const T&, T&&>::type move_if_noexcept(T& x) noexcept;
388+
const T&, T&&> move_if_noexcept(T& x) noexcept;
389389
\end{itemdecl}
390390

391391
\begin{itemdescr}
@@ -402,7 +402,7 @@
402402
\indexlibrary{\idxcode{declval}}%
403403
\begin{itemdecl}
404404
template <class T>
405-
typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand
405+
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
406406
\end{itemdecl}
407407

408408
\begin{itemdescr}
@@ -865,7 +865,7 @@
865865
\indexlibrary{\idxcode{get}!\idxcode{pair}}%
866866
\begin{itemdecl}
867867
template<size_t I, class T1, class T2>
868-
constexpr typename tuple_element<I, std::pair<T1, T2> >::type&
868+
constexpr tuple_element_t<I, std::pair<T1, T2> >&
869869
get(pair<T1, T2>&) noexcept;
870870
template<size_t I, class T1, class T2>
871871
constexpr const typename tuple_element<I, std::pair<T1, T2> >::type&
@@ -4503,7 +4503,7 @@
45034503
unique_ptr& operator=(nullptr_t) noexcept;
45044504

45054505
// \ref{unique.ptr.single.observers}, observers
4506-
typename add_lvalue_reference<T>::type operator*() const;
4506+
add_lvalue_reference_t<T> operator*() const;
45074507
pointer operator->() const noexcept;
45084508
pointer get() const noexcept;
45094509
deleter_type& get_deleter() noexcept;
@@ -4893,7 +4893,7 @@
48934893
\indexlibrary{\idxcode{operator*}!\idxcode{unique_ptr}}
48944894
\indexlibrary{\idxcode{unique_ptr}!\idxcode{operator*}}
48954895
\begin{itemdecl}
4896-
typename add_lvalue_reference<T>::type operator*() const;
4896+
add_lvalue_reference_t<T> operator*() const;
48974897
\end{itemdecl}
48984898

48994899
\begin{itemdescr}
@@ -5160,7 +5160,7 @@
51605160
\remarks This function shall not participate in overload resolution unless \tcode{T} is an array of unknown bound.
51615161

51625162
\pnum
5163-
\returns \tcode{unique_ptr<T>(new typename remove_extent<T>::type[n]())}.
5163+
\returns \tcode{unique_ptr<T>(new remove_extent_t<T>[n]())}.
51645164

51655165
\end{itemdescr}
51665166

@@ -7282,7 +7282,7 @@
72827282

72837283
// invocation
72847284
template <class... ArgTypes>
7285-
typename result_of<T&(ArgTypes&&...)>::type
7285+
result_of_t<T&(ArgTypes&&...)>
72867286
operator() (ArgTypes&&...) const;
72877287
};
72887288
}
@@ -7405,7 +7405,7 @@
74057405
\indexlibrary{\idxcode{operator()}!\idxcode{reference_wrapper}}%
74067406
\begin{itemdecl}
74077407
template <class... ArgTypes>
7408-
typename result_of<T&(ArgTypes&&... )>::type
7408+
result_of_t<T&(ArgTypes&&... )>
74097409
operator()(ArgTypes&&... args) const;
74107410
\end{itemdecl}
74117411

@@ -9614,7 +9614,7 @@
96149614
Given the following function prototype:
96159615
\begin{codeblock}
96169616
template <class T>
9617-
typename add_rvalue_reference<T>::type create() noexcept;
9617+
add_rvalue_reference_t<T> create() noexcept;
96189618
\end{codeblock}
96199619

96209620
the predicate condition for a template specialization
@@ -9768,7 +9768,7 @@
97689768

97699769
\begin{codeblock}
97709770
template <class T>
9771-
typename add_rvalue_reference<T>::type create() noexcept;
9771+
add_rvalue_reference_t<T> create() noexcept;
97729772
\end{codeblock}
97739773

97749774
the predicate condition for a template specialization \tcode{is_convertible<From, To>}
@@ -9851,7 +9851,7 @@
98519851
struct add_cv;} &
98529852
The member typedef \tcode{type} shall name
98539853
the same type as
9854-
\tcode{add_const<typename add_volatile<T>::type>::type}. \\
9854+
\tcode{add_const_t<add_volatile_t<T>{>}}. \\
98559855
\end{libreqtab2a}
98569856

98579857
\rSec3[meta.trans.ref]{Reference modifications}
@@ -10137,7 +10137,7 @@
1013710137

1013810138
template <class T, class U, class... V>
1013910139
struct common_type<T, U, V...> {
10140-
typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
10140+
typedef common_type_t<common_type_t<T, U>, V...> type;
1014110141
};
1014210142
\end{codeblock}
1014310143

@@ -10433,28 +10433,28 @@
1043310433

1043410434
// \ref{time.duration.nonmember}, duration arithmetic
1043510435
template <class Rep1, class Period1, class Rep2, class Period2>
10436-
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
10436+
common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
1043710437
constexpr operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1043810438
template <class Rep1, class Period1, class Rep2, class Period2>
10439-
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
10439+
common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
1044010440
constexpr operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1044110441
template <class Rep1, class Period, class Rep2>
10442-
duration<typename common_type<Rep1, Rep2>::type, Period>
10442+
duration<common_type_t<Rep1, Rep2>, Period>
1044310443
constexpr operator*(const duration<Rep1, Period>& d, const Rep2& s);
1044410444
template <class Rep1, class Rep2, class Period>
10445-
duration<typename common_type<Rep1, Rep2>::type, Period>
10445+
duration<common_type_t<Rep1, Rep2>, Period>
1044610446
constexpr operator*(const Rep1& s, const duration<Rep2, Period>& d);
1044710447
template <class Rep1, class Period, class Rep2>
10448-
duration<typename common_type<Rep1, Rep2>::type, Period>
10448+
duration<common_type_t<Rep1, Rep2>, Period>
1044910449
constexpr operator/(const duration<Rep1, Period>& d, const Rep2& s);
1045010450
template <class Rep1, class Period1, class Rep2, class Period2>
10451-
typename common_type<Rep1, Rep2>::type
10451+
common_type_t<Rep1, Rep2>
1045210452
constexpr operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1045310453
template <class Rep1, class Period, class Rep2>
10454-
duration<typename common_type<Rep1, Rep2>::type, Period>
10454+
duration<common_type_t<Rep1, Rep2>, Period>
1045510455
constexpr operator%(const duration<Rep1, Period>& d, const Rep2& s);
1045610456
template <class Rep1, class Period1, class Rep2, class Period2>
10457-
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
10457+
common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
1045810458
constexpr operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1045910459

1046010460
// \ref{time.duration.comparisons}, duration comparisons
@@ -10491,16 +10491,16 @@
1049110491

1049210492
// \ref{time.point.nonmember}, time_point arithmetic
1049310493
template <class Clock, class Duration1, class Rep2, class Period2>
10494-
constexpr time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
10494+
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
1049510495
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
1049610496
template <class Rep1, class Period1, class Clock, class Duration2>
10497-
constexpr time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
10497+
constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
1049810498
operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
1049910499
template <class Clock, class Duration1, class Rep2, class Period2>
10500-
constexpr time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
10500+
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
1050110501
operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
1050210502
template <class Clock, class Duration1, class Duration2>
10503-
constexpr typename common_type<Duration1, Duration2>::type
10503+
constexpr common_type_t<Duration1, Duration2>
1050410504
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
1050510505

1050610506
// \ref{time.point.comparisons} time_point comparisons
@@ -10737,7 +10737,7 @@
1073710737
\begin{itemdecl}
1073810738
template <class Rep1, class Period1, class Rep2, class Period2>
1073910739
struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>> {
10740-
typedef chrono::duration<typename common_type<Rep1, Rep2>::type, @\seebelow@> type;
10740+
typedef chrono::duration<common_type_t<Rep1, Rep2>, @\seebelow@> type;
1074110741
};
1074210742
\end{itemdecl}
1074310743

@@ -10761,7 +10761,7 @@
1076110761
\begin{itemdecl}
1076210762
template <class Clock, class Duration1, class Duration2>
1076310763
struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>> {
10764-
typedef chrono::time_point<Clock, typename common_type<Duration1, Duration2>::type> type;
10764+
typedef chrono::time_point<Clock, common_type_t<Duration1, Duration2>> type;
1076510765
};
1076610766
\end{itemdecl}
1076710767

@@ -11132,7 +11132,7 @@
1113211132
\indexlibrary{\idxcode{common_type}}%
1113311133
\begin{itemdecl}
1113411134
template <class Rep1, class Period1, class Rep2, class Period2>
11135-
constexpr typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
11135+
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
1113611136
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1113711137
\end{itemdecl}
1113811138

@@ -11144,7 +11144,7 @@
1114411144
\indexlibrary{\idxcode{common_type}}%
1114511145
\begin{itemdecl}
1114611146
template <class Rep1, class Period1, class Rep2, class Period2>
11147-
constexpr typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type
11147+
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
1114811148
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1114911149
\end{itemdecl}
1115011150

@@ -11157,7 +11157,7 @@
1115711157
\indexlibrary{\idxcode{duration}!\idxcode{operator*}}%
1115811158
\begin{itemdecl}
1115911159
template <class Rep1, class Period, class Rep2>
11160-
constexpr duration<typename common_type<Rep1, Rep2>::type, Period>
11160+
constexpr duration<common_type_t<Rep1, Rep2>, Period>
1116111161
operator*(const duration<Rep1, Period>& d, const Rep2& s);
1116211162
\end{itemdecl}
1116311163

@@ -11174,7 +11174,7 @@
1117411174
\indexlibrary{\idxcode{duration}!\idxcode{operator*}}%
1117511175
\begin{itemdecl}
1117611176
template <class Rep1, class Rep2, class Period>
11177-
constexpr duration<typename common_type<Rep1, Rep2>::type, Period>
11177+
constexpr duration<common_type_t<Rep1, Rep2>, Period>
1117811178
operator*(const Rep1& s, const duration<Rep2, Period>& d);
1117911179
\end{itemdecl}
1118011180

@@ -11191,7 +11191,7 @@
1119111191
\indexlibrary{\idxcode{duration}!\idxcode{operator/}}%
1119211192
\begin{itemdecl}
1119311193
template <class Rep1, class Period, class Rep2>
11194-
constexpr duration<typename common_type<Rep1, Rep2>::type, Period>
11194+
constexpr duration<common_type_t<Rep1, Rep2>, Period>
1119511195
operator/(const duration<Rep1, Period>& d, const Rep2& s);
1119611196
\end{itemdecl}
1119711197

@@ -11209,7 +11209,7 @@
1120911209
\indexlibrary{\idxcode{duration}!\idxcode{operator/}}%
1121011210
\begin{itemdecl}
1121111211
template <class Rep1, class Period1, class Rep2, class Period2>
11212-
constexpr typename common_type<Rep1, Rep2>::type
11212+
constexpr common_type_t<Rep1, Rep2>
1121311213
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1121411214
\end{itemdecl}
1121511215

@@ -11222,7 +11222,7 @@
1122211222
\indexlibrary{\idxcode{duration}!\idxcode{operator\%}}%
1122311223
\begin{itemdecl}
1122411224
template <class Rep1, class Period, class Rep2>
11225-
constexpr duration<typename common_type<Rep1, Rep2>::type, Period>
11225+
constexpr duration<common_type_t<Rep1, Rep2>, Period>
1122611226
operator%(const duration<Rep1, Period>& d, const Rep2& s);
1122711227
\end{itemdecl}
1122811228

@@ -11240,7 +11240,7 @@
1124011240
\indexlibrary{\idxcode{duration}!\idxcode{operator\%}}%
1124111241
\begin{itemdecl}
1124211242
template <class Rep1, class Period1, class Rep2, class Period2>
11243-
constexpr typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
11243+
constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
1124411244
operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
1124511245
\end{itemdecl}
1124611246

@@ -11637,7 +11637,7 @@
1163711637
\indexlibrary{\idxcode{duration}!\idxcode{operator+}}%
1163811638
\begin{itemdecl}
1163911639
template <class Clock, class Duration1, class Rep2, class Period2>
11640-
constexpr time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
11640+
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
1164111641
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
1164211642
\end{itemdecl}
1164311643

@@ -11652,7 +11652,7 @@
1165211652
\indexlibrary{\idxcode{duration}!\idxcode{operator+}}%
1165311653
\begin{itemdecl}
1165411654
template <class Rep1, class Period1, class Clock, class Duration2>
11655-
constexpr time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
11655+
constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
1165611656
operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
1165711657
\end{itemdecl}
1165811658

@@ -11667,7 +11667,7 @@
1166711667
\indexlibrary{\idxcode{duration}!\idxcode{operator-}}%
1166811668
\begin{itemdecl}
1166911669
template <class Clock, class Duration1, class Rep2, class Period2>
11670-
constexpr time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
11670+
constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
1167111671
operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
1167211672
\end{itemdecl}
1167311673

@@ -11680,7 +11680,7 @@
1168011680
\indexlibrary{\idxcode{time_point}!\idxcode{operator-}}%
1168111681
\begin{itemdecl}
1168211682
template <class Clock, class Duration1, class Duration2>
11683-
constexpr typename common_type<Duration1, Duration2>::type
11683+
constexpr common_type_t<Duration1, Duration2>
1168411684
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
1168511685
\end{itemdecl}
1168611686

0 commit comments

Comments
 (0)