From c2d3532da20f7e2bd97a0010f6caefbe6315303c Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 23 Jun 2017 06:35:08 -0700 Subject: [PATCH] Tidy up message piecewise ctors --- CHANGELOG.md | 1 + include/beast/http/message.hpp | 40 +++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4da4c6cb..e0de2360 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Version 66: * Fix costly potential value-init in parser * Fix unused parameter warning * Handle bad_alloc in parser +* Tidy up message piecewise ctors -------------------------------------------------------------------------------- diff --git a/include/beast/http/message.hpp b/include/beast/http/message.hpp index fdb13461..f709baae 100644 --- a/include/beast/http/message.hpp +++ b/include/beast/http/message.hpp @@ -536,23 +536,37 @@ private: static_assert(is_body::value, "Body requirements not met"); - template - message(std::piecewise_construct_t, - std::tuple& tu, - beast::detail::index_sequence) - : body(std::forward(std::get(tu))...) + template< + class... BodyArgs, + std::size_t... IBodyArgs> + message( + std::piecewise_construct_t, + std::tuple& body_args, + beast::detail::index_sequence) + : body(std::forward( + std::get(body_args))...) { + boost::ignore_unused(body_args); } - template - message(std::piecewise_construct_t, - std::tuple& tu, std::tuple& tv, - beast::detail::index_sequence, - beast::detail::index_sequence) - : header_type(std::forward(std::get(tv))...) - , body(std::forward(std::get(tu))...) + template< + class... BodyArgs, + class... FieldsArgs, + std::size_t... IBodyArgs, + std::size_t... IFieldsArgs> + message( + std::piecewise_construct_t, + std::tuple& body_args, + std::tuple& fields_args, + beast::detail::index_sequence, + beast::detail::index_sequence) + : header_type(std::forward( + std::get(fields_args))...) + , body(std::forward( + std::get(body_args))...) { + boost::ignore_unused(body_args); + boost::ignore_unused(fields_args); } boost::optional