mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
Use lean_tuple in buffers_cat
Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
committed by
Vinnie Falco
parent
b97169f26b
commit
d40255b357
@ -3,6 +3,7 @@ Version 191:
|
|||||||
* Add bind_front_handler
|
* Add bind_front_handler
|
||||||
* Use bind_front_handler
|
* Use bind_front_handler
|
||||||
* Simplify some type traits
|
* Simplify some type traits
|
||||||
|
* Use lean_tuple in buffers_cat
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#define BOOST_BEAST_BUFFERS_CAT_HPP
|
#define BOOST_BEAST_BUFFERS_CAT_HPP
|
||||||
|
|
||||||
#include <boost/beast/core/detail/config.hpp>
|
#include <boost/beast/core/detail/config.hpp>
|
||||||
|
#include <boost/beast/core/detail/lean_tuple.hpp>
|
||||||
#include <boost/beast/core/detail/type_traits.hpp>
|
#include <boost/beast/core/detail/type_traits.hpp>
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@ -24,7 +24,7 @@ namespace beast {
|
|||||||
template<class... Buffers>
|
template<class... Buffers>
|
||||||
class buffers_cat_view
|
class buffers_cat_view
|
||||||
{
|
{
|
||||||
std::tuple<Buffers...> bn_;
|
detail::lean_tuple<Buffers...> bn_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** The type of buffer returned when dereferencing an iterator.
|
/** The type of buffer returned when dereferencing an iterator.
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#ifndef BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
|
#ifndef BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
|
||||||
#define BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
|
#define BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
|
||||||
|
|
||||||
|
#include <boost/beast/core/detail/lean_tuple.hpp>
|
||||||
#include <boost/beast/core/detail/type_traits.hpp>
|
#include <boost/beast/core/detail/type_traits.hpp>
|
||||||
#include <boost/beast/core/detail/variant.hpp>
|
#include <boost/beast/core/detail/variant.hpp>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
@ -18,7 +19,6 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <tuple>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@ -42,7 +42,7 @@ class buffers_cat_view<Bn...>::const_iterator
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::tuple<Bn...> const* bn_ = nullptr;
|
detail::lean_tuple<Bn...> const* bn_ = nullptr;
|
||||||
detail::variant<typename
|
detail::variant<typename
|
||||||
detail::buffer_sequence_iterator<Bn>::type...,
|
detail::buffer_sequence_iterator<Bn>::type...,
|
||||||
past_end> it_;
|
past_end> it_;
|
||||||
@ -98,18 +98,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const_iterator(
|
const_iterator(
|
||||||
std::tuple<Bn...> const& bn, bool at_end);
|
detail::lean_tuple<Bn...> const& bn, bool at_end);
|
||||||
|
|
||||||
template<std::size_t I>
|
template<std::size_t I>
|
||||||
void
|
void
|
||||||
construct(C<I> const&)
|
construct(C<I> const&)
|
||||||
{
|
{
|
||||||
if(boost::asio::buffer_size(
|
if(boost::asio::buffer_size(
|
||||||
std::get<I>(*bn_)) != 0)
|
detail::get<I>(*bn_)) != 0)
|
||||||
{
|
{
|
||||||
it_.template emplace<I+1>(
|
it_.template emplace<I+1>(
|
||||||
boost::asio::buffer_sequence_begin(
|
boost::asio::buffer_sequence_begin(
|
||||||
std::get<I>(*bn_)));
|
detail::get<I>(*bn_)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
construct(C<I+1>{});
|
construct(C<I+1>{});
|
||||||
@ -121,7 +121,7 @@ private:
|
|||||||
auto constexpr I = sizeof...(Bn)-1;
|
auto constexpr I = sizeof...(Bn)-1;
|
||||||
it_.template emplace<I+1>(
|
it_.template emplace<I+1>(
|
||||||
boost::asio::buffer_sequence_begin(
|
boost::asio::buffer_sequence_begin(
|
||||||
std::get<I>(*bn_)));
|
detail::get<I>(*bn_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -137,11 +137,11 @@ private:
|
|||||||
next(C<I> const&)
|
next(C<I> const&)
|
||||||
{
|
{
|
||||||
if(boost::asio::buffer_size(
|
if(boost::asio::buffer_size(
|
||||||
std::get<I>(*bn_)) != 0)
|
detail::get<I>(*bn_)) != 0)
|
||||||
{
|
{
|
||||||
it_.template emplace<I+1>(
|
it_.template emplace<I+1>(
|
||||||
boost::asio::buffer_sequence_begin(
|
boost::asio::buffer_sequence_begin(
|
||||||
std::get<I>(*bn_)));
|
detail::get<I>(*bn_)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
next(C<I+1>{});
|
next(C<I+1>{});
|
||||||
@ -160,11 +160,11 @@ private:
|
|||||||
prev(C<I> const&)
|
prev(C<I> const&)
|
||||||
{
|
{
|
||||||
if(boost::asio::buffer_size(
|
if(boost::asio::buffer_size(
|
||||||
std::get<I>(*bn_)) != 0)
|
detail::get<I>(*bn_)) != 0)
|
||||||
{
|
{
|
||||||
it_.template emplace<I+1>(
|
it_.template emplace<I+1>(
|
||||||
boost::asio::buffer_sequence_end(
|
boost::asio::buffer_sequence_end(
|
||||||
std::get<I>(*bn_)));
|
detail::get<I>(*bn_)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prev(C<I-1>{});
|
prev(C<I-1>{});
|
||||||
@ -176,7 +176,7 @@ private:
|
|||||||
auto constexpr I = 0;
|
auto constexpr I = 0;
|
||||||
it_.template emplace<I+1>(
|
it_.template emplace<I+1>(
|
||||||
boost::asio::buffer_sequence_end(
|
boost::asio::buffer_sequence_end(
|
||||||
std::get<I>(*bn_)));
|
detail::get<I>(*bn_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t I>
|
template<std::size_t I>
|
||||||
@ -204,7 +204,7 @@ private:
|
|||||||
{
|
{
|
||||||
if(++it_.template get<I+1>() !=
|
if(++it_.template get<I+1>() !=
|
||||||
boost::asio::buffer_sequence_end(
|
boost::asio::buffer_sequence_end(
|
||||||
std::get<I>(*bn_)))
|
detail::get<I>(*bn_)))
|
||||||
return;
|
return;
|
||||||
return next(C<I+1>{});
|
return next(C<I+1>{});
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ private:
|
|||||||
{
|
{
|
||||||
if(it_.template get<I+1>() !=
|
if(it_.template get<I+1>() !=
|
||||||
boost::asio::buffer_sequence_begin(
|
boost::asio::buffer_sequence_begin(
|
||||||
std::get<I>(*bn_)))
|
detail::get<I>(*bn_)))
|
||||||
{
|
{
|
||||||
--it_.template get<I+1>();
|
--it_.template get<I+1>();
|
||||||
return;
|
return;
|
||||||
@ -252,7 +252,7 @@ private:
|
|||||||
auto constexpr I = 0;
|
auto constexpr I = 0;
|
||||||
if(it_.template get<I+1>() !=
|
if(it_.template get<I+1>() !=
|
||||||
boost::asio::buffer_sequence_begin(
|
boost::asio::buffer_sequence_begin(
|
||||||
std::get<I>(*bn_)))
|
detail::get<I>(*bn_)))
|
||||||
{
|
{
|
||||||
--it_.template get<I+1>();
|
--it_.template get<I+1>();
|
||||||
return;
|
return;
|
||||||
@ -268,7 +268,7 @@ template<class... Bn>
|
|||||||
buffers_cat_view<Bn...>::
|
buffers_cat_view<Bn...>::
|
||||||
const_iterator::
|
const_iterator::
|
||||||
const_iterator(
|
const_iterator(
|
||||||
std::tuple<Bn...> const& bn, bool at_end)
|
detail::lean_tuple<Bn...> const& bn, bool at_end)
|
||||||
: bn_(&bn)
|
: bn_(&bn)
|
||||||
{
|
{
|
||||||
if(! at_end)
|
if(! at_end)
|
||||||
|
Reference in New Issue
Block a user