mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Support boost 1.69
This commit is contained in:
@@ -22,9 +22,9 @@
|
||||
|
||||
#include <ripple/beast/container/detail/aged_container_iterator.h>
|
||||
#include <ripple/beast/container/detail/aged_associative_container.h>
|
||||
#include <ripple/beast/container/detail/empty_base_optimization.h>
|
||||
#include <ripple/beast/container/aged_container.h>
|
||||
#include <ripple/beast/clock/abstract_clock.h>
|
||||
#include <boost/beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/intrusive/set.hpp>
|
||||
#include <boost/version.hpp>
|
||||
@@ -162,7 +162,7 @@ private:
|
||||
|
||||
// VFALCO TODO This should only be enabled for maps.
|
||||
class pair_value_compare
|
||||
: public boost::beast::detail::empty_base_optimization <Compare>
|
||||
: public beast::detail::empty_base_optimization <Compare>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::binary_function <value_type, value_type, bool>
|
||||
#endif
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
}
|
||||
|
||||
pair_value_compare (pair_value_compare const& other)
|
||||
: boost::beast::detail::empty_base_optimization <Compare> (other)
|
||||
: beast::detail::empty_base_optimization <Compare> (other)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ private:
|
||||
friend aged_ordered_container;
|
||||
|
||||
pair_value_compare (Compare const& compare)
|
||||
: boost::beast::detail::empty_base_optimization <Compare> (compare)
|
||||
: beast::detail::empty_base_optimization <Compare> (compare)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -200,7 +200,7 @@ private:
|
||||
// Compares value_type against element, used in insert_check
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class KeyValueCompare
|
||||
: public boost::beast::detail::empty_base_optimization <Compare>
|
||||
: public beast::detail::empty_base_optimization <Compare>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::binary_function <Key, element, bool>
|
||||
#endif
|
||||
@@ -215,7 +215,7 @@ private:
|
||||
KeyValueCompare () = default;
|
||||
|
||||
KeyValueCompare (Compare const& compare)
|
||||
: boost::beast::detail::empty_base_optimization <Compare> (compare)
|
||||
: beast::detail::empty_base_optimization <Compare> (compare)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -252,12 +252,12 @@ private:
|
||||
|
||||
Compare& compare()
|
||||
{
|
||||
return boost::beast::detail::empty_base_optimization <Compare>::member();
|
||||
return beast::detail::empty_base_optimization <Compare>::member();
|
||||
}
|
||||
|
||||
Compare const& compare() const
|
||||
{
|
||||
return boost::beast::detail::empty_base_optimization <Compare>::member();
|
||||
return beast::detail::empty_base_optimization <Compare>::member();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -283,7 +283,7 @@ private:
|
||||
|
||||
class config_t
|
||||
: private KeyValueCompare
|
||||
, public boost::beast::detail::empty_base_optimization <ElementAllocator>
|
||||
, public beast::detail::empty_base_optimization <ElementAllocator>
|
||||
{
|
||||
public:
|
||||
explicit config_t (
|
||||
@@ -303,7 +303,7 @@ private:
|
||||
config_t (
|
||||
clock_type& clock_,
|
||||
Allocator const& alloc_)
|
||||
: boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
: beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -313,14 +313,14 @@ private:
|
||||
Compare const& comp,
|
||||
Allocator const& alloc_)
|
||||
: KeyValueCompare (comp)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
|
||||
config_t (config_t const& other)
|
||||
: KeyValueCompare (other.key_compare())
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
ElementAllocatorTraits::
|
||||
select_on_container_copy_construction (
|
||||
other.alloc()))
|
||||
@@ -330,14 +330,14 @@ private:
|
||||
|
||||
config_t (config_t const& other, Allocator const& alloc)
|
||||
: KeyValueCompare (other.key_compare())
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
|
||||
config_t (config_t&& other)
|
||||
: KeyValueCompare (std::move (other.key_compare()))
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
std::move (other))
|
||||
, clock (other.clock)
|
||||
{
|
||||
@@ -345,7 +345,7 @@ private:
|
||||
|
||||
config_t (config_t&& other, Allocator const& alloc)
|
||||
: KeyValueCompare (std::move (other.key_compare()))
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
@@ -391,13 +391,13 @@ private:
|
||||
|
||||
ElementAllocator& alloc()
|
||||
{
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
return beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const& alloc() const
|
||||
{
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
return beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
#include <ripple/beast/container/detail/aged_container_iterator.h>
|
||||
#include <ripple/beast/container/detail/aged_associative_container.h>
|
||||
#include <ripple/beast/container/detail/empty_base_optimization.h>
|
||||
#include <ripple/beast/container/aged_container.h>
|
||||
#include <ripple/beast/clock/abstract_clock.h>
|
||||
#include <boost/beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
#include <algorithm>
|
||||
@@ -163,7 +163,7 @@ private:
|
||||
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class ValueHash
|
||||
: private boost::beast::detail::empty_base_optimization <Hash>
|
||||
: private beast::detail::empty_base_optimization <Hash>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::unary_function <element, std::size_t>
|
||||
#endif
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
}
|
||||
|
||||
ValueHash (Hash const& hash)
|
||||
: boost::beast::detail::empty_base_optimization <Hash> (hash)
|
||||
: beast::detail::empty_base_optimization <Hash> (hash)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ private:
|
||||
// Compares value_type against element, used in find/insert_check
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class KeyValueEqual
|
||||
: private boost::beast::detail::empty_base_optimization <KeyEqual>
|
||||
: private beast::detail::empty_base_optimization <KeyEqual>
|
||||
#ifdef _LIBCPP_VERSION
|
||||
, public std::binary_function <Key, element, bool>
|
||||
#endif
|
||||
@@ -219,7 +219,7 @@ private:
|
||||
}
|
||||
|
||||
KeyValueEqual (KeyEqual const& keyEqual)
|
||||
: boost::beast::detail::empty_base_optimization <KeyEqual> (keyEqual)
|
||||
: beast::detail::empty_base_optimization <KeyEqual> (keyEqual)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ private:
|
||||
class config_t
|
||||
: private ValueHash
|
||||
, private KeyValueEqual
|
||||
, private boost::beast::detail::empty_base_optimization <ElementAllocator>
|
||||
, private beast::detail::empty_base_optimization <ElementAllocator>
|
||||
{
|
||||
public:
|
||||
explicit config_t (
|
||||
@@ -328,7 +328,7 @@ private:
|
||||
config_t (
|
||||
clock_type& clock_,
|
||||
Allocator const& alloc_)
|
||||
: boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
: beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -348,7 +348,7 @@ private:
|
||||
Hash const& hash,
|
||||
Allocator const& alloc_)
|
||||
: ValueHash (hash)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -358,7 +358,7 @@ private:
|
||||
KeyEqual const& keyEqual,
|
||||
Allocator const& alloc_)
|
||||
: KeyValueEqual (keyEqual)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -370,7 +370,7 @@ private:
|
||||
Allocator const& alloc_)
|
||||
: ValueHash (hash)
|
||||
, KeyValueEqual (keyEqual)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -378,7 +378,7 @@ private:
|
||||
config_t (config_t const& other)
|
||||
: ValueHash (other.hash_function())
|
||||
, KeyValueEqual (other.key_eq())
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
ElementAllocatorTraits::
|
||||
select_on_container_copy_construction (
|
||||
other.alloc()))
|
||||
@@ -389,7 +389,7 @@ private:
|
||||
config_t (config_t const& other, Allocator const& alloc)
|
||||
: ValueHash (other.hash_function())
|
||||
, KeyValueEqual (other.key_eq())
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
@@ -397,7 +397,7 @@ private:
|
||||
config_t (config_t&& other)
|
||||
: ValueHash (std::move (other.hash_function()))
|
||||
, KeyValueEqual (std::move (other.key_eq()))
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
std::move (other.alloc()))
|
||||
, clock (other.clock)
|
||||
{
|
||||
@@ -406,7 +406,7 @@ private:
|
||||
config_t (config_t&& other, Allocator const& alloc)
|
||||
: ValueHash (std::move (other.hash_function()))
|
||||
, KeyValueEqual (std::move (other.key_eq()))
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
@@ -471,13 +471,13 @@ private:
|
||||
|
||||
ElementAllocator& alloc()
|
||||
{
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
return beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const& alloc() const
|
||||
{
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
return beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
|
||||
98
src/ripple/beast/container/detail/empty_base_optimization.h
Normal file
98
src/ripple/beast/container/detail/empty_base_optimization.h
Normal file
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BEAST_CONTAINER_DETAIL_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
||||
#define BEAST_CONTAINER_DETAIL_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
||||
|
||||
#include <boost/type_traits/is_final.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct is_empty_base_optimization_derived
|
||||
: std::integral_constant<bool,
|
||||
std::is_empty<T>::value &&
|
||||
! boost::is_final<T>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template<class T, int UniqueID = 0,
|
||||
bool isDerived =
|
||||
is_empty_base_optimization_derived<T>::value>
|
||||
class empty_base_optimization : private T
|
||||
{
|
||||
public:
|
||||
empty_base_optimization() = default;
|
||||
empty_base_optimization(empty_base_optimization&&) = default;
|
||||
empty_base_optimization(empty_base_optimization const&) = default;
|
||||
empty_base_optimization& operator=(empty_base_optimization&&) = default;
|
||||
empty_base_optimization& operator=(empty_base_optimization const&) = default;
|
||||
|
||||
template<class Arg1, class... ArgN>
|
||||
explicit
|
||||
empty_base_optimization(Arg1&& arg1, ArgN&&... argn)
|
||||
: T(std::forward<Arg1>(arg1),
|
||||
std::forward<ArgN>(argn)...)
|
||||
{
|
||||
}
|
||||
|
||||
T& member() noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
T const& member() const noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<
|
||||
class T,
|
||||
int UniqueID
|
||||
>
|
||||
class empty_base_optimization <T, UniqueID, false>
|
||||
{
|
||||
T t_;
|
||||
|
||||
public:
|
||||
empty_base_optimization() = default;
|
||||
empty_base_optimization(empty_base_optimization&&) = default;
|
||||
empty_base_optimization(empty_base_optimization const&) = default;
|
||||
empty_base_optimization& operator=(empty_base_optimization&&) = default;
|
||||
empty_base_optimization& operator=(empty_base_optimization const&) = default;
|
||||
|
||||
template<class Arg1, class... ArgN>
|
||||
explicit
|
||||
empty_base_optimization(Arg1&& arg1, ArgN&&... argn)
|
||||
: t_(std::forward<Arg1>(arg1),
|
||||
std::forward<ArgN>(argn)...)
|
||||
{
|
||||
}
|
||||
|
||||
T& member() noexcept
|
||||
{
|
||||
return t_;
|
||||
}
|
||||
|
||||
T const& member() const noexcept
|
||||
{
|
||||
return t_;
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
@@ -291,14 +291,20 @@ on_write(error_code const& ec)
|
||||
start_timer();
|
||||
if(! result.first)
|
||||
impl().ws_.async_write_some(
|
||||
result.first, result.second, strand_.wrap(std::bind(
|
||||
&BaseWSPeer::on_write, impl().shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
static_cast<bool>(result.first),
|
||||
result.second,
|
||||
strand_.wrap(std::bind(
|
||||
&BaseWSPeer::on_write,
|
||||
impl().shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
else
|
||||
impl().ws_.async_write_some(
|
||||
result.first, result.second, strand_.wrap(std::bind(
|
||||
&BaseWSPeer::on_write_fin, impl().shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
static_cast<bool>(result.first),
|
||||
result.second,
|
||||
strand_.wrap(std::bind(
|
||||
&BaseWSPeer::on_write_fin,
|
||||
impl().shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
}
|
||||
|
||||
template<class Handler, class Impl>
|
||||
|
||||
Reference in New Issue
Block a user