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 1 commit
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
Prev Previous commit
Replaced boost::tuple and boost::fusion::tuple with std::tuple.
  • Loading branch information
glynos committed Jan 30, 2016
commit af55a2f32c087ac42847e7b41ffba3bc60cfc6e0
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ struct http_async_connection
// the buffer. We need this in the body processing to make sure that
// the data remaining in the buffer is dealt with before another call
// to get more data for the body is scheduled.
fusion::tie(parsed_ok, remainder) = this->parse_headers(
std::tie(parsed_ok, remainder) = this->parse_headers(
delegate_,
request_strand_.wrap([=] (boost::system::error_code const &ec,
std::size_t bytes_transferred) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include <iterator>
#include <cstdint>
#include <array>
#include <boost/fusion/tuple/tuple.hpp>
#include <boost/fusion/tuple/tuple_tie.hpp>
#include <boost/logic/tribool.hpp>
#include <boost/network/detail/debug.hpp>
#include <boost/network/protocol/http/algorithms/linearize.hpp>
Expand Down Expand Up @@ -110,7 +108,7 @@ struct http_async_protocol_handler {
typename boost::iterator_range<typename buffer_type::const_iterator>
result_range,
input_range = boost::make_iterator_range(part_begin, part_end);
fusion::tie(parsed_ok, result_range) = response_parser_.parse_until(
std::tie(parsed_ok, result_range) = response_parser_.parse_until(
response_parser_type::http_version_done, input_range);
if (parsed_ok == true) {
string_type version;
Expand Down Expand Up @@ -156,7 +154,7 @@ struct http_async_protocol_handler {
typename boost::iterator_range<typename buffer_type::const_iterator>
result_range,
input_range = boost::make_iterator_range(part_begin, part_end);
fusion::tie(parsed_ok, result_range) = response_parser_.parse_until(
std::tie(parsed_ok, result_range) = response_parser_.parse_until(
response_parser_type::http_status_done, input_range);
if (parsed_ok == true) {
string_type status;
Expand Down Expand Up @@ -202,7 +200,7 @@ struct http_async_protocol_handler {
typename boost::iterator_range<typename buffer_type::const_iterator>
result_range,
input_range = boost::make_iterator_range(part_begin, part_end);
fusion::tie(parsed_ok, result_range) = response_parser_.parse_until(
std::tie(parsed_ok, result_range) = response_parser_.parse_until(
response_parser_type::http_status_message_done, input_range);
if (parsed_ok == true) {
string_type status_message;
Expand Down Expand Up @@ -248,14 +246,14 @@ struct http_async_protocol_handler {
typename headers_container<Tag>::type headers;
std::pair<string_type, string_type> header_pair;
while (!boost::empty(input_range)) {
fusion::tie(parsed_ok, result_range) = headers_parser.parse_until(
std::tie(parsed_ok, result_range) = headers_parser.parse_until(
response_parser_type::http_header_colon, input_range);
if (headers_parser.state() != response_parser_type::http_header_colon)
break;
header_pair.first =
string_type(std::begin(result_range), std::end(result_range));
input_range.advance_begin(boost::distance(result_range));
fusion::tie(parsed_ok, result_range) = headers_parser.parse_until(
std::tie(parsed_ok, result_range) = headers_parser.parse_until(
response_parser_type::http_header_line_done, input_range);
header_pair.second =
string_type(std::begin(result_range), std::end(result_range));
Expand All @@ -279,16 +277,16 @@ struct http_async_protocol_handler {
}

template <class Delegate, class Callback>
fusion::tuple<logic::tribool, size_t> parse_headers(Delegate& delegate_,
Callback callback,
size_t bytes) {
std::tuple<logic::tribool, size_t> parse_headers(Delegate& delegate_,
Callback callback,
size_t bytes) {
logic::tribool parsed_ok;
typename buffer_type::const_iterator part_end = part.begin();
std::advance(part_end, bytes);
typename boost::iterator_range<typename buffer_type::const_iterator>
result_range,
input_range = boost::make_iterator_range(part_begin, part_end);
fusion::tie(parsed_ok, result_range) = response_parser_.parse_until(
std::tie(parsed_ok, result_range) = response_parser_.parse_until(
response_parser_type::http_headers_done, input_range);
if (parsed_ok == true) {
string_type headers_string;
Expand Down Expand Up @@ -322,7 +320,7 @@ struct http_async_protocol_handler {
boost::asio::mutable_buffers_1(part.data(), part.size()),
callback);
}
return fusion::make_tuple(
return std::make_tuple(
parsed_ok, std::distance(std::end(result_range), part_end));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <boost/asio/write.hpp>
#include <boost/asio/read_until.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/tuple/tuple.hpp>

#include <boost/network/protocol/http/client/connection/sync_normal.hpp>
#ifdef BOOST_NETWORK_ENABLE_HTTPS
Expand Down
8 changes: 4 additions & 4 deletions boost/network/protocol/http/parser/incremental.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <iterator>
#include <tuple>
#include <boost/algorithm/string/classification.hpp>
#include <boost/fusion/tuple.hpp>
#include <boost/logic/tribool.hpp>
#include <boost/network/tags.hpp>
#include <boost/network/traits/string.hpp>
Expand Down Expand Up @@ -64,7 +64,7 @@ struct response_parser {
}

template <class Range>
fusion::tuple<logic::tribool, iterator_range<typename Range::const_iterator> >
std::tuple<logic::tribool, iterator_range<typename Range::const_iterator> >
parse_until(state_t stop_state, Range& range_) {
logic::tribool parsed_ok(logic::indeterminate);
typename Range::const_iterator start = std::begin(range_),
Expand Down Expand Up @@ -293,8 +293,8 @@ struct response_parser {
}
if (state_ == stop_state) { parsed_ok = true;
}
return fusion::make_tuple(parsed_ok,
boost::make_iterator_range(start, current));
return std::make_tuple(parsed_ok,
boost::make_iterator_range(start, current));
}

state_t state() { return state_; }
Expand Down
1 change: 0 additions & 1 deletion boost/network/protocol/http/policies/async_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <boost/network/protocol/http/message/wrappers/protocol.hpp>
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
#include <boost/network/version.hpp>
#include <boost/tuple/tuple.hpp>

namespace boost {
namespace network {
Expand Down
3 changes: 1 addition & 2 deletions boost/network/protocol/http/policies/async_resolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <boost/network/protocol/http/traits/resolver.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/fusion/tuple/tuple_tie.hpp>

namespace boost {
namespace network {
Expand Down Expand Up @@ -78,7 +77,7 @@ struct async_resolver : std::enable_shared_from_this<async_resolver<Tag> > {
typename endpoint_cache::iterator iter;
bool inserted = false;
if (!ec && cache_resolved_) {
boost::fusion::tie(iter, inserted) =
std::tie(iter, inserted) =
endpoint_cache_.insert(std::make_pair(
host, std::make_pair(endpoint_iterator, resolver_iterator())));
once_resolved(ec, iter->second);
Expand Down
1 change: 0 additions & 1 deletion boost/network/protocol/http/policies/simple_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <boost/network/protocol/http/client/connection/sync_base.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/optional/optional.hpp>
#include <boost/tuple/tuple.hpp>

namespace boost {
namespace network {
Expand Down
7 changes: 3 additions & 4 deletions boost/network/protocol/http/policies/sync_resolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <unordered_map>
#include <boost/network/protocol/http/traits/resolver.hpp>
#include <utility>
#include <boost/fusion/adapted/std_pair.hpp>
#include <boost/fusion/include/tuple.hpp>
#include <tuple>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/network/protocol/http/traits/resolver.hpp>
#include <boost/network/traits/string.hpp>

namespace boost {
Expand Down Expand Up @@ -45,7 +44,7 @@ struct sync_resolver {
endpoint_cache_.find(hostname);
if (cached_iterator == endpoint_cache_.end()) {
bool inserted = false;
boost::fusion::tie(cached_iterator, inserted) =
std::tie(cached_iterator, inserted) =
endpoint_cache_.insert(std::make_pair(
boost::to_lower_copy(hostname),
std::make_pair(
Expand Down
8 changes: 4 additions & 4 deletions boost/network/protocol/http/request_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#ifndef HTTP_SERVER3_REQUEST_PARSER_HPP
#define HTTP_SERVER3_REQUEST_PARSER_HPP

#include <tuple>
#include <boost/logic/tribool.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/network/protocol/http/request.hpp>

namespace boost {
Expand Down Expand Up @@ -45,14 +45,14 @@ class basic_request_parser {
/// of the
/// input has been consumed.
template <typename InputIterator>
boost::tuple<boost::tribool, InputIterator> parse_headers(
std::tuple<boost::tribool, InputIterator> parse_headers(
basic_request<Tag>& req, InputIterator begin, InputIterator end) {
while (begin != end) {
boost::tribool result = consume(req, *begin++);
if (result || !result) return boost::make_tuple(result, begin);
if (result || !result) return std::make_tuple(result, begin);
}
boost::tribool result = boost::indeterminate;
return boost::make_tuple(result, begin);
return std::make_tuple(result, begin);
}

private:
Expand Down
17 changes: 9 additions & 8 deletions boost/network/protocol/http/server/async_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <mutex>
#include <array>
#include <functional>
#include <tuple>
#include <boost/asio/buffer.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/strand.hpp>
Expand Down Expand Up @@ -62,7 +63,7 @@ namespace http {

#ifndef BOOST_NETWORK_NO_LIB
extern void parse_version(std::string const& partial_parsed,
fusion::tuple<uint8_t, uint8_t>& version_pair);
std::tuple<std::uint8_t, std::uint8_t>& version_pair);
extern void parse_headers(std::string const& input,
std::vector<request_header_narrow>& container);
#endif
Expand Down Expand Up @@ -423,7 +424,7 @@ struct async_connection
switch (state) {
case method:
input_range = boost::make_iterator_range(new_start, data_end);
fusion::tie(parsed_ok, result_range) =
std::tie(parsed_ok, result_range) =
parser.parse_until(request_parser_type::method_done, input_range);
if (!parsed_ok) {
client_error();
Expand All @@ -443,7 +444,7 @@ struct async_connection
}
case uri:
input_range = boost::make_iterator_range(new_start, data_end);
fusion::tie(parsed_ok, result_range) =
std::tie(parsed_ok, result_range) =
parser.parse_until(request_parser_type::uri_done, input_range);
if (!parsed_ok) {
client_error();
Expand All @@ -463,18 +464,18 @@ struct async_connection
}
case version:
input_range = boost::make_iterator_range(new_start, data_end);
fusion::tie(parsed_ok, result_range) = parser.parse_until(
std::tie(parsed_ok, result_range) = parser.parse_until(
request_parser_type::version_done, input_range);
if (!parsed_ok) {
client_error();
break;
} else if (parsed_ok == true) {
fusion::tuple<uint8_t, uint8_t> version_pair;
std::tuple<std::uint8_t, std::uint8_t> version_pair;
partial_parsed.append(std::begin(result_range),
std::end(result_range));
parse_version(partial_parsed, version_pair);
request_.http_version_major = fusion::get<0>(version_pair);
request_.http_version_minor = fusion::get<1>(version_pair);
request_.http_version_major = std::get<0>(version_pair);
request_.http_version_minor = std::get<1>(version_pair);
new_start = std::end(result_range);
partial_parsed.clear();
} else {
Expand All @@ -486,7 +487,7 @@ struct async_connection
}
case headers:
input_range = boost::make_iterator_range(new_start, data_end);
fusion::tie(parsed_ok, result_range) = parser.parse_until(
std::tie(parsed_ok, result_range) = parser.parse_until(
request_parser_type::headers_done, input_range);
if (!parsed_ok) {
client_error();
Expand Down
5 changes: 3 additions & 2 deletions boost/network/protocol/http/server/impl/parsers.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <tuple>
#include <boost/fusion/include/std_tuple.hpp>
#include <boost/network/protocol/http/message/header.hpp>
#include <boost/fusion/tuple.hpp>

#ifdef BOOST_NETWORK_NO_LIB
#ifndef BOOST_NETWORK_INLINE
Expand Down Expand Up @@ -47,7 +48,7 @@ namespace http {

BOOST_NETWORK_INLINE void parse_version(
std::string const& partial_parsed,
fusion::tuple<uint8_t, uint8_t>& version_pair) {
std::tuple<std::uint8_t, std::uint8_t>& version_pair) {
using namespace boost::spirit::qi;
parse(partial_parsed.begin(), partial_parsed.end(),
(lit("HTTP/") >> ushort_ >> '.' >> ushort_), version_pair);
Expand Down
6 changes: 3 additions & 3 deletions boost/network/protocol/http/server/request_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#include <iterator>
#include <utility>
#include <tuple>
#include <boost/range/iterator_range.hpp>
#include <boost/logic/tribool.hpp>
#include <boost/fusion/tuple.hpp>
#include <boost/algorithm/string/classification.hpp>

namespace boost {
Expand Down Expand Up @@ -55,7 +55,7 @@ struct request_parser {
state_t state() const { return internal_state; }

template <class Range>
fusion::tuple<logic::tribool, iterator_range<typename Range::const_iterator> >
std::tuple<logic::tribool, iterator_range<typename Range::const_iterator> >
parse_until(state_t stop_state, Range& range) {
logic::tribool parsed_ok = logic::indeterminate;
typedef typename range_iterator<Range>::type iterator;
Expand Down Expand Up @@ -213,7 +213,7 @@ struct request_parser {
if (internal_state == stop_state) parsed_ok = true;
local_range = boost::make_iterator_range(++current_iterator, end);
}
return fusion::make_tuple(
return std::make_tuple(
parsed_ok, boost::make_iterator_range(start, current_iterator));
}

Expand Down
Loading