diff mbox series

[committed] libstdc++: Use 'using' for types in Networking TS headers

Message ID 20200521000047.GA1915341@redhat.com
State New
Headers show
Series [committed] libstdc++: Use 'using' for types in Networking TS headers | expand

Commit Message

Jonathan Wakely May 21, 2020, midnight UTC
* include/experimental/buffer: Replace typedefs with
	alias-declarations.
	* include/experimental/executor: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/socket: Likewise.
	* include/experimental/timer: Likewise.

Tested powerpc64le-linux, committed to master.
commit f26e72d8310c3e70f7a4b345e06a9c5c8d51728a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu May 21 00:59:55 2020 +0100

    libstdc++: Use 'using' for types in Networking TS headers
    
            * include/experimental/buffer: Replace typedefs with
            alias-declarations.
            * include/experimental/executor: Likewise.
            * include/experimental/internet: Likewise.
            * include/experimental/socket: Likewise.
            * include/experimental/timer: Likewise.
diff mbox series

Patch

diff --git a/libstdc++-v3/include/experimental/buffer b/libstdc++-v3/include/experimental/buffer
index 0b04b71286c..8ccdb28cc5b 100644
--- a/libstdc++-v3/include/experimental/buffer
+++ b/libstdc++-v3/include/experimental/buffer
@@ -488,8 +488,8 @@  inline namespace v1
     {
     public:
       // types:
-      typedef const_buffer const_buffers_type;
-      typedef mutable_buffer mutable_buffers_type;
+      using const_buffers_type = const_buffer;
+      using mutable_buffers_type = mutable_buffer;
 
       // constructors:
       explicit
diff --git a/libstdc++-v3/include/experimental/executor b/libstdc++-v3/include/experimental/executor
index 3560e345e8a..f55414c9360 100644
--- a/libstdc++-v3/include/experimental/executor
+++ b/libstdc++-v3/include/experimental/executor
@@ -369,8 +369,8 @@  inline namespace v1
     class async_result
     {
     public:
-      typedef _CompletionToken completion_handler_type;
-      typedef void return_type;
+      using completion_handler_type = _CompletionToken;
+      using return_type = void;
 
       explicit async_result(completion_handler_type&) {}
       async_result(const async_result&) = delete;
@@ -660,8 +660,8 @@  inline namespace v1
     public:
       // types:
 
-      typedef _Tp target_type;
-      typedef _Executor executor_type;
+      using target_type = _Tp;
+      using executor_type = _Executor;
 
       // construct / copy / destroy:
 
@@ -766,7 +766,7 @@  inline namespace v1
   template<typename _Tp, typename _Executor, typename _ProtoAlloc>
     struct associated_allocator<executor_binder<_Tp, _Executor>, _ProtoAlloc>
     {
-      typedef associated_allocator_t<_Tp, _ProtoAlloc> type;
+      using type = associated_allocator_t<_Tp, _ProtoAlloc>;
 
       static type
       get(const executor_binder<_Tp, _Executor>& __b,
@@ -777,7 +777,7 @@  inline namespace v1
   template<typename _Tp, typename _Executor, typename _Executor1>
     struct associated_executor<executor_binder<_Tp, _Executor>, _Executor1>
     {
-      typedef _Executor type;
+      using type = _Executor;
 
       static type
       get(const executor_binder<_Tp, _Executor>& __b,
@@ -791,7 +791,7 @@  inline namespace v1
     public:
       // types:
 
-      typedef _Executor executor_type;
+      using executor_type = _Executor;
 
       // construct / copy / destroy:
 
@@ -845,7 +845,7 @@  inline namespace v1
   public:
     // types:
 
-    typedef system_executor executor_type;
+    using executor_type = system_executor;
 
     // construct / copy / destroy:
 
@@ -1446,7 +1446,7 @@  inline namespace v1
     public:
       // types:
 
-      typedef _Executor inner_executor_type;
+      using inner_executor_type = _Executor;
 
       // construct / copy / destroy:
 
diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet
index 1aa81095009..71e40d83a7e 100644
--- a/libstdc++-v3/include/experimental/internet
+++ b/libstdc++-v3/include/experimental/internet
@@ -110,8 +110,8 @@  namespace ip
   /// @}
 #endif
 
-  typedef uint_least16_t port_type;	///< Type used for port numbers.
-  typedef uint_least32_t scope_id_type;	///< Type used for IPv6 scope IDs.
+  using port_type = uint_least16_t;	///< Type used for port numbers.
+  using scope_id_type = uint_least32_t;	///< Type used for IPv6 scope IDs.
 
   /// Convenience alias for constraining allocators for strings.
   template<typename _Alloc>
@@ -133,7 +133,7 @@  namespace ip
   {
   public:
     // types:
-    typedef uint_least32_t uint_type;
+    using uint_type = uint_least32_t;
 
     struct bytes_type : array<unsigned char, 4>
     {
@@ -918,11 +918,11 @@  namespace ip
   {
   public:
     // types:
-    typedef address_v4 value_type;
-    typedef ptrdiff_t difference_type;
-    typedef const address_v4* pointer;
-    typedef const address_v4& reference;
-    typedef input_iterator_tag iterator_category;
+    using value_type = address_v4;
+    using difference_type = ptrdiff_t;
+    using pointer = const address_v4*;
+    using reference = const address_v4&;
+    using iterator_category = input_iterator_tag;
 
     // constructors:
     basic_address_iterator(const address_v4& __a) noexcept
@@ -972,17 +972,17 @@  namespace ip
     address_v4 _M_address;
   };
 
-  typedef basic_address_iterator<address_v4> address_v4_iterator;
+  using address_v4_iterator = basic_address_iterator<address_v4>;
 
   template<> class basic_address_iterator<address_v6>
   {
   public:
     // types:
-    typedef address_v6 value_type;
-    typedef ptrdiff_t difference_type;
-    typedef const address_v6* pointer;
-    typedef const address_v6& reference;
-    typedef input_iterator_tag iterator_category;
+    using value_type = address_v6;
+    using difference_type = ptrdiff_t;
+    using pointer = const address_v6*;
+    using reference = const address_v6&;
+    using iterator_category = input_iterator_tag;
 
     // constructors:
     basic_address_iterator(const address_v6& __a) noexcept
@@ -1026,7 +1026,7 @@  namespace ip
     address_v6 _M_address;
   };
 
-  typedef basic_address_iterator<address_v6> address_v6_iterator;
+  using address_v6_iterator = basic_address_iterator<address_v6>;
 
   template<typename> class basic_address_range; // not defined
 
@@ -1039,7 +1039,7 @@  namespace ip
   public:
     // types:
 
-    typedef basic_address_iterator<address_v4> iterator;
+    using iterator = basic_address_iterator<address_v4>;
 
     // constructors:
 
@@ -1071,7 +1071,7 @@  namespace ip
     iterator _M_end;
   };
 
-  typedef basic_address_range<address_v4> address_v4_range;
+  using address_v4_range = basic_address_range<address_v4>;
 
   // @}
 
@@ -1084,7 +1084,7 @@  namespace ip
   public:
     // types:
 
-    typedef basic_address_iterator<address_v6> iterator;
+    using iterator = basic_address_iterator<address_v6>;
 
     // constructors:
 
@@ -1112,7 +1112,7 @@  namespace ip
     iterator _M_end;
   };
 
-  typedef basic_address_range<address_v6> address_v6_range;
+  using address_v6_range = basic_address_range<address_v6>;
 
   // @}
 
@@ -1384,7 +1384,7 @@  namespace ip
     {
     public:
       // types:
-      typedef _InternetProtocol protocol_type;
+      using protocol_type = _InternetProtocol;
 
       // constructors:
 
@@ -1574,8 +1574,8 @@  namespace ip
     {
     public:
       // types:
-      typedef _InternetProtocol protocol_type;
-      typedef typename _InternetProtocol::endpoint endpoint_type;
+      using protocol_type = _InternetProtocol;
+      using endpoint_type = typename _InternetProtocol::endpoint;
 
       // constructors:
       basic_resolver_entry() { }
@@ -1697,15 +1697,15 @@  namespace ip
     {
     public:
       // types:
-      typedef _InternetProtocol protocol_type;
-      typedef typename protocol_type::endpoint endpoint_type;
-      typedef basic_resolver_entry<protocol_type> value_type;
-      typedef const value_type& const_reference;
-      typedef value_type& reference;
-      typedef typename forward_list<value_type>::const_iterator const_iterator;
-      typedef const_iterator iterator;
-      typedef ptrdiff_t difference_type;
-      typedef size_t size_type;
+      using protocol_type = _InternetProtocol;
+      using endpoint_type = typename protocol_type::endpoint;
+      using value_type = basic_resolver_entry<protocol_type>;
+      using const_reference = const value_type&;
+      using reference = value_type&;
+      using const_iterator = typename forward_list<value_type>::const_iterator;
+      using iterator = const_iterator;
+      using difference_type = ptrdiff_t;
+      using size_type = size_t;
 
       // construct / copy / destroy:
 
@@ -1775,10 +1775,10 @@  namespace ip
     public:
       // types:
 
-      typedef io_context::executor_type executor_type;
-      typedef _InternetProtocol protocol_type;
-      typedef typename _InternetProtocol::endpoint endpoint_type;
-      typedef basic_resolver_results<_InternetProtocol> results_type;
+      using executor_type = io_context::executor_type;
+      using protocol_type = _InternetProtocol;
+      using endpoint_type = typename _InternetProtocol::endpoint;
+      using results_type = basic_resolver_results<_InternetProtocol>;
 
       // construct / copy / destroy:
 
@@ -2056,11 +2056,11 @@  namespace ip
   {
   public:
     // types:
-    typedef basic_endpoint<tcp> endpoint;	 ///< A TCP endpoint.
-    typedef basic_resolver<tcp> resolver;	 ///< A TCP resolver.
-    typedef basic_stream_socket<tcp> socket;	 ///< A TCP socket.
-    typedef basic_socket_acceptor<tcp> acceptor; ///< A TCP acceptor.
-    typedef basic_socket_iostream<tcp> iostream; /// A TCP iostream.
+    using endpoint = basic_endpoint<tcp>;	 ///< A TCP endpoint.
+    using resolver = basic_resolver<tcp>;	 ///< A TCP resolver.
+    using socket = basic_stream_socket<tcp>;	 ///< A TCP socket.
+    using acceptor = basic_socket_acceptor<tcp>; ///< A TCP acceptor.
+    using iostream = basic_socket_iostream<tcp>; /// A TCP iostream.
 
 #ifdef _GLIBCXX_HAVE_NETINET_TCP_H
     /// Disable coalescing of small segments (i.e. the Nagle algorithm).
@@ -2111,9 +2111,9 @@  namespace ip
   {
   public:
     // types:
-    typedef basic_endpoint<udp> endpoint;
-    typedef basic_resolver<udp> resolver;
-    typedef basic_datagram_socket<udp> socket;
+    using endpoint = basic_endpoint<udp>;
+    using resolver = basic_resolver<udp>;
+    using socket = basic_datagram_socket<udp>;
 
     // static members:
     static constexpr udp v4() noexcept { return udp(AF_INET); }
diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket
index 81b1d15b654..837965cb3c0 100644
--- a/libstdc++-v3/include/experimental/socket
+++ b/libstdc++-v3/include/experimental/socket
@@ -701,10 +701,10 @@  inline namespace v1
     public:
       // types:
 
-      typedef io_context::executor_type executor_type;
-      typedef int native_handle_type;
-      typedef _Protocol protocol_type;
-      typedef typename protocol_type::endpoint endpoint_type;
+      using executor_type = io_context::executor_type;
+      using native_handle_type = int;
+      using protocol_type = _Protocol;
+      using endpoint_type = typename protocol_type::endpoint;
 
       // basic_socket operations:
 
@@ -1067,9 +1067,9 @@  inline namespace v1
     public:
       // types:
 
-      typedef int native_handle_type;
-      typedef _Protocol protocol_type;
-      typedef typename protocol_type::endpoint endpoint_type;
+      using native_handle_type = int;
+      using protocol_type = _Protocol;
+      using endpoint_type = typename protocol_type::endpoint;
 
       // construct / copy / destroy:
 
@@ -1520,9 +1520,9 @@  inline namespace v1
     public:
       // types:
 
-      typedef int native_handle_type;
-      typedef _Protocol protocol_type;
-      typedef typename protocol_type::endpoint endpoint_type;
+      using native_handle_type = int;
+      using protocol_type = _Protocol;
+      using endpoint_type = typename protocol_type::endpoint;
 
       // construct / copy / destroy:
 
@@ -1833,11 +1833,11 @@  inline namespace v1
     public:
       // types:
 
-      typedef io_context::executor_type executor_type;
-      typedef int native_handle_type;
-      typedef _AcceptableProtocol protocol_type;
-      typedef typename protocol_type::endpoint endpoint_type;
-      typedef typename protocol_type::socket socket_type;
+      using executor_type = io_context::executor_type;
+      using native_handle_type = int;
+      using protocol_type = _AcceptableProtocol;
+      using endpoint_type = typename protocol_type::endpoint;
+      using socket_type = typename protocol_type::socket;
 
       // construct / copy / destroy:
 
@@ -2277,12 +2277,12 @@  inline namespace v1
     public:
       // types:
 
-      typedef _Protocol protocol_type;
-      typedef typename protocol_type::endpoint endpoint_type;
-      typedef _Clock clock_type;
-      typedef typename clock_type::time_point time_point;
-      typedef typename clock_type::duration duration;
-      typedef _WaitTraits wait_traits_type;
+      using protocol_type = _Protocol;
+      using endpoint_type = typename protocol_type::endpoint;
+      using clock_type = _Clock;
+      using time_point = typename clock_type::time_point;
+      using duration = typename clock_type::duration;
+      using wait_traits_type = _WaitTraits;
 
       // construct / copy / destroy:
 
@@ -2355,12 +2355,12 @@  inline namespace v1
     public:
       // types:
 
-      typedef _Protocol protocol_type;
-      typedef typename protocol_type::endpoint endpoint_type;
-      typedef _Clock clock_type;
-      typedef typename clock_type::time_point time_point;
-      typedef typename clock_type::duration duration;
-      typedef _WaitTraits wait_traits_type;
+      using protocol_type = _Protocol;
+      using endpoint_type = typename protocol_type::endpoint;
+      using clock_type = _Clock;
+      using time_point = typename clock_type::time_point;
+      using duration = typename clock_type::duration;
+      using wait_traits_type = _WaitTraits;
 
       // construct / copy / destroy:
 
diff --git a/libstdc++-v3/include/experimental/timer b/libstdc++-v3/include/experimental/timer
index d50ca76c2df..58249d0387d 100644
--- a/libstdc++-v3/include/experimental/timer
+++ b/libstdc++-v3/include/experimental/timer
@@ -81,11 +81,11 @@  inline namespace v1
     public:
       // types:
 
-      typedef io_context::executor_type executor_type;
-      typedef _Clock clock_type;
-      typedef typename clock_type::duration duration;
-      typedef typename clock_type::time_point time_point;
-      typedef _WaitTraits traits_type;
+      using executor_type = io_context::executor_type;
+      using clock_type = _Clock;
+      using duration = typename clock_type::duration;
+      using time_point = typename clock_type::time_point;
+      using traits_type = _WaitTraits;
 
       // construct / copy / destroy:
 
@@ -170,10 +170,10 @@  inline namespace v1
       friend class io_context;
     };
 
-  typedef basic_waitable_timer<chrono::system_clock> system_timer;
-  typedef basic_waitable_timer<chrono::steady_clock> steady_timer;
-  typedef basic_waitable_timer<chrono::high_resolution_clock>
-    high_resolution_timer;
+  using system_timer = basic_waitable_timer<chrono::system_clock>;
+  using steady_timer = basic_waitable_timer<chrono::steady_clock>;
+  using high_resolution_timer
+    = basic_waitable_timer<chrono::high_resolution_clock>;
 
   template<typename _Clock, typename _WaitTraits>
     void