Skip to content

Commit 73d03ed

Browse files
authored
Merge pull request #56 from LarsGullik/master
Use 'using' (and 'alias') instead of 'typedef'
2 parents 4fb1121 + 624521e commit 73d03ed

File tree

8 files changed

+115
-116
lines changed

8 files changed

+115
-116
lines changed

src/async.tex

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@
346346
class my_service : public execution_context::service
347347
{
348348
public:
349-
typedef my_service key_type;
349+
using key_type = my_service;
350350
explicit my_service(execution_context& ctx);
351351
my_service(execution_context& ctx, int some_value);
352352
private:
@@ -768,8 +768,8 @@
768768
class async_result
769769
{
770770
public:
771-
typedef CompletionToken completion_handler_type;
772-
typedef void return_type;
771+
using completion_handler_type = CompletionToken;
772+
using return_type = void;
773773

774774
explicit async_result(completion_handler_type&) {}
775775
async_result(const async_result&) = delete;
@@ -841,9 +841,8 @@
841841
template<class CompletionToken, class Signature>
842842
struct async_completion
843843
{
844-
typedef async_result<decay_t<CompletionToken>,
845-
Signature>::completion_handler_type
846-
completion_handler_type;
844+
using completion_handler_type = async_result<decay_t<CompletionToken>,
845+
Signature>::completion_handler_type;
847846

848847
explicit async_completion(CompletionToken& t);
849848
async_completion(const async_completion&) = delete;
@@ -897,7 +896,7 @@
897896
template<class T, class ProtoAllocator = allocator<void>>
898897
struct associated_allocator
899898
{
900-
typedef @\seebelow@ type;
899+
using type = @\seebelow@;
901900

902901
static type get(const T& t, const ProtoAllocator& a = ProtoAllocator()) noexcept;
903902
};
@@ -945,7 +944,7 @@
945944
\rSec2[async.assoc.alloc.members]{\tcode{associated_allocator} members}
946945

947946
\begin{itemdecl}
948-
typedef @\seebelow@ type;
947+
using type = @\seebelow@;
949948
\end{itemdecl}
950949

951950
\begin{itemdescr}
@@ -1349,7 +1348,7 @@
13491348
template<class T, class Executor = system_executor>
13501349
struct associated_executor
13511350
{
1352-
typedef @\seebelow@ type;
1351+
using type = @\seebelow@;
13531352

13541353
static type get(const T& t, const Executor& e = Executor()) noexcept;
13551354
};
@@ -1397,7 +1396,7 @@
13971396
\rSec2[async.assoc.exec.members]{\tcode{associated_executor} members}
13981397

13991398
\begin{itemdecl}
1400-
typedef @\seebelow@ type;
1399+
using type = @\seebelow@;
14011400
\end{itemdecl}
14021401

14031402
\begin{itemdescr}
@@ -1478,8 +1477,8 @@
14781477
public:
14791478
// types:
14801479

1481-
typedef T target_type;
1482-
typedef Executor executor_type;
1480+
using target_type = T;
1481+
using executor_type = Executor;
14831482

14841483
// construct / copy / destroy:
14851484

@@ -1657,10 +1656,10 @@
16571656
class async_result<executor_binder<T, Executor>, Signature>
16581657
{
16591658
public:
1660-
typedef executor_binder<
1659+
using completion_handler_type = executor_binder<
16611660
typename async_result<T, Signature>::completion_handler_type,
1662-
Executor> completion_handler_type;
1663-
typedef typename async_result<T, Signature>::return_type return_type;
1661+
Executor>;
1662+
using return_type = typename async_result<T, Signature>::return_type;
16641663

16651664
explicit async_result(completion_handler_type& h);
16661665
async_result(const async_result&) = delete;
@@ -1711,7 +1710,7 @@
17111710
template<class T, class Executor, class ProtoAllocator>
17121711
struct associated_allocator<executor_binder<T, Executor>, ProtoAllocator>
17131712
{
1714-
typedef associated_allocator_t<T, ProtoAllocator> type;
1713+
using type = associated_allocator_t<T, ProtoAllocator>;
17151714

17161715
static type get(const executor_binder<T, Executor>& b,
17171716
const ProtoAllocator& a = ProtoAllocator()) noexcept;
@@ -1748,7 +1747,7 @@
17481747
template<class T, class Executor, class Executor1>
17491748
struct associated_executor<executor_binder<T, Executor>, Executor1>
17501749
{
1751-
typedef Executor type;
1750+
using type = Executor;
17521751

17531752
static type get(const executor_binder<T, Executor>& b,
17541753
const Executor1& e = Executor1()) noexcept;
@@ -1822,7 +1821,7 @@
18221821
public:
18231822
// types:
18241823

1825-
typedef Executor executor_type;
1824+
using executor_type = Executor;
18261825

18271826
// construct / copy / destroy:
18281827

@@ -2131,7 +2130,7 @@
21312130
public:
21322131
// types:
21332132

2134-
typedef system_executor executor_type;
2133+
using executor_type = system_executor;
21352134

21362135
// construct / copy / destroy:
21372136

@@ -2990,7 +2989,7 @@
29902989
public:
29912990
// types:
29922991

2993-
typedef Executor inner_executor_type;
2992+
using inner_executor_type = Executor;
29942993

29952994
// construct / copy / destroy:
29962995

@@ -3407,7 +3406,7 @@
34073406
{
34083407
public:
34093408
// use_future_t types:
3410-
typedef ProtoAllocator allocator_type;
3409+
using allocator_type = ProtoAllocator;
34113410

34123411
// use_future_t members:
34133412
constexpr use_future_t() noexcept(noexcept(allocator_type()));
@@ -3493,9 +3492,9 @@
34933492
The implementation provides a partial specialization \tcode{template <class Result, class... Args> async_result<T, Result(Args...)>} such that:
34943493
\begin{itemize}
34953494
\item
3496-
the nested typedef \tcode{completion_handler_type} is a type \tcode{H};
3495+
the nested type \tcode{completion_handler_type} is a type \tcode{H};
34973496
\item
3498-
the nested typedef \tcode{return_type} is \tcode{future<result_of_t<FD(decay_t<Args>...)>>}; and
3497+
the nested type \tcode{return_type} is \tcode{future<result_of_t<FD(decay_t<Args>...)>>}; and
34993498
\item
35003499
when an object \tcode{r1} of type \tcode{async_result<T, Result(Args...)>} is constructed from \tcode{h}, the expression \tcode{r1.get()} returns a future with the same shared state as \tcode{h}.
35013500
\end{itemize}
@@ -3515,8 +3514,8 @@
35153514
template<class ProtoAllocator, class Result, class... Args>
35163515
class async_result<use_future_t<ProtoAllocator>, Result(Args...)>
35173516
{
3518-
typedef @\seebelow@ completion_handler_type;
3519-
typedef @\seebelow@ return_type;
3517+
using completion_handler_type = @\seebelow@;
3518+
using return_type = @\seebelow@;
35203519

35213520
explicit async_result(completion_handler_type& h);
35223521
async_result(const async_result&) = delete;
@@ -3629,8 +3628,8 @@
36293628
class async_result<packaged_task<Result(Args...)>, Signature>
36303629
{
36313630
public:
3632-
typedef packaged_task<Result(Args...)> completion_handler_type;
3633-
typedef future<Result> return_type;
3631+
using completion_handler_type = packaged_task<Result(Args...)>;
3632+
using return_type = future<Result>;
36343633

36353634
explicit async_result(completion_handler_type& h);
36363635
async_result(const async_result&) = delete;

src/basicioservices.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
// types:
3838

3939
class executor_type;
40-
typedef @\textit{implementation-defined}@ count_type;
40+
using count_type = @\textit{implementation-defined}@;
4141

4242
// construct / copy / destroy:
4343

src/buffers.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,8 @@
11061106
{
11071107
public:
11081108
// types:
1109-
typedef const_buffer const_buffers_type;
1110-
typedef mutable_buffer mutable_buffers_type;
1109+
using const_buffers_type = const_buffer;
1110+
using mutable_buffers_type = mutable_buffer;
11111111

11121112
// constructors:
11131113
explicit dynamic_vector_buffer(vector<T, Allocator>& vec) noexcept;
@@ -1272,8 +1272,8 @@
12721272
{
12731273
public:
12741274
// types:
1275-
typedef const_buffer const_buffers_type;
1276-
typedef mutable_buffer mutable_buffers_type;
1275+
using const_buffers_type = const_buffer;
1276+
using mutable_buffers_type = mutable_buffer;
12771277

12781278
// constructors:
12791279
explicit dynamic_string_buffer(basic_string<CharT, Traits, Allocator>& str) noexcept;

src/forward.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
template<class Clock> struct wait_traits;
2828
template<class Clock, class WaitTraits = wait_traits<Clock>>
2929
class basic_waitable_timer;
30-
typedef basic_waitable_timer<chrono::system_clock> system_timer;
31-
typedef basic_waitable_timer<chrono::steady_clock> steady_timer;
32-
typedef basic_waitable_timer<chrono::high_resolution_clock> high_resolution_timer;
30+
using system_timer = basic_waitable_timer<chrono::system_clock>;
31+
using steady_timer = basic_waitable_timer<chrono::steady_clock>;
32+
using high_resolution_timer = basic_waitable_timer<chrono::high_resolution_clock>;
3333

3434
template<class Protocol>
3535
class basic_socket;
@@ -53,12 +53,12 @@
5353
class address_v6;
5454
template<class Address>
5555
class basic_address_iterator;
56-
typedef basic_address_iterator<address_v4> address_v4_iterator;
57-
typedef basic_address_iterator<address_v6> address_v6_iterator;
56+
using address_v4_iterator = basic_address_iterator<address_v4>;
57+
using address_v6_iterator = basic_address_iterator<address_v6>;
5858
template<class Address>
5959
class basic_address_range;
60-
typedef basic_address_range<address_v4> address_v4_range;
61-
typedef basic_address_range<address_v6> address_v6_range;
60+
using address_v4_range = basic_address_range<address_v4>;
61+
using address_v6_range = basic_address_range<address_v6>;
6262
class network_v4;
6363
class network_v6;
6464
template<class InternetProtocol>

0 commit comments

Comments
 (0)