mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 19:25:51 +00:00
Use more C++11 features:
* Remove beast::static_initializer * Remove noexcept VS2013 workaround * Use [[noreturn]] attribute
This commit is contained in:
@@ -1030,12 +1030,8 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\meta.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\noexcept.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\PropertyStream.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\static_initializer.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\tagged_integer.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\beast\beast\utility\tests\bassert.test.cpp">
|
||||
@@ -1047,9 +1043,6 @@
|
||||
<ClCompile Include="..\..\src\beast\beast\utility\tests\Journal.test.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\beast\beast\utility\tests\static_initializer.test.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\beast\beast\utility\tests\tagged_integer.test.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
||||
@@ -1698,15 +1698,9 @@
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\meta.h">
|
||||
<Filter>beast\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\noexcept.h">
|
||||
<Filter>beast\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\PropertyStream.h">
|
||||
<Filter>beast\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\static_initializer.h">
|
||||
<Filter>beast\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\utility\tagged_integer.h">
|
||||
<Filter>beast\utility</Filter>
|
||||
</ClInclude>
|
||||
@@ -1719,9 +1713,6 @@
|
||||
<ClCompile Include="..\..\src\beast\beast\utility\tests\Journal.test.cpp">
|
||||
<Filter>beast\utility\tests</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\beast\beast\utility\tests\static_initializer.test.cpp">
|
||||
<Filter>beast\utility\tests</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\beast\beast\utility\tests\tagged_integer.test.cpp">
|
||||
<Filter>beast\utility\tests</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include <beast/Config.h>
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <beast/Config.h>
|
||||
#include <beast/strings/String.h>
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <beast/Config.h>
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <ctime>
|
||||
#include <locale>
|
||||
|
||||
|
||||
@@ -22,5 +22,4 @@
|
||||
#ifndef BEAST_CONFIG_COMPILER_VISUALC_H_INCLUDED
|
||||
#define BEAST_CONFIG_COMPILER_VISUALC_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <beast/crypto/secure_erase.h>
|
||||
#include <beast/hash/endian.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <type_traits>
|
||||
#include <array>
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef BEAST_CRYPTO_RIPEMD_CONTEXT_H_INCLUDED
|
||||
#define BEAST_CRYPTO_RIPEMD_CONTEXT_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef BEAST_CRYPTO_SHA512_CONTEXT_H_INCLUDED
|
||||
#define BEAST_CRYPTO_SHA512_CONTEXT_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#ifndef BEAST_HASH_FNV1A_H_INCLUDED
|
||||
#define BEAST_HASH_FNV1A_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <beast/cxx14/type_traits.h> // <type_traits>
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <beast/config/CompilerConfig.h> // for constexpr
|
||||
#include <beast/hash/endian.h>
|
||||
#include <beast/utility/meta.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#ifndef BEAST_HASH_SIPHASH_H_INCLUDED
|
||||
#define BEAST_HASH_SIPHASH_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <beast/hash/endian.h>
|
||||
#include <beast/hash/impl/xxhash.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <beast/cxx14/type_traits.h> // <type_traits>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@@ -52,22 +52,7 @@ public:
|
||||
URL& operator= (URL const& other) = default;
|
||||
|
||||
/** Move construct a URL. */
|
||||
#ifdef _MSC_VER
|
||||
URL (URL&& other)
|
||||
: m_scheme(std::move(other.m_scheme))
|
||||
, m_host(std::move(other.m_host))
|
||||
, m_port(other.m_port)
|
||||
, m_port_string(std::move(other.m_port_string))
|
||||
, m_path(std::move(other.m_path))
|
||||
, m_query(std::move(other.m_query))
|
||||
, m_fragment(std::move(other.m_fragment))
|
||||
, m_userinfo(std::move(other.m_userinfo))
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
URL (URL&& other) = default;
|
||||
#endif
|
||||
|
||||
/** Returns `true` if this is an empty URL. */
|
||||
bool
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <beast/http/basic_parser.h>
|
||||
#include <beast/http/impl/joyent_parser.h>
|
||||
#include <beast/http/rfc2616.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -76,16 +76,9 @@ public:
|
||||
template <class = void>
|
||||
message();
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
message (message&& other);
|
||||
message& operator= (message&& other);
|
||||
|
||||
#else
|
||||
message (message&& other) = default;
|
||||
message& operator= (message&& other) = default;
|
||||
|
||||
#endif
|
||||
|
||||
// Memberspace
|
||||
beast::http::headers headers;
|
||||
|
||||
@@ -220,38 +213,6 @@ message::message()
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
inline
|
||||
message::message (message&& other)
|
||||
: request_ (other.request_)
|
||||
, method_ (std::move(other.method_))
|
||||
, url_ (std::move(other.url_))
|
||||
, status_ (other.status_)
|
||||
, reason_ (std::move(other.reason_))
|
||||
, version_ (other.version_)
|
||||
, keep_alive_ (other.keep_alive_)
|
||||
, upgrade_ (other.upgrade_)
|
||||
, headers (std::move(other.headers))
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
message&
|
||||
message::operator= (message&& other)
|
||||
{
|
||||
request_ = other.request_;
|
||||
method_ = std::move(other.method_);
|
||||
url_ = std::move(other.url_);
|
||||
status_ = other.status_;
|
||||
reason_ = std::move(other.reason_);
|
||||
version_ = other.version_;
|
||||
keep_alive_ = other.keep_alive_;
|
||||
upgrade_ = other.upgrade_;
|
||||
headers = std::move(other.headers);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class Streambuf>
|
||||
|
||||
@@ -66,14 +66,8 @@ public:
|
||||
message_.get().request(request);
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
parser& operator= (parser&& other);
|
||||
|
||||
#else
|
||||
parser& operator= (parser&& other) = default;
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
template <class = void>
|
||||
void
|
||||
@@ -141,18 +135,6 @@ private:
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
inline
|
||||
parser&
|
||||
parser::operator= (parser&& other)
|
||||
{
|
||||
basic_parser::operator= (std::move(other));
|
||||
message_ = std::move (other.message_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class>
|
||||
void
|
||||
parser::do_start()
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <beast/module/core/diagnostic/FatalError.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
@@ -27,49 +28,38 @@
|
||||
namespace beast {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
[[noreturn]]
|
||||
void
|
||||
FatalError (char const* message, char const* file, int line)
|
||||
FatalError (
|
||||
char const* message,
|
||||
char const* file,
|
||||
int line) noexcept
|
||||
{
|
||||
static std::atomic <int> error_count (0);
|
||||
static std::recursive_mutex gate;
|
||||
static std::mutex gate;
|
||||
|
||||
// We only allow one thread to report a fatal error. Other threads that
|
||||
// encounter fatal errors while we are reporting get blocked here.
|
||||
std::lock_guard<std::recursive_mutex> lock(gate);
|
||||
std::lock_guard<std::mutex> lock(gate);
|
||||
|
||||
// If we encounter a recursive fatal error, then we want to terminate
|
||||
// unconditionally.
|
||||
if (error_count++ != 0)
|
||||
return std::terminate ();
|
||||
std::cerr << "An error has occurred. The application will terminate.\n";
|
||||
|
||||
// We protect this entire block of code since writing to cerr might trigger
|
||||
// exceptions.
|
||||
try
|
||||
if (message != nullptr && message [0] != 0)
|
||||
std::cerr << "Message: " << message << '\n';
|
||||
|
||||
if (file != nullptr && file [0] != 0)
|
||||
std::cerr << " File: " << file << ":" << line << '\n';
|
||||
|
||||
auto const backtrace = getStackBacktrace ();
|
||||
|
||||
if (!backtrace.empty ())
|
||||
{
|
||||
std::cerr << "An error has occurred. The application will terminate.\n";
|
||||
std::cerr << " Stack:" << std::endl;
|
||||
|
||||
if (message != nullptr && message [0] != 0)
|
||||
std::cerr << "Message: " << message << '\n';
|
||||
|
||||
if (file != nullptr && file [0] != 0)
|
||||
std::cerr << " File: " << file << ":" << line << '\n';
|
||||
|
||||
auto const backtrace = getStackBacktrace ();
|
||||
|
||||
if (!backtrace.empty ())
|
||||
{
|
||||
std::cerr << " Stack:" << std::endl;
|
||||
|
||||
for (auto const& frame : backtrace)
|
||||
std::cerr << " " << frame << '\n';
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// nothing we can do - just fall through and terminate
|
||||
for (auto const& frame : backtrace)
|
||||
std::cerr << " " << frame << '\n';
|
||||
}
|
||||
|
||||
return std::terminate ();
|
||||
std::abort ();
|
||||
}
|
||||
|
||||
} // beast
|
||||
|
||||
@@ -35,8 +35,12 @@ namespace beast
|
||||
If multiple threads raise an error, only one will succeed while the others
|
||||
will be blocked before the process terminates.
|
||||
*/
|
||||
[[noreturn]]
|
||||
void
|
||||
FatalError (char const* message, char const* file = nullptr, int line = 0);
|
||||
FatalError (
|
||||
char const* message,
|
||||
char const* file = nullptr,
|
||||
int line = 0) noexcept;
|
||||
|
||||
} // beast
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** A Semantic Version number.
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
@@ -29,8 +28,8 @@ namespace beast {
|
||||
|
||||
File const& File::nonexistent()
|
||||
{
|
||||
static beast::static_initializer<File> instance;
|
||||
return *instance;
|
||||
static File const instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/utility/static_initializer.h>
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -47,8 +45,8 @@ public:
|
||||
Manager&
|
||||
instance()
|
||||
{
|
||||
static beast::static_initializer<Manager> m;
|
||||
return *m;
|
||||
static Manager m;
|
||||
return m;
|
||||
}
|
||||
|
||||
// Okay to call on an active timer.
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <beast/net/IPAddressV6.h>
|
||||
#include <beast/hash/hash_append.h>
|
||||
#include <beast/hash/uhash.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef BEAST_NUDB_DETAIL_GENTEX_H_INCLUDED
|
||||
#define BEAST_NUDB_DETAIL_GENTEX_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <condition_variable>
|
||||
#include <cstddef>
|
||||
#include <mutex>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#define BEAST_THREADS_SPINLOCK_H_INCLUDED
|
||||
|
||||
#include <beast/threads/UnlockGuard.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <mutex>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <beast/unit_test/runner.h>
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef BEAST_UNIT_TEST_THREAD_H_INCLUDED
|
||||
#define BEAST_UNIT_TEST_THREAD_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <beast/unit_test/suite.h>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <beast/utility/tests/bassert.test.cpp>
|
||||
#include <beast/utility/tests/empty_base_optimization.test.cpp>
|
||||
#include <beast/utility/tests/Journal.test.cpp>
|
||||
#include <beast/utility/tests/static_initializer.test.cpp>
|
||||
#include <beast/utility/tests/tagged_integer.test.cpp>
|
||||
#include <beast/utility/tests/weak_fn.test.cpp>
|
||||
#include <beast/utility/tests/Zero.test.cpp>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#ifndef BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
||||
#define BEAST_UTILITY_EMPTY_BASE_OPTIMIZATION_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/utility/Journal.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -60,8 +59,8 @@ public:
|
||||
|
||||
Journal::Sink& Journal::getNullSink ()
|
||||
{
|
||||
static beast::static_initializer<NullJournalSink> sink;
|
||||
return *sink;
|
||||
static NullJournalSink sink;
|
||||
return sink;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Portions of this file are from JUCE.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
Please visit http://www.juce.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_UTILITY_NOEXCEPT_H_INCLUDED
|
||||
#define BEAST_UTILITY_NOEXCEPT_H_INCLUDED
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if _MSC_VER < 1900
|
||||
# ifdef noexcept
|
||||
# undef noexcept
|
||||
# endif
|
||||
# define noexcept throw()
|
||||
# endif
|
||||
# if _MSC_VER > 1600 && ! _ALLOW_KEYWORD_MACROS
|
||||
# define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,258 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_UTILITY_STATIC_INITIALIZER_H_INCLUDED
|
||||
#define BEAST_UTILITY_STATIC_INITIALIZER_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <utility>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <cassert>
|
||||
#include <new>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** Returns an object with static storage duration.
|
||||
This is a workaround for Visual Studio 2013 and earlier non-thread
|
||||
safe initialization of function local objects with static storage duration.
|
||||
|
||||
Usage:
|
||||
@code
|
||||
my_class& foo()
|
||||
{
|
||||
static static_initializer <my_class> instance;
|
||||
return *instance;
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
template <
|
||||
class T,
|
||||
class Tag = void
|
||||
>
|
||||
class static_initializer
|
||||
{
|
||||
private:
|
||||
struct data_t
|
||||
{
|
||||
// 0 = unconstructed
|
||||
// 1 = constructing
|
||||
// 2 = constructed
|
||||
long volatile state;
|
||||
|
||||
typename std::aligned_storage <sizeof(T),
|
||||
std::alignment_of <T>::value>::type storage;
|
||||
};
|
||||
|
||||
struct destroyer
|
||||
{
|
||||
T* t_;
|
||||
explicit destroyer (T* t) : t_(t) { }
|
||||
~destroyer() { t_->~T(); }
|
||||
};
|
||||
|
||||
static
|
||||
data_t&
|
||||
data() noexcept;
|
||||
|
||||
public:
|
||||
template <class... Args>
|
||||
explicit static_initializer (Args&&... args);
|
||||
|
||||
T&
|
||||
get() noexcept;
|
||||
|
||||
T const&
|
||||
get() const noexcept
|
||||
{
|
||||
return const_cast<static_initializer&>(*this).get();
|
||||
}
|
||||
|
||||
T&
|
||||
operator*() noexcept
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
T const&
|
||||
operator*() const noexcept
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
T*
|
||||
operator->() noexcept
|
||||
{
|
||||
return &get();
|
||||
}
|
||||
|
||||
T const*
|
||||
operator->() const noexcept
|
||||
{
|
||||
return &get();
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class T, class Tag>
|
||||
auto
|
||||
static_initializer <T, Tag>::data() noexcept ->
|
||||
data_t&
|
||||
{
|
||||
static data_t _; // zero-initialized
|
||||
return _;
|
||||
}
|
||||
|
||||
template <class T, class Tag>
|
||||
template <class... Args>
|
||||
static_initializer <T, Tag>::static_initializer (Args&&... args)
|
||||
{
|
||||
data_t& _(data());
|
||||
|
||||
// Double Checked Locking Pattern
|
||||
|
||||
if (_.state != 2)
|
||||
{
|
||||
T* const t (reinterpret_cast<T*>(&_.storage));
|
||||
|
||||
for(;;)
|
||||
{
|
||||
long prev;
|
||||
prev = _InterlockedCompareExchange(&_.state, 1, 0);
|
||||
if (prev == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
::new(t) T (std::forward<Args>(args)...);
|
||||
static destroyer on_exit (t);
|
||||
_InterlockedIncrement(&_.state);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
// Constructors that throw exceptions are unsupported
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
else if (prev == 1)
|
||||
{
|
||||
std::this_thread::yield();
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(prev == 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class Tag>
|
||||
T&
|
||||
static_initializer <T, Tag>::get() noexcept
|
||||
{
|
||||
data_t& _(data());
|
||||
for(;;)
|
||||
{
|
||||
if (_.state == 2)
|
||||
break;
|
||||
std::this_thread::yield();
|
||||
}
|
||||
return *reinterpret_cast<T*>(&_.storage);
|
||||
}
|
||||
|
||||
#else
|
||||
template <
|
||||
class T,
|
||||
class Tag = void
|
||||
>
|
||||
class static_initializer
|
||||
{
|
||||
private:
|
||||
T* instance_;
|
||||
|
||||
public:
|
||||
template <class... Args>
|
||||
explicit
|
||||
static_initializer (Args&&... args);
|
||||
|
||||
static_initializer ();
|
||||
|
||||
T&
|
||||
get() noexcept
|
||||
{
|
||||
return *instance_;
|
||||
}
|
||||
|
||||
T const&
|
||||
get() const noexcept
|
||||
{
|
||||
return const_cast<static_initializer&>(*this).get();
|
||||
}
|
||||
|
||||
T&
|
||||
operator*() noexcept
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
T const&
|
||||
operator*() const noexcept
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
T*
|
||||
operator->() noexcept
|
||||
{
|
||||
return &get();
|
||||
}
|
||||
|
||||
T const*
|
||||
operator->() const noexcept
|
||||
{
|
||||
return &get();
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class Tag>
|
||||
static_initializer <T, Tag>::static_initializer ()
|
||||
{
|
||||
static T t;
|
||||
instance_ = &t;
|
||||
}
|
||||
|
||||
template <class T, class Tag>
|
||||
template <class... Args>
|
||||
static_initializer <T, Tag>::static_initializer (Args&&... args)
|
||||
{
|
||||
static T t (std::forward<Args>(args)...);
|
||||
instance_ = &t;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include <beast/hash/hash_append.h>
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <beast/unit_test/suite.h>
|
||||
#include <atomic>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
static_assert(__alignof(long) >= 4, "");
|
||||
|
||||
class static_initializer_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
// Used to create separate instances for each test
|
||||
struct cxx11_tag { };
|
||||
struct beast_tag { };
|
||||
template <std::size_t N, class Tag>
|
||||
struct Case
|
||||
{
|
||||
enum { count = N };
|
||||
using type = Tag;
|
||||
};
|
||||
|
||||
struct Counts
|
||||
{
|
||||
Counts()
|
||||
: calls (0)
|
||||
, constructed (0)
|
||||
, access (0)
|
||||
{
|
||||
}
|
||||
|
||||
// number of calls to the constructor
|
||||
std::atomic <long> calls;
|
||||
|
||||
// incremented after construction completes
|
||||
std::atomic <long> constructed;
|
||||
|
||||
// increment when class is accessed before construction
|
||||
std::atomic <long> access;
|
||||
};
|
||||
|
||||
/* This testing singleton detects two conditions:
|
||||
1. Being accessed before getting fully constructed
|
||||
2. Getting constructed twice
|
||||
*/
|
||||
template <class Tag>
|
||||
class Test;
|
||||
|
||||
template <class Function>
|
||||
static
|
||||
void
|
||||
run_many (std::size_t n, Function f);
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
test (cxx11_tag);
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
test (beast_tag);
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
test();
|
||||
|
||||
void
|
||||
run ();
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class Tag>
|
||||
class static_initializer_test::Test
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
Test (Counts& counts);
|
||||
|
||||
void
|
||||
operator() (Counts& counts);
|
||||
};
|
||||
|
||||
template <class Tag>
|
||||
static_initializer_test::Test<Tag>::Test (Counts& counts)
|
||||
{
|
||||
++counts.calls;
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds (10));
|
||||
++counts.constructed;
|
||||
}
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
static_initializer_test::Test<Tag>::operator() (Counts& counts)
|
||||
{
|
||||
if (! counts.constructed)
|
||||
++counts.access;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class Function>
|
||||
void
|
||||
static_initializer_test::run_many (std::size_t n, Function f)
|
||||
{
|
||||
std::atomic <bool> start (false);
|
||||
std::vector <std::thread> threads;
|
||||
|
||||
threads.reserve (n);
|
||||
|
||||
for (auto i (n); i-- ;)
|
||||
{
|
||||
threads.emplace_back([&]()
|
||||
{
|
||||
while (! start.load())
|
||||
std::this_thread::yield();
|
||||
f();
|
||||
});
|
||||
}
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds (10));
|
||||
std::this_thread::yield();
|
||||
start.store (true);
|
||||
for (auto& thread : threads)
|
||||
thread.join();
|
||||
}
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
static_initializer_test::test (cxx11_tag)
|
||||
{
|
||||
testcase << "cxx11 " << Tag::count << " threads";
|
||||
|
||||
Counts counts;
|
||||
|
||||
run_many (Tag::count, [&]()
|
||||
{
|
||||
static Test <Tag> t (counts);
|
||||
t(counts);
|
||||
});
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
// Visual Studio 2013 and earlier can exhibit both double
|
||||
// construction, and access before construction when function
|
||||
// local statics are initialized concurrently.
|
||||
//
|
||||
expect (counts.constructed > 1 || counts.access > 0);
|
||||
|
||||
#else
|
||||
expect (counts.constructed == 1 && counts.access == 0);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
static_initializer_test::test (beast_tag)
|
||||
{
|
||||
testcase << "beast " << Tag::count << " threads";
|
||||
|
||||
Counts counts;
|
||||
|
||||
run_many (Tag::count, [&counts]()
|
||||
{
|
||||
static static_initializer <Test <Tag>> t (counts);
|
||||
(*t)(counts);
|
||||
});
|
||||
|
||||
expect (counts.constructed == 1 && counts.access == 0);
|
||||
}
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
static_initializer_test::test()
|
||||
{
|
||||
test <Tag> (typename Tag::type {});
|
||||
}
|
||||
|
||||
void
|
||||
static_initializer_test::run ()
|
||||
{
|
||||
test <Case< 4, cxx11_tag>> ();
|
||||
test <Case< 4, beast_tag>> ();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(static_initializer,utility,beast);
|
||||
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <beast/utility/Journal.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <ripple/protocol/TER.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <beast/utility/Journal.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <functional>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_BASICS_BUFFER_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/Slice.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#ifndef RIPPLE_BASICS_COUNTEDOBJECT_H_INCLUDED
|
||||
#define RIPPLE_BASICS_COUNTEDOBJECT_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -136,8 +134,8 @@ private:
|
||||
private:
|
||||
static Counter& getCounter()
|
||||
{
|
||||
static beast::static_initializer<Counter> c;
|
||||
return *c;
|
||||
static Counter c;
|
||||
return c;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/basics/UnorderedContainers.h>
|
||||
#include <beast/utility/ci_char_traits.h>
|
||||
#include <beast/utility/Journal.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef RIPPLE_BASICS_RANGESET_H_INCLUDED
|
||||
#define RIPPLE_BASICS_RANGESET_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_BASICS_SLICE_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -34,9 +34,6 @@ namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
void
|
||||
accessViolation();
|
||||
|
||||
void
|
||||
throwException(
|
||||
std::exception_ptr ep);
|
||||
@@ -54,9 +51,10 @@ Throw (Args&&... args)
|
||||
}
|
||||
|
||||
/** Called when faulty logic causes a broken invariant. */
|
||||
[[noreturn]]
|
||||
void
|
||||
LogicError (
|
||||
std::string const& how);
|
||||
std::string const& how) noexcept;
|
||||
|
||||
/** Called to throw an exception. */
|
||||
#ifndef THROW
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <beast/hash/xxhasher.h>
|
||||
#include <beast/cxx14/utility.h> // <utility>
|
||||
#include <beast/cxx14/type_traits.h> // <type_traits>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
@@ -66,9 +64,9 @@ make_seed_pair() noexcept
|
||||
// state_t(state_t const&) = delete;
|
||||
// state_t& operator=(state_t const&) = delete;
|
||||
};
|
||||
static beast::static_initializer <state_t> state;
|
||||
std::lock_guard <std::mutex> lock (state->mutex);
|
||||
return {state->dist(state->gen), state->dist(state->gen)};
|
||||
static state_t state;
|
||||
std::lock_guard <std::mutex> lock (state.mutex);
|
||||
return {state.dist(state.gen), state.dist(state.gen)};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -87,10 +85,8 @@ private:
|
||||
detail::seed_pair const&
|
||||
init_seed_pair()
|
||||
{
|
||||
static beast::static_initializer <detail::seed_pair,
|
||||
basic_hardened_hash> const p (
|
||||
detail::make_seed_pair<>());
|
||||
return *p;
|
||||
static detail::seed_pair const p = detail::make_seed_pair<>();
|
||||
return p;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -19,18 +19,21 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
[[noreturn]]
|
||||
void
|
||||
accessViolation()
|
||||
accessViolation() noexcept
|
||||
{
|
||||
// dereference memory
|
||||
// location zero
|
||||
// dereference memory location zero
|
||||
int volatile* j = 0;
|
||||
(void)*j;
|
||||
std::abort ();
|
||||
}
|
||||
|
||||
// This hook lets you do pre or post
|
||||
@@ -43,8 +46,9 @@ throwException (std::exception_ptr ep)
|
||||
|
||||
} // detail
|
||||
|
||||
[[noreturn]]
|
||||
void
|
||||
LogicError (std::string const&)
|
||||
LogicError (std::string const&) noexcept
|
||||
{
|
||||
detail::accessViolation();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <beast/container/aged_unordered_set.h>
|
||||
#include <beast/module/core/diagnostic/FatalError.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
@@ -323,9 +322,7 @@ disallowRenegotiation (SSL const* ssl, bool isNew)
|
||||
// Do not allow a connection to renegotiate
|
||||
// more than once every 4 minutes
|
||||
|
||||
static beast::static_initializer <StaticData> static_data;
|
||||
|
||||
auto& sd (static_data.get ());
|
||||
static StaticData sd;
|
||||
std::lock_guard <std::mutex> lock (sd.lock);
|
||||
auto const expired (sd.set.clock().now() - std::chrono::minutes(4));
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_BASICS_MAKE_SSLCONTEXT_H_INCLUDED
|
||||
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <string>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -51,10 +51,8 @@ protected:
|
||||
~CBase58Data ();
|
||||
CBase58Data (CBase58Data const&) = default;
|
||||
CBase58Data& operator= (CBase58Data const&) = default;
|
||||
#ifndef _MSC_VER
|
||||
CBase58Data (CBase58Data&&) = default;
|
||||
CBase58Data& operator= (CBase58Data&&) = default;
|
||||
#endif
|
||||
|
||||
void SetData (int version, Blob const& vchDataIn)
|
||||
{
|
||||
|
||||
@@ -318,13 +318,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
WriterObject (WriterObject&& other) noexcept
|
||||
: writer_ (std::move (other.writer_)),
|
||||
object_ (std::move (other.object_))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
WriterObject (WriterObject&& other) = default;
|
||||
|
||||
Object* operator->()
|
||||
{
|
||||
|
||||
@@ -43,16 +43,7 @@ public:
|
||||
ApplyViewImpl& operator= (ApplyViewImpl&&) = delete;
|
||||
ApplyViewImpl& operator= (ApplyViewImpl const&) = delete;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
ApplyViewImpl (ApplyViewImpl&& other)
|
||||
: ApplyViewBase (std::move(other))
|
||||
, deliver_ (std::move(other.deliver_))
|
||||
{
|
||||
}
|
||||
#else
|
||||
ApplyViewImpl (ApplyViewImpl&&) = default;
|
||||
#endif
|
||||
|
||||
ApplyViewImpl(
|
||||
ReadView const* base, ApplyFlags flags);
|
||||
|
||||
|
||||
@@ -67,21 +67,7 @@ public:
|
||||
OpenView& operator= (OpenView&&) = delete;
|
||||
OpenView& operator= (OpenView const&) = delete;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
OpenView (OpenView&& other)
|
||||
: ReadView (std::move(other))
|
||||
, TxsRawView (std::move(other))
|
||||
, rules_ (std::move(other.rules_))
|
||||
, txs_ (std::move(other.txs_))
|
||||
, info_ (std::move(other.info_))
|
||||
, base_ (std::move(other.base_))
|
||||
, items_ (std::move(other.items_))
|
||||
, hold_ (std::move(other.hold_))
|
||||
{
|
||||
}
|
||||
#else
|
||||
OpenView (OpenView&&) = default;
|
||||
#endif
|
||||
|
||||
/** Construct a shallow copy.
|
||||
|
||||
|
||||
@@ -96,16 +96,7 @@ public:
|
||||
PaymentSandbox& operator= (PaymentSandbox&&) = delete;
|
||||
PaymentSandbox& operator= (PaymentSandbox const&) = delete;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
PaymentSandbox (PaymentSandbox&& other)
|
||||
: ApplyViewBase (std::move(other))
|
||||
, tab_ (std::move(other.tab_))
|
||||
, ps_ (std::move(other.ps_))
|
||||
{
|
||||
}
|
||||
#else
|
||||
PaymentSandbox (PaymentSandbox&&) = default;
|
||||
#endif
|
||||
|
||||
PaymentSandbox (ReadView const* base, ApplyFlags flags)
|
||||
: ApplyViewBase (base, flags)
|
||||
|
||||
@@ -40,14 +40,7 @@ public:
|
||||
Sandbox& operator= (Sandbox&&) = delete;
|
||||
Sandbox& operator= (Sandbox const&) = delete;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
Sandbox (Sandbox&& other)
|
||||
: ApplyViewBase (std::move(other))
|
||||
{
|
||||
}
|
||||
#else
|
||||
Sandbox (Sandbox&&) = default;
|
||||
#endif
|
||||
|
||||
Sandbox (ReadView const* base, ApplyFlags flags)
|
||||
: ApplyViewBase (base, flags)
|
||||
|
||||
@@ -55,20 +55,12 @@ private:
|
||||
|
||||
public:
|
||||
ApplyStateTable() = default;
|
||||
ApplyStateTable (ApplyStateTable&&) = default;
|
||||
|
||||
ApplyStateTable (ApplyStateTable const&) = delete;
|
||||
ApplyStateTable& operator= (ApplyStateTable&&) = delete;
|
||||
ApplyStateTable& operator= (ApplyStateTable const&) = delete;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
ApplyStateTable (ApplyStateTable&& other)
|
||||
: items_ (std::move(other.items_))
|
||||
, dropsDestroyed_ (std::move(other.dropsDestroyed_))
|
||||
{
|
||||
}
|
||||
#else
|
||||
ApplyStateTable (ApplyStateTable&&) = default;
|
||||
#endif
|
||||
|
||||
void
|
||||
apply (RawView& to) const;
|
||||
|
||||
|
||||
@@ -39,19 +39,8 @@ public:
|
||||
ApplyViewBase& operator= (ApplyViewBase&&) = delete;
|
||||
ApplyViewBase& operator= (ApplyViewBase const&) = delete;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
ApplyViewBase (ApplyViewBase&& other)
|
||||
: ApplyView (std::move(other))
|
||||
, RawView (std::move(other))
|
||||
, flags_ (std::move(other.flags_))
|
||||
, base_ (std::move(other.base_))
|
||||
, items_ (std::move(other.items_))
|
||||
, dropsDestroyed_ (std::move(other.dropsDestroyed_))
|
||||
{
|
||||
}
|
||||
#else
|
||||
|
||||
ApplyViewBase (ApplyViewBase&&) = default;
|
||||
#endif
|
||||
|
||||
ApplyViewBase(
|
||||
ReadView const* base, ApplyFlags flags);
|
||||
|
||||
@@ -36,19 +36,11 @@ public:
|
||||
|
||||
RawStateTable() = default;
|
||||
RawStateTable (RawStateTable const&) = default;
|
||||
RawStateTable (RawStateTable&&) = default;
|
||||
|
||||
RawStateTable& operator= (RawStateTable&&) = delete;
|
||||
RawStateTable& operator= (RawStateTable const&) = delete;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
RawStateTable (RawStateTable&& other)
|
||||
: items_ (std::move(other.items_))
|
||||
, dropsDestroyed_ (std::move(other.dropsDestroyed_))
|
||||
{
|
||||
}
|
||||
#else
|
||||
RawStateTable (RawStateTable&&) = default;
|
||||
#endif
|
||||
|
||||
void
|
||||
apply (RawView& to) const;
|
||||
|
||||
|
||||
@@ -55,20 +55,9 @@ public:
|
||||
Path () = default;
|
||||
Path (Path const&) = default;
|
||||
Path& operator=(Path const&) = default;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
Path (Path&& rhs) : path (std::move (rhs.path))
|
||||
{
|
||||
}
|
||||
Path& operator=(Path&& rhs)
|
||||
{
|
||||
path = std::move (rhs.path);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
Path (Path&&) = default;
|
||||
Path& operator=(Path&&) = default;
|
||||
#endif
|
||||
|
||||
template <class First, class... Rest>
|
||||
explicit Path (First&& first, Rest&&... rest)
|
||||
{
|
||||
@@ -118,20 +107,9 @@ public:
|
||||
PathSet () = default;
|
||||
PathSet (PathSet const&) = default;
|
||||
PathSet& operator=(PathSet const&) = default;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
PathSet (PathSet&& rhs) : paths (std::move (rhs.paths))
|
||||
{
|
||||
}
|
||||
PathSet& operator=(PathSet&& rhs)
|
||||
{
|
||||
paths = std::move (rhs.paths);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
PathSet (PathSet&&) = default;
|
||||
PathSet& operator=(PathSet&&) = default;
|
||||
#endif
|
||||
|
||||
template <class First, class... Rest>
|
||||
explicit PathSet (First&& first, Rest&&... rest)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <ripple/nodestore/NodeObject.h>
|
||||
#include <beast/module/core/memory/MemoryBlock.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace NodeStore {
|
||||
ManagerImp&
|
||||
ManagerImp::instance()
|
||||
{
|
||||
static beast::static_initializer<ManagerImp> _;
|
||||
return _.get();
|
||||
static ManagerImp _;
|
||||
return _;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -92,27 +92,8 @@ struct Manifest
|
||||
|
||||
Manifest(std::string s, PublicKey pk, PublicKey spk, std::uint32_t seq);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
Manifest(Manifest&& other)
|
||||
: serialized(std::move(other.serialized))
|
||||
, masterKey(std::move(other.masterKey))
|
||||
, signingKey(std::move(other.signingKey))
|
||||
, sequence(other.sequence)
|
||||
{
|
||||
}
|
||||
|
||||
Manifest& operator=(Manifest&& other)
|
||||
{
|
||||
serialized = std::move(other.serialized);
|
||||
masterKey = std::move(other.masterKey);
|
||||
signingKey = std::move(other.signingKey);
|
||||
sequence = other.sequence;
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
Manifest(Manifest&& other) = default;
|
||||
Manifest& operator=(Manifest&& other) = default;
|
||||
#endif
|
||||
|
||||
bool verify () const;
|
||||
uint256 hash () const;
|
||||
@@ -149,22 +130,9 @@ private:
|
||||
struct MappedType
|
||||
{
|
||||
MappedType() = default;
|
||||
#ifdef _MSC_VER
|
||||
MappedType(MappedType&& rhs)
|
||||
:comment (std::move (rhs.comment))
|
||||
, m (std::move (rhs.m))
|
||||
{
|
||||
}
|
||||
MappedType& operator=(MappedType&& rhs)
|
||||
{
|
||||
comment = std::move (rhs.comment);
|
||||
m = std::move (rhs.m);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
MappedType(MappedType&&) = default;
|
||||
MappedType& operator=(MappedType&&) = default;
|
||||
#endif
|
||||
|
||||
MappedType(std::string comment,
|
||||
std::string serialized,
|
||||
PublicKey pk, PublicKey spk, std::uint32_t seq)
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <beast/crypto/base64.h>
|
||||
#include <beast/http/rfc2616.h>
|
||||
#include <beast/module/core/text/LexicalCast.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <boost/regex.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -197,7 +196,7 @@ appendHello (beast::http::message& m,
|
||||
std::vector<ProtocolVersion>
|
||||
parse_ProtocolVersions (std::string const& s)
|
||||
{
|
||||
static beast::static_initializer<boost::regex> re (
|
||||
static boost::regex re (
|
||||
"^" // start of line
|
||||
"RTXP/" // the string "RTXP/"
|
||||
"([1-9][0-9]*)" // a number (non-zero and with no leading zeroes)
|
||||
@@ -211,7 +210,7 @@ parse_ProtocolVersions (std::string const& s)
|
||||
for (auto const& s : list)
|
||||
{
|
||||
boost::smatch m;
|
||||
if (! boost::regex_match (s, m, *re))
|
||||
if (! boost::regex_match (s, m, re))
|
||||
continue;
|
||||
int major;
|
||||
int minor;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_PROTOCOL_HASHPREFIX_H_INCLUDED
|
||||
|
||||
#include <beast/hash/hash_append.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef RIPPLE_PROTOCOL_IOUAMOUNT_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_IOUAMOUNT_H_INCLUDED
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <beast/utility/Zero.h>
|
||||
#include <boost/operators.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <ripple/protocol/STExchange.h>
|
||||
#include <ripple/protocol/tokens.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <boost/optional.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_PROTOCOL_QUALITY_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_PROTOCOL_RATE_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <boost/operators.hpp>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <ripple/protocol/tokens.h>
|
||||
#include <ripple/protocol/UInt160.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -144,26 +144,11 @@ public:
|
||||
int fieldMeta;
|
||||
int fieldNum;
|
||||
IsSigning const signingField;
|
||||
std::string rawJsonName;
|
||||
Json::StaticString jsonName;
|
||||
std::string jsonName;
|
||||
|
||||
SField(SField const&) = delete;
|
||||
SField& operator=(SField const&) = delete;
|
||||
#ifndef _MSC_VER
|
||||
SField(SField&&) = default;
|
||||
#else // remove this when VS gets defaulted move members
|
||||
SField(SField&& sf)
|
||||
: fieldCode (std::move(sf.fieldCode))
|
||||
, fieldType (std::move(sf.fieldType))
|
||||
, fieldValue (std::move(sf.fieldValue))
|
||||
, fieldName (std::move(sf.fieldName))
|
||||
, fieldMeta (std::move(sf.fieldMeta))
|
||||
, fieldNum (std::move(sf.fieldNum))
|
||||
, signingField (std::move(sf.signingField))
|
||||
, rawJsonName (std::move(sf.rawJsonName))
|
||||
, jsonName (rawJsonName.c_str ())
|
||||
{}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// These constructors can only be called from FieldNames.cpp
|
||||
@@ -191,7 +176,7 @@ public:
|
||||
return !fieldName.empty ();
|
||||
}
|
||||
|
||||
Json::StaticString const& getJsonName () const
|
||||
std::string const& getJsonName () const
|
||||
{
|
||||
return jsonName;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include <beast/streams/debug_ostream.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/Buffer.h>
|
||||
#include <ripple/basics/Slice.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <iomanip>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_PROTOCOL_XRPAMOUNT_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SystemParameters.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <beast/utility/Zero.h>
|
||||
#include <boost/operators.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <beast/crypto/ripemd.h>
|
||||
#include <beast/crypto/sha2.h>
|
||||
#include <beast/hash/endian.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/protocol/digest.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <cassert>
|
||||
|
||||
namespace ripple {
|
||||
@@ -135,9 +134,9 @@ getQualityIndex (uint256 const& uBase, const std::uint64_t uNodeDir)
|
||||
uint256
|
||||
getQualityNext (uint256 const& uBase)
|
||||
{
|
||||
static beast::static_initializer<uint256> const uNext (
|
||||
static uint256 const uNext (
|
||||
from_hex_text<uint256>("10000000000000000"));
|
||||
return uBase + *uNext;
|
||||
return uBase + uNext;
|
||||
}
|
||||
|
||||
std::uint64_t
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/protocol/impl/secp256k1.h>
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <beast/ByteOrder.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
#include <ed25519-donna/ed25519.h>
|
||||
#include <beast/cxx14/type_traits.h> // <type_traits>
|
||||
|
||||
@@ -257,8 +257,7 @@ SField::SField (SerializedTypeID tid, int fv, const char* fn,
|
||||
, fieldMeta (meta)
|
||||
, fieldNum (++num)
|
||||
, signingField (signing)
|
||||
, rawJsonName (getName ())
|
||||
, jsonName (rawJsonName.c_str ())
|
||||
, jsonName (getName ())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -269,8 +268,7 @@ SField::SField (int fc)
|
||||
, fieldMeta (sMD_Never)
|
||||
, fieldNum (++num)
|
||||
, signingField (IsSigning::yes)
|
||||
, rawJsonName (getName ())
|
||||
, jsonName (rawJsonName.c_str ())
|
||||
, jsonName (getName ())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -278,15 +276,15 @@ SField::SField (int fc)
|
||||
// This is naturally done with no extra expense
|
||||
// from getField(int code).
|
||||
SField::SField (SerializedTypeID tid, int fv)
|
||||
: fieldCode (field_code (tid, fv)), fieldType (tid), fieldValue (fv),
|
||||
fieldMeta (sMD_Default),
|
||||
fieldNum (++num),
|
||||
signingField (IsSigning::yes),
|
||||
jsonName (nullptr)
|
||||
: fieldCode (field_code (tid, fv))
|
||||
, fieldType (tid)
|
||||
, fieldValue (fv)
|
||||
, fieldMeta (sMD_Default)
|
||||
, fieldNum (++num)
|
||||
, signingField (IsSigning::yes)
|
||||
{
|
||||
fieldName = std::to_string (tid) + '/' + std::to_string (fv);
|
||||
rawJsonName = getName ();
|
||||
jsonName = Json::StaticString (rawJsonName.c_str ());
|
||||
jsonName = getName ();
|
||||
assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT)));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ STObject::~STObject()
|
||||
{
|
||||
#if 0
|
||||
// Turn this on to get a histogram on exit
|
||||
static beast::static_initializer<Log> log;
|
||||
(*log)(v_.size());
|
||||
static Log log;
|
||||
log(v_.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <typeinfo>
|
||||
|
||||
#include <beast/streams/debug_ostream.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
@@ -124,9 +124,6 @@ sign (PublicKey const& pk,
|
||||
sk.data(), pk.data() + 1, b.data());
|
||||
return b;
|
||||
}
|
||||
default:
|
||||
// VFALCO Work-around for missing msvc [[noreturn]]
|
||||
LogicError("sign: invalid type");
|
||||
case KeyType::secp256k1:
|
||||
{
|
||||
sha512_half_hasher h;
|
||||
@@ -144,6 +141,8 @@ sign (PublicKey const& pk,
|
||||
LogicError("sign: secp256k1_ecdsa_sign failed");
|
||||
return Buffer(sig, siglen);
|
||||
}
|
||||
default:
|
||||
LogicError("sign: invalid type");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,9 +208,6 @@ derivePublicKey (KeyType type, SecretKey const& sk)
|
||||
return PublicKey(Slice{ buf,
|
||||
static_cast<std::size_t>(len) });
|
||||
}
|
||||
default:
|
||||
// VFALCO Work-around for missing msvc [[noreturn]]
|
||||
LogicError("derivePublicKey: bad key type");
|
||||
case KeyType::ed25519:
|
||||
{
|
||||
unsigned char buf[33];
|
||||
@@ -219,6 +215,8 @@ derivePublicKey (KeyType type, SecretKey const& sk)
|
||||
ed25519_publickey(sk.data(), &buf[1]);
|
||||
return PublicKey(Slice{ buf, sizeof(buf) });
|
||||
}
|
||||
default:
|
||||
LogicError("derivePublicKey: bad key type");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <ripple/protocol/TxFormats.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -139,9 +138,8 @@ void TxFormats::addCommonFields (Item& item)
|
||||
TxFormats const&
|
||||
TxFormats::getInstance ()
|
||||
{
|
||||
static beast::static_initializer<
|
||||
TxFormats> instance;
|
||||
return *instance;
|
||||
static TxFormats const instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/protocol/RippleAddress.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/protocol/types.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -43,10 +42,10 @@ std::string to_string(Currency const& currency)
|
||||
if (currency == noCurrency())
|
||||
return "1";
|
||||
|
||||
static beast::static_initializer<Currency> const sIsoBits (
|
||||
static Currency const sIsoBits (
|
||||
from_hex_text<Currency>("FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFF"));
|
||||
|
||||
if ((currency & *sIsoBits).isZero ())
|
||||
if ((currency & sIsoBits).isZero ())
|
||||
{
|
||||
// The offset of the 3 character ISO code in the currency descriptor
|
||||
int const isoOffset = 12;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef RIPPLE_PROTOCOL_SECP256K1_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_SECP256K1_H_INCLUDED
|
||||
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <secp256k1/include/secp256k1.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -44,8 +43,8 @@ secp256k1Context()
|
||||
secp256k1_context_destroy(impl);
|
||||
}
|
||||
};
|
||||
static beast::static_initializer<holder> const h;
|
||||
return h->impl;
|
||||
static holder const h;
|
||||
return h.impl;
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
@@ -79,30 +79,29 @@ Json::Value doAccountObjects (RPC::Context& context)
|
||||
auto type = ltINVALID;
|
||||
if (params.isMember (jss::type))
|
||||
{
|
||||
using filter_types = std::vector <std::pair <std::string, LedgerEntryType>>;
|
||||
static
|
||||
beast::static_initializer <filter_types> const types ([]() -> filter_types {
|
||||
return {
|
||||
{ "account", ltACCOUNT_ROOT },
|
||||
{ "amendments", ltAMENDMENTS },
|
||||
{ "directory", ltDIR_NODE },
|
||||
{ "fee", ltFEE_SETTINGS },
|
||||
{ "hashes", ltLEDGER_HASHES },
|
||||
{ "offer", ltOFFER },
|
||||
{ "state", ltRIPPLE_STATE },
|
||||
{ "ticket", ltTICKET }
|
||||
};
|
||||
}());
|
||||
std::vector<std::pair<std::string, LedgerEntryType>> const
|
||||
types
|
||||
{
|
||||
{ "account", ltACCOUNT_ROOT },
|
||||
{ "amendments", ltAMENDMENTS },
|
||||
{ "directory", ltDIR_NODE },
|
||||
{ "fee", ltFEE_SETTINGS },
|
||||
{ "hashes", ltLEDGER_HASHES },
|
||||
{ "offer", ltOFFER },
|
||||
{ "state", ltRIPPLE_STATE },
|
||||
{ "ticket", ltTICKET }
|
||||
};
|
||||
|
||||
auto const& p = params[jss::type];
|
||||
if (! p.isString ())
|
||||
return RPC::expected_field_error (jss::type, "string");
|
||||
|
||||
auto const filter = p.asString ();
|
||||
auto iter = std::find_if (types->begin (), types->end (),
|
||||
[&filter](decltype (types->front ())& t)
|
||||
auto iter = std::find_if (types.begin (), types.end (),
|
||||
[&filter](decltype (types.front ())& t)
|
||||
{ return t.first == filter; });
|
||||
if (iter == types->end ())
|
||||
if (iter == types.end ())
|
||||
return RPC::invalid_field_error (jss::type);
|
||||
|
||||
type = iter->second;
|
||||
|
||||
@@ -165,8 +165,8 @@ Handler handlerArray[] {
|
||||
} // namespace
|
||||
|
||||
const Handler* getHandler(std::string const& name) {
|
||||
static beast::static_initializer<HandlerTable> const handlers(handlerArray);
|
||||
return handlers->getHandler(name);
|
||||
static HandlerTable const handlers(handlerArray);
|
||||
return handlers.getHandler(name);
|
||||
}
|
||||
|
||||
} // RPC
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <ripple/shamap/SHAMapNodeID.h>
|
||||
#include <ripple/crypto/RandomNumbers.h>
|
||||
#include <beast/module/core/text/LexicalCast.h>
|
||||
#include <beast/utility/static_initializer.h>
|
||||
#include <boost/format.hpp>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
@@ -53,8 +52,8 @@ SHAMapNodeID::Masks (int depth)
|
||||
entry[mask_size-1] = selector;
|
||||
}
|
||||
};
|
||||
static beast::static_initializer <masks_t> masks;
|
||||
return masks->entry[depth];
|
||||
static masks_t const masks;
|
||||
return masks.entry[depth];
|
||||
}
|
||||
|
||||
// canonicalize the hash to a node ID for this depth
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/protocol/SecretKey.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/crypto/KeyType.h>
|
||||
#include <beast/utility/noexcept.h>
|
||||
#include <string>
|
||||
|
||||
namespace ripple {
|
||||
@@ -46,7 +45,6 @@ public:
|
||||
Account() = default;
|
||||
Account (Account const&) = default;
|
||||
Account& operator= (Account const&) = default;
|
||||
|
||||
Account (Account&&) = default;
|
||||
Account& operator= (Account&&) = default;
|
||||
|
||||
|
||||
@@ -50,36 +50,10 @@ struct JTx
|
||||
std::function<void(Env&, JTx&)> signer;
|
||||
|
||||
JTx() = default;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
JTx(JTx&& other)
|
||||
: jv(std::move(other.jv))
|
||||
, requires(std::move(other.requires))
|
||||
, ter(std::move(other.ter))
|
||||
, fill_fee(std::move(other.fill_fee))
|
||||
, fill_seq(std::move(other.fill_seq))
|
||||
, fill_sig(std::move(other.fill_sig))
|
||||
, stx(std::move(other.stx))
|
||||
, signer(std::move(other.signer))
|
||||
, props_(std::move(other.props_))
|
||||
{
|
||||
}
|
||||
|
||||
JTx& operator=(JTx&& other) noexcept
|
||||
{
|
||||
jv = std::move(other.jv);
|
||||
requires = std::move(other.requires);
|
||||
ter = std::move(other.ter);
|
||||
fill_fee = std::move(other.fill_fee);
|
||||
fill_seq = std::move(other.fill_seq);
|
||||
fill_sig = std::move(other.fill_sig);
|
||||
stx = std::move(other.stx);
|
||||
signer = std::move(other.signer);
|
||||
props_ = std::move(other.props_);
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
JTx (JTx const&) = default;
|
||||
JTx& operator=(JTx const&) = default;
|
||||
JTx(JTx&&) = default;
|
||||
JTx& operator=(JTx&&) = default;
|
||||
|
||||
JTx (Json::Value&& jv_)
|
||||
: jv(std::move(jv_))
|
||||
@@ -184,21 +158,8 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
prop_list(prop_list&& other)
|
||||
: list(std::move(other.list))
|
||||
{
|
||||
}
|
||||
|
||||
prop_list& operator=(prop_list&& other)
|
||||
{
|
||||
list = std::move(other.list);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
prop_list(prop_list&& src) = default;
|
||||
prop_list& operator=(prop_list&& src) = default;
|
||||
#endif
|
||||
|
||||
std::vector<std::unique_ptr<
|
||||
basic_prop>> list;
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
|
||||
void*
|
||||
allocate (std::size_t bytes, std::size_t align);
|
||||
|
||||
|
||||
bool
|
||||
deallocate();
|
||||
};
|
||||
@@ -113,10 +113,8 @@ public:
|
||||
|
||||
qalloc_type (qalloc_type const&) = default;
|
||||
qalloc_type& operator= (qalloc_type const&) = default;
|
||||
#ifndef _MSC_VER
|
||||
qalloc_type (qalloc_type&& other) = default;
|
||||
qalloc_type& operator= (qalloc_type&&) = default;
|
||||
#endif
|
||||
|
||||
qalloc_type();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user