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

Commit9c0f914

Browse files
committed
Workaround Boost.Optional 1.56.0 MSVC 2010 Issue
This change takes the advice of the Boost.Optional maintainer whenworking around the breaking changes in Boost.Optional 1.56.0 --apparently MSVC has a bug in copy-construction resolution whichconsiders multiple conversions (not a standard-conforming extension)and because of changes to the Boost.Optional interface is being hit.This commit only works around the MSVC 2010 compiler. It may be thatthe bug is also in newer versions of the compiler, but that I'm lesssure about.
1 parent731a7a8 commit9c0f914

File tree

1 file changed

+21
-5
lines changed
  • boost/network/protocol/http/message/wrappers

1 file changed

+21
-5
lines changed

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_PORT_HPP_20100618
22
#defineBOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_PORT_HPP_20100618
33

4-
// Copyright 2010 (c) Dean Michael Berris.
4+
// Copyright 2010, 2014 Dean Michael Berris <dberris@google.com>
55
// Copyright 2010 (c) Sinefunc, Inc.
6+
// Copyright 2014 Google, Inc.
67
// Distributed under the Boost Software License, Version 1.0.
78
// (See accompanying file LICENSE_1_0.txt or copy at
89
// http://www.boost.org/LICENSE_1_0.txt)
910

1011
#include<boost/optional.hpp>
12+
#include<boost/cstdint.hpp>
13+
#include<boost/network/uri/accessors.hpp>
1114

1215
namespaceboost {
1316
namespacenetwork {
@@ -26,11 +29,26 @@ struct port_wrapper {
2629

2730
typedeftypename basic_request<Tag>::port_type port_type;
2831

29-
operatorport_type() {return message_.port(); }
32+
operatorport_type()const{return message_.port(); }
3033

31-
operator boost::optional<boost::uint16_t>() {
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>() {return o_; }
41+
};
42+
43+
operatoroptional_wrapper()const {
44+
returnoptional_wrapper(uri::port_us(message_.uri()));
45+
}
46+
#else
47+
operator boost::optional<boost::uint16_t>()const {
3248
returnuri::port_us(message_.uri());
3349
}
50+
#endif
51+
3452
};
3553

3654
}// namespace impl
@@ -41,9 +59,7 @@ inline impl::port_wrapper<Tag> port(basic_request<Tag> const& request) {
4159
}
4260

4361
}// namespace http
44-
4562
}// namespace network
46-
4763
}// namespace boost
4864

4965
#endif// BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_PORT_HPP_20100618

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp