From 4be7c5aec316d9cb133291a34c1661fe19fabb63 Mon Sep 17 00:00:00 2001 From: Richard Hodges Date: Mon, 4 May 2020 14:21:12 +0200 Subject: [PATCH] Fix async_connect documentation resolves #1903 --- CHANGELOG.md | 1 + include/boost/beast/core/basic_stream.hpp | 2 +- test/beast/core/basic_stream.cpp | 52 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b26a39d4..466b189f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +* Fix async_connect documentation * Fix assert in websocket -------------------------------------------------------------------------------- diff --git a/include/boost/beast/core/basic_stream.hpp b/include/boost/beast/core/basic_stream.hpp index 0768dd84..ade909e3 100644 --- a/include/boost/beast/core/basic_stream.hpp +++ b/include/boost/beast/core/basic_stream.hpp @@ -1165,7 +1165,7 @@ public: @code bool connect_condition( error_code const& ec, - Iterator next); + typename Protocol::endpoint const& next); @endcode @param handler The completion handler to invoke when the operation diff --git a/test/beast/core/basic_stream.cpp b/test/beast/core/basic_stream.cpp index 4cbe1b15..efca5cc3 100644 --- a/test/beast/core/basic_stream.cpp +++ b/test/beast/core/basic_stream.cpp @@ -1347,9 +1347,60 @@ public: resolve_results.end(), comparison_function, net::use_awaitable))>); + + static_assert(std::is_same_v< + net::awaitable, decltype( + stream.async_connect( + resolve_results, + comparison_function, + net::use_awaitable))>); } #endif + void + testConnectionConditionArgs( + basic_stream &stream, + net::ip::tcp::resolver::results_type const &results) + { + struct condition + { + bool + operator()(const error_code &, + net::ip::tcp::endpoint const &) const; + }; + + { + struct handler + { + void + operator()(error_code const &, + net::ip::tcp::endpoint const &) const; + }; + + static_assert(std::is_void::value, ""); + } + + { + struct handler + { + void + operator()(error_code const &, + net::ip::tcp::resolver::results_type::const_iterator); + }; + + static_assert(std::is_void::value, ""); + }; + } + void run() { @@ -1365,6 +1416,7 @@ public: // test for compilation success only boost::ignore_unused(&basic_stream_test::testAwaitableCompilation); #endif + boost::ignore_unused(&basic_stream_test::testConnectionConditionArgs); } };