mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 05:17:26 +02:00
Add ref-qualified overloads for message::body
This commit is contained in:
@ -2,6 +2,7 @@ Version 132:
|
|||||||
|
|
||||||
* Tidy up project folders in CMakeLists.txt
|
* Tidy up project folders in CMakeLists.txt
|
||||||
* Rename Cmake variables for clarity
|
* Rename Cmake variables for clarity
|
||||||
|
* Add ref-qualified overloads for message::body
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 50 KiB |
@ -106,7 +106,7 @@ member functions of `Fields`. This diagram shows the inheritance
|
|||||||
relationship between header and message, along with some of the
|
relationship between header and message, along with some of the
|
||||||
notable differences in members in each partial specialization:
|
notable differences in members in each partial specialization:
|
||||||
|
|
||||||
[$beast/images/message.png [width 730px] [height 410px]]
|
[$beast/images/message.png [width 730px] [height 459px]]
|
||||||
|
|
||||||
[heading:body Body Types]
|
[heading:body Body Types]
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ struct message
|
|||||||
#else
|
#else
|
||||||
detail::value_type_t<Body>&
|
detail::value_type_t<Body>&
|
||||||
#endif
|
#endif
|
||||||
body() noexcept
|
body()& noexcept
|
||||||
{
|
{
|
||||||
return this->member();
|
return this->member();
|
||||||
}
|
}
|
||||||
@ -860,11 +860,33 @@ struct message
|
|||||||
#else
|
#else
|
||||||
detail::value_type_t<Body> const&
|
detail::value_type_t<Body> const&
|
||||||
#endif
|
#endif
|
||||||
body() const noexcept
|
body() const& noexcept
|
||||||
{
|
{
|
||||||
return this->member();
|
return this->member();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the body
|
||||||
|
#if BOOST_BEAST_DOXYGEN || ! defined(BOOST_MSVC)
|
||||||
|
typename body_type::value_type&&
|
||||||
|
#else
|
||||||
|
detail::value_type_t<Body>&&
|
||||||
|
#endif
|
||||||
|
body()&& noexcept
|
||||||
|
{
|
||||||
|
return std::move(this->member());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the body
|
||||||
|
#if BOOST_BEAST_DOXYGEN || ! defined(BOOST_MSVC)
|
||||||
|
typename body_type::value_type const&&
|
||||||
|
#else
|
||||||
|
detail::value_type_t<Body> const&&
|
||||||
|
#endif
|
||||||
|
body() const&& noexcept
|
||||||
|
{
|
||||||
|
return std::move(this->member());
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static_assert(is_body<Body>::value,
|
static_assert(is_body<Body>::value,
|
||||||
"Body requirements not met");
|
"Body requirements not met");
|
||||||
|
@ -273,6 +273,34 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testBody()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto f = [](empty_body::value_type&){};
|
||||||
|
request<empty_body> m;
|
||||||
|
f(m.body());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto f = [](empty_body::value_type const&){};
|
||||||
|
request<empty_body> const m;
|
||||||
|
f(m.body());
|
||||||
|
f(std::move(m.body()));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto f = [](empty_body::value_type&&){};
|
||||||
|
request<empty_body> m;
|
||||||
|
f(std::move(m).body());
|
||||||
|
f(std::move(m.body()));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto f = [](empty_body::value_type const&&){};
|
||||||
|
request<empty_body> const m;
|
||||||
|
f(std::move(m).body());
|
||||||
|
f(std::move(m.body()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
testSwap()
|
testSwap()
|
||||||
{
|
{
|
||||||
@ -477,6 +505,7 @@ public:
|
|||||||
{
|
{
|
||||||
testMessage();
|
testMessage();
|
||||||
testMessageCtors();
|
testMessageCtors();
|
||||||
|
testBody();
|
||||||
testSwap();
|
testSwap();
|
||||||
testSpecialMembers();
|
testSpecialMembers();
|
||||||
testMethod();
|
testMethod();
|
||||||
|
Reference in New Issue
Block a user