Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4be4eae

Browse files
committed
Issue identified with memory sanitizer
1 parent2f2239c commit4be4eae

File tree

1 file changed

+47
-54
lines changed

1 file changed

+47
-54
lines changed

‎boost/network/message.hpp

Lines changed: 47 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
#ifndef__NETWORK_MESSAGE_HPP__
7-
#define__NETWORK_MESSAGE_HPP__
6+
#ifndefBOOST_NETWORK_MESSAGE_HPP__
7+
#defineBOOST_NETWORK_MESSAGE_HPP__
88

9-
#include<boost/network/message_fwd.hpp>
10-
#include<boost/network/traits/string.hpp>
11-
#include<boost/utility/enable_if.hpp>
129
#include<boost/network/detail/directive_base.hpp>
1310
#include<boost/network/detail/wrapper_base.hpp>
1411
#include<boost/network/message/directives.hpp>
15-
#include<boost/network/message/wrappers.hpp>
16-
#include<boost/network/message/transformers.hpp>
17-
12+
#include<boost/network/message/message_concept.hpp>
1813
#include<boost/network/message/modifiers/add_header.hpp>
19-
#include<boost/network/message/modifiers/remove_header.hpp>
14+
#include<boost/network/message/modifiers/body.hpp>
2015
#include<boost/network/message/modifiers/clear_headers.hpp>
21-
#include<boost/network/message/modifiers/source.hpp>
2216
#include<boost/network/message/modifiers/destination.hpp>
23-
#include<boost/network/message/modifiers/body.hpp>
24-
25-
#include<boost/network/message/message_concept.hpp>
17+
#include<boost/network/message/modifiers/remove_header.hpp>
18+
#include<boost/network/message/modifiers/source.hpp>
19+
#include<boost/network/message/transformers.hpp>
20+
#include<boost/network/message/wrappers.hpp>
21+
#include<boost/network/message_fwd.hpp>
22+
#include<boost/network/traits/string.hpp>
23+
#include<boost/utility/enable_if.hpp>
2624

2725
/** message.hpp
2826
*
@@ -46,72 +44,67 @@ struct basic_message {
4644
typedeftypename headers_container_type::value_type header_type;
4745
typedeftypename string<Tag>::type string_type;
4846

49-
basic_message() : _headers(), _body(), _source(), _destination() {}
50-
51-
basic_message(const basic_message& other)
52-
: _headers(other._headers),
53-
_body(other._body),
54-
_source(other._source),
55-
_destination(other._destination) {}
56-
57-
basic_message&operator=(basic_message<Tag> rhs) {
58-
rhs.swap(*this);
59-
return *this;
60-
}
47+
basic_message() =default;
48+
basic_message(const basic_message&) =default;
49+
basic_message(basic_message&&)noexcept =default;
50+
basic_message&operator=(basic_messageconst&) =default;
51+
basic_message&operator=(basic_message&&) =default;
52+
~basic_message() =default;
6153

6254
voidswap(basic_message<Tag>& other) {
63-
std::swap(other._headers, _headers);
64-
std::swap(other._body, _body);
65-
std::swap(other._source, _source);
66-
std::swap(other._destination, _destination);
55+
using std::swap;
56+
swap(other.headers_, headers_);
57+
swap(other.body_, body_);
58+
swap(other.source_, source_);
59+
swap(other.destination_, destination_);
6760
}
6861

69-
headers_container_type&headers() {return_headers; }
62+
headers_container_type&headers() {returnheaders_; }
7063

71-
voidheaders(headers_container_typeconst& headers_)const {
72-
_headers =headers_;
64+
voidheaders(headers_container_typeheaders)const {
65+
headers_ =std::move(headers);
7366
}
7467

75-
voidadd_header(typename headers_container_type::value_typeconst& pair_)
76-
const {
77-
_headers.insert(pair_);
68+
voidadd_header(
69+
typename headers_container_type::value_typeconst& pair_)const {
70+
headers_.insert(pair_);
7871
}
7972

80-
voidremove_header(typename headers_container_type::key_typeconst& key)
81-
const {
82-
_headers.erase(key);
73+
voidremove_header(
74+
typename headers_container_type::key_typeconst& key)const {
75+
headers_.erase(key);
8376
}
8477

85-
headers_container_typeconst&headers()const {return_headers; }
78+
headers_container_typeconst&headers()const {returnheaders_; }
8679

87-
string_type&body() {return_body; }
80+
string_type&body() {returnbody_; }
8881

89-
voidbody(string_typeconst& body_)const {_body =body_; }
82+
voidbody(string_typebody)const {body_ =std::move(body); }
9083

91-
string_typeconst&body()const {return_body; }
84+
string_typeconst&body()const {returnbody_; }
9285

93-
string_type&source() {return_source; }
86+
string_type&source() {returnsource_; }
9487

95-
voidsource(string_typeconst& source_)const {_source =source_; }
88+
voidsource(string_typesource)const {source_ =std::move(source); }
9689

97-
string_typeconst&source()const {return_source; }
90+
string_typeconst&source()const {returnsource_; }
9891

99-
string_type&destination() {return_destination; }
92+
string_type&destination() {returndestination_; }
10093

101-
voiddestination(string_typeconst& destination_)const {
102-
_destination =destination_;
94+
voiddestination(string_typedestination)const {
95+
destination_ =std::move(destination);
10396
}
10497

105-
string_typeconst&destination()const {return_destination; }
98+
string_typeconst&destination()const {returndestination_; }
10699

107100
private:
108101
friendstructdetail::directive_base<Tag>;
109102
friendstructdetail::wrapper_base<Tag, basic_message<Tag> >;
110103

111-
mutable headers_container_type_headers;
112-
mutable string_type_body;
113-
mutable string_type_source;
114-
mutable string_type_destination;
104+
mutable headers_container_typeheaders_;
105+
mutable string_typebody_;
106+
mutable string_typesource_;
107+
mutable string_typedestination_;
115108
};
116109

117110
template<classTag>
@@ -131,4 +124,4 @@ typedef basic_message<tags::default_wstring> wmessage;
131124
}// namespace network
132125
}// namespace boost
133126

134-
#endif//__NETWORK_MESSAGE_HPP__
127+
#endif//BOOST_NETWORK_MESSAGE_HPP__

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp