Skip to content

Commit 6e7c42b

Browse files
committed
get_impl is now private
1 parent 6c6bcd0 commit 6e7c42b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

include/boost/redis/adapter/any_adapter.hpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@
1010

1111
#include <boost/redis/resp3/node.hpp>
1212
#include <boost/redis/adapter/adapt.hpp>
13-
#include <boost/system/detail/error_code.hpp>
13+
#include <boost/system/error_code.hpp>
1414
#include <cstddef>
1515
#include <functional>
1616
#include <string_view>
1717
#include <type_traits>
1818

1919
namespace boost::redis {
2020

21+
namespace detail {
22+
23+
// Forward decl
24+
template <class Executor>
25+
class connection_base;
26+
27+
}
28+
2129
class any_adapter
2230
{
2331
using fn_type = std::function<void(std::size_t, resp3::basic_node<std::string_view> const&, system::error_code&)>;
@@ -36,12 +44,12 @@ class any_adapter
3644
return { std::move(adapter), size };
3745
}
3846

47+
template <class Executor>
48+
friend class detail::connection_base;
49+
3950
public:
4051
template <class T, class = std::enable_if_t<!std::is_same_v<T, any_adapter>>>
4152
explicit any_adapter(T& response) : impl_(create_impl(response)) {}
42-
43-
// TODO: make this private
44-
auto get_impl() && { return std::move(impl_); }
4553
};
4654

4755
}

include/boost/redis/detail/connection_base.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@ class connection_base {
445445
}
446446

447447
template <class CompletionToken>
448-
auto async_exec(request const& req, any_adapter adapter, CompletionToken&& token)
448+
auto async_exec(request const& req, any_adapter&& adapter, CompletionToken&& token)
449449
{
450-
auto adapter_impl = std::move(adapter).get_impl();
450+
auto& adapter_impl = adapter.impl_;
451451
BOOST_ASSERT_MSG(req.get_expected_responses() <= adapter_impl.supported_response_size, "Request and response have incompatible sizes.");
452452

453453
auto info = std::make_shared<req_info>(req, std::move(adapter_impl.adapt_fn), get_executor());

0 commit comments

Comments
 (0)