mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +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
|
||||
* 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
|
||||
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]
|
||||
|
||||
|
@ -849,7 +849,7 @@ struct message
|
||||
#else
|
||||
detail::value_type_t<Body>&
|
||||
#endif
|
||||
body() noexcept
|
||||
body()& noexcept
|
||||
{
|
||||
return this->member();
|
||||
}
|
||||
@ -860,11 +860,33 @@ struct message
|
||||
#else
|
||||
detail::value_type_t<Body> const&
|
||||
#endif
|
||||
body() const noexcept
|
||||
body() const& noexcept
|
||||
{
|
||||
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:
|
||||
static_assert(is_body<Body>::value,
|
||||
"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
|
||||
testSwap()
|
||||
{
|
||||
@ -477,6 +505,7 @@ public:
|
||||
{
|
||||
testMessage();
|
||||
testMessageCtors();
|
||||
testBody();
|
||||
testSwap();
|
||||
testSpecialMembers();
|
||||
testMethod();
|
||||
|
Reference in New Issue
Block a user