libstdc++: Use 'using' for types in Networking TS headers
authorJonathan Wakely <jwakely@redhat.com>
Wed, 20 May 2020 23:59:55 +0000 (00:59 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 20 May 2020 23:59:55 +0000 (00:59 +0100)
* include/experimental/buffer: Replace typedefs with
alias-declarations.
* include/experimental/executor: Likewise.
* include/experimental/internet: Likewise.
* include/experimental/socket: Likewise.
* include/experimental/timer: Likewise.

libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/buffer
libstdc++-v3/include/experimental/executor
libstdc++-v3/include/experimental/internet
libstdc++-v3/include/experimental/socket
libstdc++-v3/include/experimental/timer

index 67ca5b76d21d2a8d462290ac68d3dedfb9fd09b9..0ecfde4a9a6c5d92a9fdadedf2ce1797fc30e09b 100644 (file)
@@ -1,3 +1,12 @@
+2020-05-21  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/experimental/buffer: Replace typedefs with
+       alias-declarations.
+       * include/experimental/executor: Likewise.
+       * include/experimental/internet: Likewise.
+       * include/experimental/socket: Likewise.
+       * include/experimental/timer: Likewise.
+
 2020-05-19  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/94087
index 0b04b71286c17e216793bc0cd350fd9f6aa10e22..8ccdb28cc5bae996cce3b52769694cdd92785f03 100644 (file)
@@ -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
index 3560e345e8a5b6c82cc590db2ff6264de2b93335..f55414c9360e5ec004cd0345fb9927679972afa2 100644 (file)
@@ -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:
 
index 1aa81095009cbbfc07191d3c5a9142ef12f14c3e..71e40d83a7e0eb4d40b846b1cadb8f0b8d65c978 100644 (file)
@@ -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); }
index 81b1d15b654fd3740a3926c849b8e1914a6a254a..837965cb3c0ae232502821c83245fbd4320ea4ae 100644 (file)
@@ -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:
 
index d50ca76c2dff964d230a5286b00a8e177a905d02..58249d0387dc878dcc5f9dc307e44cd723325217 100644 (file)
@@ -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