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

Commit5368f89

Browse files
author
Jussi Lyytinen
committed
Fix for issuecpp-netlib#419
1 parentd4070db commit5368f89

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

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

Lines changed: 2 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)
@@ -137,7 +138,7 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest<Request>)), (OutputIterator))
137138
*oi =consts::colon_char();
138139
*oi =consts::space_char();
139140
boost::copy(request.host(), oi);
140-
boost::optional<boost::uint16_t> port_ =port(request);
141+
boost::optional<boost::uint16_t> port_ =port(request).as_optional();
141142
if (port_) {
142143
string_type port_str = boost::lexical_cast<string_type>(*port_);
143144
*oi =consts::colon_char();

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
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)
@@ -31,23 +32,20 @@ struct port_wrapper {
3132

3233
operatorport_type()const {return message_.port(); }
3334

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()));
45-
}
46-
#else
35+
#if !defined(_MSC_VER)
36+
// Because of a breaking change in Boost 1.56 to boost::optional, implicit
37+
// conversions no longer work correctly with MSVC. The conversion therefore
38+
// has to be done explicitly with as_optional(). This method is here just
39+
// to maintain backwards compatibility with compilers not affected by the
40+
// change.
4741
operator boost::optional<boost::uint16_t>()const {
4842
returnuri::port_us(message_.uri());
4943
}
5044
#endif
45+
46+
boost::optional<boost::uint16_t>as_optional()const {
47+
returnuri::port_us(message_.uri());
48+
}
5149

5250
};
5351

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp