File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
boost/network/protocol/http Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 19
19
#include < boost/optional.hpp>
20
20
#include < boost/range/algorithm/copy.hpp>
21
21
#include < boost/algorithm/string/compare.hpp>
22
+ #include < boost/version.hpp>
22
23
23
24
namespace boost {
24
25
namespace network {
@@ -138,7 +139,12 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest<Request>)), (OutputIterator))
138
139
*oi = consts::colon_char ();
139
140
*oi = consts::space_char ();
140
141
boost::copy (request.host (), oi);
141
- boost::optional<boost::uint16_t > port_ = port (request).as_optional ();
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
142
148
if (port_) {
143
149
string_type port_str = boost::lexical_cast<string_type>(*port_);
144
150
*oi = consts::colon_char ();
Original file line number Diff line number Diff line change 12
12
#include < boost/optional.hpp>
13
13
#include < boost/cstdint.hpp>
14
14
#include < boost/network/uri/accessors.hpp>
15
+ #include < boost/version.hpp>
15
16
16
17
namespace boost {
17
18
namespace network {
@@ -32,21 +33,19 @@ struct port_wrapper {
32
33
33
34
operator port_type () const { return message_.port (); }
34
35
35
- #if !defined (_MSC_VER)
36
+ #if (_MSC_VER >= 1600 && BOOST_VERSION > 105500 )
36
37
// Because of a breaking change in Boost 1.56 to boost::optional, implicit
37
38
// 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.
41
- operator boost::optional<boost::uint16_t >() const {
39
+ // has to be done explicitly with as_optional().
40
+ boost::optional<boost::uint16_t > as_optional () const {
42
41
return uri::port_us (message_.uri ());
43
42
}
44
- #endif
45
-
46
- boost::optional<boost::uint16_t > as_optional () const {
43
+ #else
44
+ operator boost::optional<boost::uint16_t >() const {
47
45
return uri::port_us (message_.uri ());
48
46
}
49
-
47
+ #endif
48
+
50
49
};
51
50
52
51
} // namespace impl
You can’t perform that action at this time.
0 commit comments