From 257b4fdc7d878c73057470982904231aa638428c Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Wed, 3 Jan 2024 14:43:59 +0900 Subject: [PATCH] Replaced return type to auto. --- .../async_mqtt/broker/endpoint_variant.hpp | 19 +++++------- include/async_mqtt/endpoint.hpp | 30 ++++++++----------- include/async_mqtt/stream.hpp | 6 ++-- .../async_mqtt/ws_fixed_size_async_read.hpp | 4 +-- 4 files changed, 25 insertions(+), 34 deletions(-) diff --git a/include/async_mqtt/broker/endpoint_variant.hpp b/include/async_mqtt/broker/endpoint_variant.hpp index f1815759f..7fc679aeb 100644 --- a/include/async_mqtt/broker/endpoint_variant.hpp +++ b/include/async_mqtt/broker/endpoint_variant.hpp @@ -146,7 +146,7 @@ class epsp_wrap { // async functions template - typename as::async_result, void(optional)>::return_type + auto acquire_unique_packet_id( CompletionToken&& token ) { @@ -160,7 +160,7 @@ class epsp_wrap { } template - typename as::async_result, void(bool)>::return_type + auto register_packet_id( packet_id_t packet_id, CompletionToken&& token @@ -176,7 +176,7 @@ class epsp_wrap { } template - typename as::async_result, void()>::return_type + auto release_packet_id( packet_id_t packet_id, CompletionToken&& token @@ -192,7 +192,7 @@ class epsp_wrap { } template - typename as::async_result, void(system_error)>::return_type + auto send( Packet&& packet, CompletionToken&& token @@ -208,7 +208,7 @@ class epsp_wrap { } template - typename as::async_result, void(packet_variant_type)>::return_type + auto recv( CompletionToken&& token ) { @@ -222,7 +222,7 @@ class epsp_wrap { } template - typename as::async_result, void()>::return_type + auto close( CompletionToken&& token ) { @@ -236,7 +236,7 @@ class epsp_wrap { } template - typename as::async_result, void()>::return_type + auto restore_packets( std::vector> pvs, CompletionToken&& token @@ -252,10 +252,7 @@ class epsp_wrap { } template - typename as::async_result< - std::decay_t, - void(std::vector>) - >::return_type + auto get_stored_packets( CompletionToken&& token ) { diff --git a/include/async_mqtt/endpoint.hpp b/include/async_mqtt/endpoint.hpp index 1354da4da..49619ce35 100644 --- a/include/async_mqtt/endpoint.hpp +++ b/include/async_mqtt/endpoint.hpp @@ -273,7 +273,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void(optional)>::return_type + auto acquire_unique_packet_id( CompletionToken&& token ) { @@ -299,7 +299,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void(bool)>::return_type + auto register_packet_id( packet_id_t packet_id, CompletionToken&& token @@ -327,7 +327,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void()>::return_type + auto release_packet_id( packet_id_t packet_id, CompletionToken&& token @@ -356,7 +356,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void(system_error)>::return_type + auto send( Packet packet, CompletionToken&& token @@ -387,7 +387,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void(packet_variant_type)>::return_type + auto recv( CompletionToken&& token ) { @@ -418,7 +418,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void(packet_variant_type)>::return_type + auto recv( std::set types, CompletionToken&& token @@ -453,7 +453,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void(packet_variant_type)>::return_type + auto recv( filter fil, std::set types, @@ -484,7 +484,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void()>::return_type + auto close(CompletionToken&& token) { ASYNC_MQTT_LOG("mqtt_api", info) << ASYNC_MQTT_ADD_VALUE(address, this) @@ -509,7 +509,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void()>::return_type + auto restore_packets( std::vector> pvs, CompletionToken&& token @@ -540,10 +540,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result< - std::decay_t, - void(std::vector>) - >::return_type + auto get_stored_packets( CompletionToken&& token ) const { @@ -563,10 +560,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result< - std::decay_t, - void(v5::basic_publish_packet) - >::return_type + auto regulate_for_store( v5::basic_publish_packet packet, CompletionToken&& token @@ -2371,7 +2365,7 @@ class basic_endpoint : public std::enable_shared_from_this - typename as::async_result, void(system_error)>::return_type + auto send( Packet packet, bool from_queue, diff --git a/include/async_mqtt/stream.hpp b/include/async_mqtt/stream.hpp index 179db7628..a104c378c 100644 --- a/include/async_mqtt/stream.hpp +++ b/include/async_mqtt/stream.hpp @@ -113,7 +113,7 @@ class stream : public std::enable_shared_from_this> { } template - typename as::async_result, void(error_code, buffer)>::return_type + auto read_packet( CompletionToken&& token ) { @@ -130,7 +130,7 @@ class stream : public std::enable_shared_from_this> { } template - typename as::async_result, void(error_code, std::size_t)>::return_type + auto write_packet( Packet packet, CompletionToken&& token @@ -169,7 +169,7 @@ class stream : public std::enable_shared_from_this> { } template - typename as::async_result, void(error_code)>::return_type + auto close(CompletionToken&& token) { return as::async_compose< diff --git a/include/async_mqtt/ws_fixed_size_async_read.hpp b/include/async_mqtt/ws_fixed_size_async_read.hpp index 65d7d1abf..d4c208d10 100644 --- a/include/async_mqtt/ws_fixed_size_async_read.hpp +++ b/include/async_mqtt/ws_fixed_size_async_read.hpp @@ -71,7 +71,7 @@ template < as::is_mutable_buffer_sequence::value >* = nullptr > -typename as::async_result, void(boost::system::error_code const&, std::size_t)>::return_type +auto async_read( bs::websocket::stream& stream, MutableBufferSequence const& mb, @@ -98,7 +98,7 @@ template < as::is_const_buffer_sequence::value >* = nullptr > -typename as::async_result, void(boost::system::error_code const&, std::size_t)>::return_type +auto async_write( bs::websocket::stream& stream, ConstBufferSequence const& cbs,