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

Commit3229d2a

Browse files
committed
Merge pull request#446 from lyytinen/0.11-devel-fix-for-419
Fix for issue#419
2 parents03b34d6 +36cf176 commit3229d2a

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

‎boost/network/protocol/http/algorithms/linearize.hpp‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#defineBOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028
33

44
// Copyright 2010 Dean Michael Berris.
5+
// Copyright 2014 Jussi Lyytinen
56
// Distributed under the Boost Software License, Version 1.0.
67
// (See accompanying file LICENSE_1_0.txt or copy at
78
// http://www.boost.org/LICENSE_1_0.txt)
@@ -18,6 +19,7 @@
1819
#include<boost/optional.hpp>
1920
#include<boost/range/algorithm/copy.hpp>
2021
#include<boost/algorithm/string/compare.hpp>
22+
#include<boost/version.hpp>
2123

2224
namespaceboost {
2325
namespacenetwork {
@@ -137,7 +139,12 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest<Request>)), (OutputIterator))
137139
*oi =consts::colon_char();
138140
*oi =consts::space_char();
139141
boost::copy(request.host(), oi);
140-
boost::optional<boost::uint16_t> port_ =port(request);
142+
boost::optional<boost::uint16_t> port_ =
143+
#if (_MSC_VER >= 1600 && BOOST_VERSION > 105500)
144+
port(request).as_optional();
145+
#else
146+
port(request);
147+
#endif
141148
if (port_) {
142149
string_type port_str = boost::lexical_cast<string_type>(*port_);
143150
*oi =consts::colon_char();

‎boost/network/protocol/http/message/wrappers/port.hpp‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
// Copyright 2010, 2014 Dean Michael Berris <dberris@google.com>
55
// Copyright 2010 (c) Sinefunc, Inc.
66
// Copyright 2014 Google, Inc.
7+
// Copyright 2014 Jussi Lyytinen
78
// Distributed under the Boost Software License, Version 1.0.
89
// (See accompanying file LICENSE_1_0.txt or copy at
910
// http://www.boost.org/LICENSE_1_0.txt)
1011

1112
#include<boost/optional.hpp>
1213
#include<boost/cstdint.hpp>
1314
#include<boost/network/uri/accessors.hpp>
15+
#include<boost/version.hpp>
1416

1517
namespaceboost {
1618
namespacenetwork {
@@ -31,24 +33,19 @@ struct port_wrapper {
3133

3234
operatorport_type()const {return message_.port(); }
3335

34-
#if (_MSC_VER >= 1600)
35-
// We hack this so that we don't run into the issue of MSVC 2010 not doing the
36-
// right thing when converting/copying Boost.Optional objects.
37-
structoptional_wrapper {
38-
boost::optional<boost::uint16_t> o_;
39-
explicitoptional_wrapper(boost::optional<boost::uint16_t> o) : o_(o) {}
40-
operator boost::optional<boost::uint16_t>()const {return o_; }
41-
};
42-
43-
operatoroptional_wrapper()const {
44-
returnoptional_wrapper(uri::port_us(message_.uri()));
36+
#if (_MSC_VER >= 1600 && BOOST_VERSION > 105500)
37+
// Because of a breaking change in Boost 1.56 to boost::optional, implicit
38+
// conversions no longer work correctly with MSVC. The conversion therefore
39+
// has to be done explicitly with as_optional().
40+
boost::optional<boost::uint16_t>as_optional()const {
41+
returnuri::port_us(message_.uri());
4542
}
4643
#else
4744
operator boost::optional<boost::uint16_t>()const {
4845
returnuri::port_us(message_.uri());
4946
}
5047
#endif
51-
48+
5249
};
5350

5451
}// namespace impl

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp