Remove use of beast::detail::is_invocable trait

This commit is contained in:
seelabs
2019-01-30 09:19:14 -05:00
committed by Nik Bougalis
parent 3fb13233a9
commit 4f52c2989c
3 changed files with 45 additions and 7 deletions

View File

@@ -22,7 +22,6 @@
#include <ripple/basics/win32_workaround.h>
#include <ripple/beast/xor_shift_engine.h>
#include <boost/beast/core/detail/type_traits.hpp>
#include <boost/thread/tss.hpp>
#include <cassert>
#include <cstddef>
@@ -30,7 +29,7 @@
#include <cstring>
#include <random>
#include <limits>
#include <type_traits>
#include <ripple/beast/cxx17/type_traits.h> // <type_traits>
namespace ripple {
@@ -52,7 +51,7 @@ namespace detail {
// Determines if a type can be called like an Engine
template <class Engine, class Result = typename Engine::result_type>
using is_engine =
boost::beast::detail::is_invocable<Engine, Result()>;
std::is_invocable<Engine, Result()>;
}
/** Return the default random engine.

View File

@@ -60,6 +60,46 @@ struct is_constructible <pair <T, U>>
explicit is_constructible() = default;
};
//------------------------------------------------------------------------------
namespace detail {
template<class R, class C, class ...A>
auto
is_invocable_test(C&& c, int, A&& ...a)
-> decltype(std::is_convertible<
decltype(c(std::forward<A>(a)...)), R>::value ||
std::is_same<R, void>::value,
std::true_type());
template<class R, class C, class ...A>
std::false_type
is_invocable_test(C&& c, long, A&& ...a);
} // detail
/** Metafunction returns `true` if F callable as R(A...)
Example:
@code
is_invocable<T, void(std::string)>
@endcode
*/
/** @{ */
template<class C, class F>
struct is_invocable : std::false_type
{
};
template<class C, class R, class ...A>
struct is_invocable<C, R(A...)>
: decltype(std::detail::is_invocable_test<R>(
std::declval<C>(), 1, std::declval<A>()...))
{
};
/** @} */
//------------------------------------------------------------------------------
} // std
#endif

View File

@@ -45,11 +45,10 @@
#include <ripple/protocol/STAmount.h>
#include <ripple/protocol/STObject.h>
#include <ripple/protocol/STTx.h>
#include <boost/beast/core/detail/type_traits.hpp>
#include <functional>
#include <string>
#include <tuple>
#include <type_traits>
#include <ripple/beast/cxx17/type_traits.h> // <type_traits>
#include <utility>
#include <unordered_map>
#include <vector>
@@ -691,7 +690,7 @@ protected:
FN const&... fN)
{
maybe_invoke(stx, f,
boost::beast::detail::is_invocable<F,
std::is_invocable<F,
void(Env&, STTx const&)>());
invoke(stx, fN...);
}
@@ -725,7 +724,7 @@ protected:
FN const&... fN)
{
maybe_invoke(jt, f,
boost::beast::detail::is_invocable<F,
std::is_invocable<F,
void(Env&, JTx&)>());
invoke(jt, fN...);
}