Skip to content

Update boost to std #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ add_definitions(-DBOOST_TEST_DYN_LINK)
set(Boost_USE_MULTI_THREADED ON)

find_package(Boost 1.57.0
REQUIRED system regex date_time thread filesystem program_options chrono
atomic)
REQUIRED system thread filesystem program_options)

if (CPP-NETLIB_ENABLE_HTTPS)
find_package( OpenSSL )
Expand Down
4 changes: 2 additions & 2 deletions boost/network/message/directives/detail/string_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/network/traits/string.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
Expand All @@ -20,7 +20,7 @@ namespace detail {

template <class Tag>
struct string_value
: mpl::if_<is_async<Tag>, boost::shared_future<typename string<Tag>::type>,
: mpl::if_<is_async<Tag>, std::shared_future<typename string<Tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<Tag>, is_same<Tag, tags::default_string>,
is_same<Tag, tags::default_wstring> >,
Expand Down
3 changes: 1 addition & 2 deletions boost/network/message/directives/header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <boost/network/support/is_async.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/thread/future.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/variant/apply_visitor.hpp>
Expand Down Expand Up @@ -50,7 +49,7 @@ struct header_directive {

template <class Message>
struct directive_impl
: mpl::if_<is_base_of<tags::pod, typename Message::tag>,
: mpl::if_<std::is_base_of<tags::pod, typename Message::tag>,
pod_directive<Message>, normal_directive<Message> >::type {};

template <class Message>
Expand Down
1 change: 0 additions & 1 deletion boost/network/message/modifiers/body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/network/support/pod_or_normal.hpp>
#include <boost/thread/future.hpp>

namespace boost {
namespace network {
Expand Down
6 changes: 3 additions & 3 deletions boost/network/message/modifiers/clear_headers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_pod.hpp>
#include <boost/thread/future.hpp>
#include <boost/utility/enable_if.hpp>

namespace boost {
Expand All @@ -34,8 +34,8 @@ template <class Message, class Tag>
inline typename enable_if<mpl::and_<mpl::not_<is_pod<Tag> >, is_async<Tag> >,
void>::type
clear_headers(Message const &message, Tag const &) {
boost::promise<typename Message::headers_container_type> header_promise;
boost::shared_future<typename Message::headers_container_type> headers_future(
std::promise<typename Message::headers_container_type> header_promise;
std::shared_future<typename Message::headers_container_type> headers_future(
header_promise.get_future());
message.headers(headers_future);
header_promise.set_value(typename Message::headers_container_type());
Expand Down
1 change: 0 additions & 1 deletion boost/network/message/modifiers/destination.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/network/support/is_async.hpp>
#include <boost/thread/future.hpp>

namespace boost {
namespace network {
Expand Down
4 changes: 2 additions & 2 deletions boost/network/message/traits/body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>

namespace boost {
Expand All @@ -27,7 +27,7 @@ template <class Message>
struct body
: mpl::if_<
is_async<typename Message::tag>,
shared_future<typename string<typename Message::tag>::type>,
std::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag,
Expand Down
4 changes: 2 additions & 2 deletions boost/network/message/traits/destination.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>

namespace boost {
Expand All @@ -26,7 +26,7 @@ struct unsupported_tag;
template <class Message>
struct destination
: mpl::if_<is_async<typename Message::tag>,
shared_future<typename string<typename Message::tag>::type>,
std::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag,
Expand Down
5 changes: 3 additions & 2 deletions boost/network/message/traits/headers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/network/message/directives.hpp>
Expand All @@ -27,7 +28,7 @@ template <class Message>
struct header_key
: mpl::if_<
is_async<typename Message::tag>,
boost::shared_future<typename string<typename Message::tag>::type>,
std::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag, tags::default_string>,
Expand All @@ -39,7 +40,7 @@ template <class Message>
struct header_value
: mpl::if_<
is_async<typename Message::tag>,
boost::shared_future<typename string<typename Message::tag>::type>,
std::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag, tags::default_string>,
Expand Down
4 changes: 2 additions & 2 deletions boost/network/message/traits/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <future>
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/thread/future.hpp>
#include <boost/type_traits/is_same.hpp>

namespace boost {
Expand All @@ -24,7 +24,7 @@ struct unsupported_tag;
template <class Message>
struct source
: mpl::if_<is_async<typename Message::tag>,
shared_future<typename string<typename Message::tag>::type>,
std::shared_future<typename string<typename Message::tag>::type>,
typename mpl::if_<
mpl::or_<is_sync<typename Message::tag>,
is_same<typename Message::tag,
Expand Down
12 changes: 5 additions & 7 deletions boost/network/protocol/http/algorithms/linearize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

#include <algorithm>
#include <bitset>
#include <cstdint>
#include <boost/algorithm/string/compare.hpp>
#include <boost/concept/requires.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/network/constants.hpp>
#include <boost/network/message/wrappers/body.hpp>
#include <boost/network/protocol/http/message/header/name.hpp>
Expand Down Expand Up @@ -86,10 +86,8 @@ OutputIterator linearize(Request const& request,
}
*oi = consts::space_char();
boost::copy(http_slash, oi);
string_type version_major_str =
boost::lexical_cast<string_type>(version_major),
version_minor_str =
boost::lexical_cast<string_type>(version_minor);
string_type version_major_str = std::to_string(version_major),
version_minor_str = std::to_string(version_minor);
boost::copy(version_major_str, oi);
*oi = consts::dot_char();
boost::copy(version_minor_str, oi);
Expand Down Expand Up @@ -137,14 +135,14 @@ OutputIterator linearize(Request const& request,
*oi = consts::colon_char();
*oi = consts::space_char();
boost::copy(request.host(), oi);
boost::optional<boost::uint16_t> port_ =
boost::optional<std::uint16_t> port_ =
#if (_MSC_VER >= 1600 && BOOST_VERSION > 105500)
port(request).as_optional();
#else
port(request);
#endif
if (port_) {
string_type port_str = boost::lexical_cast<string_type>(*port_);
string_type port_str = std::to_string(*port_);
*oi = consts::colon_char();
boost::copy(port_str, oi);
}
Expand Down
2 changes: 0 additions & 2 deletions boost/network/protocol/http/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <boost/asio/io_service.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <istream>
#include <map>
#include <ostream>
Expand Down
24 changes: 11 additions & 13 deletions boost/network/protocol/http/client/async_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <thread>
#include <memory>
#include <functional>
#include <boost/asio/io_service.hpp>
#include <boost/asio/strand.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/network/protocol/http/traits/connection_policy.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/thread.hpp>

namespace boost {
namespace network {
Expand All @@ -32,14 +31,14 @@ struct async_client
typedef typename resolver<Tag>::type resolver_type;
typedef typename string<Tag>::type string_type;

typedef function<void(boost::iterator_range<char const*> const&,
typedef std::function<void(boost::iterator_range<char const*> const&,
system::error_code const&)> body_callback_function_type;

typedef function<bool(string_type&)> body_generator_function_type;
typedef std::function<bool(string_type&)> body_generator_function_type;

async_client(bool cache_resolved, bool follow_redirect,
bool always_verify_peer, int timeout,
boost::shared_ptr<boost::asio::io_service> service,
std::shared_ptr<boost::asio::io_service> service,
optional<string_type> certificate_filename,
optional<string_type> verify_path,
optional<string_type> certificate_file,
Expand All @@ -48,7 +47,7 @@ struct async_client
: connection_base(cache_resolved, follow_redirect, timeout),
service_ptr(service.get()
? service
: boost::make_shared<boost::asio::io_service>()),
: std::make_shared<boost::asio::io_service>()),
service_(*service_ptr),
resolver_(service_),
sentinel_(new boost::asio::io_service::work(service_)),
Expand All @@ -62,8 +61,7 @@ struct async_client
connection_base::resolver_strand_.reset(
new boost::asio::io_service::strand(service_));
if (!service)
lifetime_thread_.reset(new boost::thread(
boost::bind(&boost::asio::io_service::run, &service_)));
lifetime_thread_.reset(new std::thread([this] () { service_.run(); }));
}

~async_client() throw() = default;
Expand All @@ -89,11 +87,11 @@ struct async_client
generator);
}

boost::shared_ptr<boost::asio::io_service> service_ptr;
std::shared_ptr<boost::asio::io_service> service_ptr;
boost::asio::io_service& service_;
resolver_type resolver_;
boost::shared_ptr<boost::asio::io_service::work> sentinel_;
boost::shared_ptr<boost::thread> lifetime_thread_;
std::shared_ptr<boost::asio::io_service::work> sentinel_;
std::shared_ptr<std::thread> lifetime_thread_;
optional<string_type> certificate_filename_;
optional<string_type> verify_path_;
optional<string_type> certificate_file_;
Expand Down
7 changes: 4 additions & 3 deletions boost/network/protocol/http/client/connection/async_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <functional>
#include <boost/network/protocol/http/client/connection/connection_delegate_factory.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/traits/delegate_factory.hpp>
Expand All @@ -29,10 +30,10 @@ struct async_connection_base {
typedef basic_request<Tag> request;
typedef basic_response<Tag> response;
typedef iterator_range<char const *> char_const_range;
typedef function<void(char_const_range const &, system::error_code const &)>
typedef std::function<void(char_const_range const &, system::error_code const &)>
body_callback_function_type;
typedef function<bool(string_type &)> body_generator_function_type;
typedef shared_ptr<this_type> connection_ptr;
typedef std::function<bool(string_type &)> body_generator_function_type;
typedef std::shared_ptr<this_type> connection_ptr;

// This is the factory function which constructs the appropriate async
// connection implementation with the correct delegate chosen based on the
Expand Down
Loading