mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 10:45:50 +00:00
Enable C++17
This commit is contained in:
@@ -478,7 +478,8 @@ add_library (Ripple::common ALIAS common)
|
||||
link_libraries (Ripple::common)
|
||||
set_target_properties (common
|
||||
PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON)
|
||||
target_compile_features (common INTERFACE cxx_std_14)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
target_compile_features (common INTERFACE cxx_std_17)
|
||||
target_compile_definitions (common
|
||||
INTERFACE
|
||||
$<$<CONFIG:Debug>:DEBUG _DEBUG>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// been invented (that would involve another several millennia of evolution).
|
||||
// We did not mean to shout.
|
||||
|
||||
#define HAS_STRING_VIEW 0
|
||||
#ifndef HAS_STRING_VIEW
|
||||
# if __cplusplus >= 201703
|
||||
# define HAS_STRING_VIEW 1
|
||||
|
||||
@@ -51,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 =
|
||||
std::is_invocable<Engine, Result()>;
|
||||
std::is_invocable_r<Result, Engine>;
|
||||
}
|
||||
|
||||
/** Return the default random engine.
|
||||
|
||||
@@ -24,82 +24,18 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 6000
|
||||
|
||||
namespace std {
|
||||
|
||||
#ifndef _MSC_VER
|
||||
template <class _Ret, class _Fn, class... _Args>
|
||||
struct _LIBCPP_TEMPLATE_VIS is_invocable_r
|
||||
: integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value>
|
||||
{
|
||||
};
|
||||
|
||||
#if ! __cpp_lib_void_t
|
||||
|
||||
template<class...>
|
||||
using void_t = void;
|
||||
|
||||
#endif // ! __cpp_lib_void_t
|
||||
|
||||
#if ! __cpp_lib_bool_constant
|
||||
|
||||
template<bool B>
|
||||
using bool_constant = std::integral_constant<bool, B>;
|
||||
|
||||
#endif // ! __cpp_lib_bool_constant
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
|
||||
// Ideas from Howard Hinnant
|
||||
//
|
||||
// Specializations of is_constructible for pair and tuple which
|
||||
// work around an apparent defect in the standard that causes well
|
||||
// formed expressions involving pairs or tuples of non default-constructible
|
||||
// types to generate compile errors.
|
||||
//
|
||||
template <class T, class U>
|
||||
struct is_constructible <pair <T, U>>
|
||||
: integral_constant <bool,
|
||||
is_default_constructible <T>::value &&
|
||||
is_default_constructible <U>::value>
|
||||
{
|
||||
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
|
||||
|
||||
@@ -673,9 +673,7 @@ protected:
|
||||
void
|
||||
invoke (STTx& stx, FN const&... fN)
|
||||
{
|
||||
// Sean Parent for_each_argument trick (C++ fold expressions would be
|
||||
// nice here)
|
||||
(void)std::array<int, sizeof...(fN)>{{((fN(*this, stx)), 0)...}};
|
||||
(fN(*this, stx),...);
|
||||
}
|
||||
|
||||
// Invoke funclets on jt
|
||||
@@ -683,9 +681,7 @@ protected:
|
||||
void
|
||||
invoke (JTx& jt, FN const&... fN)
|
||||
{
|
||||
// Sean Parent for_each_argument trick (C++ fold expressions would be
|
||||
// nice here)
|
||||
(void)std::array<int, sizeof...(fN)>{{((fN(*this, jt)), 0)...}};
|
||||
(fN(*this, jt),...);
|
||||
}
|
||||
|
||||
// Map of account IDs to Account
|
||||
|
||||
Reference in New Issue
Block a user