From 8235c5fcacb0fa5a5a7fa8b45913d9e3f80e704f Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 9 Nov 2016 11:13:58 -0500 Subject: [PATCH] [FOLD] buffer_cat --- include/beast/core/detail/buffer_cat.hpp | 63 +++++++++++++----------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/include/beast/core/detail/buffer_cat.hpp b/include/beast/core/detail/buffer_cat.hpp index 4db9aaf281..fdf2b6104f 100644 --- a/include/beast/core/detail/buffer_cat.hpp +++ b/include/beast/core/detail/buffer_cat.hpp @@ -152,7 +152,7 @@ class buffer_cat_helper::const_iterator std::tuple const& bn, bool at_end); void - construct(C) + construct(C const&) { auto constexpr I = sizeof...(Bn); n_ = I; @@ -160,7 +160,7 @@ class buffer_cat_helper::const_iterator template void - construct(C) + construct(C const&) { if(std::get(*bn_).begin() != std::get(*bn_).end()) @@ -174,14 +174,14 @@ class buffer_cat_helper::const_iterator } void - destroy(C) + destroy(C const&) { return; } template void - destroy(C) + destroy(C const&) { if(n_ == I) { @@ -193,13 +193,15 @@ class buffer_cat_helper::const_iterator } void - move(C, const_iterator&&) + move(const_iterator&&, + C const&) { } template void - move(C, const_iterator&& other) + move(const_iterator&& other, + C const&) { if(n_ == I) { @@ -207,17 +209,19 @@ class buffer_cat_helper::const_iterator std::move(other.iter())}; return; } - move(C{}, std::move(other)); + move(std::move(other), C{}); } void - copy(C, const_iterator const&) + copy(const_iterator const&, + C const&) { } template void - copy(C, const_iterator const& other) + copy(const_iterator const& other, + C const&) { if(n_ == I) { @@ -225,35 +229,36 @@ class buffer_cat_helper::const_iterator other.iter()}; return; } - copy(C{}, other); + copy(other, C{}); } bool - equal(C, - const_iterator const&) const + equal(const_iterator const&, + C const&) const { return true; } template bool - equal(C, const_iterator const& other) const + equal(const_iterator const& other, + C const&) const { if(n_ == I) return iter() == other.iter(); - return equal(C{}, other); + return equal(other, C{}); } [[noreturn]] reference - dereference(C) const + dereference(C const&) const { throw std::logic_error("invalid iterator"); } template reference - dereference(C) const + dereference(C const&) const { if(n_ == I) return *iter(); @@ -262,14 +267,14 @@ class buffer_cat_helper::const_iterator [[noreturn]] void - increment(C) + increment(C const&) { throw std::logic_error("invalid iterator"); } template void - increment(C) + increment(C const&) { if(n_ == I) { @@ -284,7 +289,7 @@ class buffer_cat_helper::const_iterator } void - decrement(C) + decrement(C const&) { auto constexpr I = sizeof...(Bn); if(n_ == I) @@ -297,7 +302,7 @@ class buffer_cat_helper::const_iterator } void - decrement(C<0>) + decrement(C<0> const&) { auto constexpr I = 0; if(iter() != std::get(*bn_).begin()) @@ -310,7 +315,7 @@ class buffer_cat_helper::const_iterator template void - decrement(C) + decrement(C const&) { if(n_ == I) { @@ -364,7 +369,7 @@ const_iterator::const_iterator(const_iterator&& other) : n_(other.n_) , bn_(other.bn_) { - move(C<0>{}, std::move(other)); + move(std::move(other), C<0>{}); } template @@ -373,7 +378,7 @@ const_iterator::const_iterator(const_iterator const& other) : n_(other.n_) , bn_(other.bn_) { - copy(C<0>{}, other); + copy(other, C<0>{}); } template @@ -387,7 +392,7 @@ const_iterator::operator=(const_iterator&& other) -> destroy(C<0>{}); n_ = other.n_; bn_ = other.bn_; - move(C<0>{}, std::move(other)); + move(std::move(other), C<0>{}); return *this; } @@ -402,7 +407,7 @@ const_iterator& destroy(C<0>{}); n_ = other.n_; bn_ = other.bn_; - copy(C<0>{}, other); + copy(other, C<0>{}); return *this; } @@ -415,7 +420,7 @@ const_iterator::operator==(const_iterator const& other) const return false; if(n_ != other.n_) return false; - return equal(C<0>{}, other); + return equal(other, C<0>{}); } template @@ -448,19 +453,21 @@ const_iterator::operator--() -> } template +inline auto buffer_cat_helper::begin() const -> const_iterator { - return const_iterator(bn_, false); + return const_iterator{bn_, false}; } template +inline auto buffer_cat_helper::end() const -> const_iterator { - return const_iterator(bn_, true); + return const_iterator{bn_, true}; } } // detail