mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Merge branch 'develop' into mvadari/fix-bad-cast
This commit is contained in:
@@ -33,10 +33,10 @@ private:
|
||||
|
||||
public:
|
||||
/** Create an empty section. */
|
||||
explicit Section(std::string const& name = "");
|
||||
explicit Section(std::string name = "");
|
||||
|
||||
/** Returns the name of this section. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/** Returns all the lines in the section.
|
||||
This includes everything.
|
||||
*/
|
||||
std::vector<std::string> const&
|
||||
[[nodiscard]] std::vector<std::string> const&
|
||||
lines() const
|
||||
{
|
||||
return lines_;
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
/** Returns all the values in the section.
|
||||
Values are non-empty lines which are not key/value pairs.
|
||||
*/
|
||||
std::vector<std::string> const&
|
||||
[[nodiscard]] std::vector<std::string> const&
|
||||
values() const
|
||||
{
|
||||
return values_;
|
||||
@@ -67,9 +67,13 @@ public:
|
||||
legacy(std::string value)
|
||||
{
|
||||
if (lines_.empty())
|
||||
{
|
||||
lines_.emplace_back(std::move(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
lines_[0] = std::move(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,14 +82,16 @@ public:
|
||||
* @return The retrieved value. A section with an empty legacy value returns
|
||||
an empty string.
|
||||
*/
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
legacy() const
|
||||
{
|
||||
if (lines_.empty())
|
||||
return "";
|
||||
if (lines_.size() > 1)
|
||||
{
|
||||
Throw<std::runtime_error>(
|
||||
"A legacy value must have exactly one line. Section: " + name_);
|
||||
}
|
||||
return lines_[0];
|
||||
}
|
||||
|
||||
@@ -111,11 +117,11 @@ public:
|
||||
}
|
||||
|
||||
/** Returns `true` if a key with the given name exists. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
exists(std::string const& name) const;
|
||||
|
||||
template <class T = std::string>
|
||||
std::optional<T>
|
||||
[[nodiscard]] std::optional<T>
|
||||
get(std::string const& name) const
|
||||
{
|
||||
auto const iter = lookup_.find(name);
|
||||
@@ -126,7 +132,7 @@ public:
|
||||
|
||||
/// Returns a value if present, else another value.
|
||||
template <class T>
|
||||
T
|
||||
[[nodiscard]] T
|
||||
value_or(std::string const& name, T const& other) const
|
||||
{
|
||||
auto const v = get<T>(name);
|
||||
@@ -135,7 +141,7 @@ public:
|
||||
|
||||
// indicates if trailing comments were seen
|
||||
// during the appending of any lines/values
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
had_trailing_comments() const
|
||||
{
|
||||
return had_trailing_comments_;
|
||||
@@ -145,42 +151,42 @@ public:
|
||||
operator<<(std::ostream&, Section const& section);
|
||||
|
||||
// Returns `true` if there are no key/value pairs.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
{
|
||||
return lookup_.empty();
|
||||
}
|
||||
|
||||
// Returns the number of key/value pairs.
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
size() const
|
||||
{
|
||||
return lookup_.size();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return lookup_.cbegin();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return lookup_.cbegin();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return lookup_.cend();
|
||||
}
|
||||
|
||||
// For iteration of key/value pairs.
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return lookup_.cend();
|
||||
@@ -200,7 +206,7 @@ private:
|
||||
|
||||
public:
|
||||
/** Returns `true` if a section with the given name exists. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
exists(std::string const& name) const;
|
||||
|
||||
/** Returns the section with the given name.
|
||||
@@ -210,7 +216,7 @@ public:
|
||||
Section&
|
||||
section(std::string const& name);
|
||||
|
||||
Section const&
|
||||
[[nodiscard]] Section const&
|
||||
section(std::string const& name) const;
|
||||
|
||||
Section const&
|
||||
@@ -258,7 +264,7 @@ public:
|
||||
* legacy value.
|
||||
* @return Contents of the legacy value.
|
||||
*/
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
legacy(std::string const& sectionName) const;
|
||||
|
||||
friend std::ostream&
|
||||
@@ -266,11 +272,10 @@ public:
|
||||
|
||||
// indicates if trailing comments were seen
|
||||
// in any loaded Sections
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
had_trailing_comments() const
|
||||
{
|
||||
return std::any_of(
|
||||
map_.cbegin(), map_.cend(), [](auto s) { return s.second.had_trailing_comments(); });
|
||||
return std::ranges::any_of(map_, [](auto s) { return s.second.had_trailing_comments(); });
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -296,7 +301,7 @@ set(T& target, std::string const& name, Section const& section)
|
||||
if ((found_and_valid = val.has_value()))
|
||||
target = *val;
|
||||
}
|
||||
catch (boost::bad_lexical_cast&)
|
||||
catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
}
|
||||
return found_and_valid;
|
||||
@@ -330,7 +335,7 @@ get(Section const& section, std::string const& name, T const& defaultValue = T{}
|
||||
{
|
||||
return section.value_or<T>(name, defaultValue);
|
||||
}
|
||||
catch (boost::bad_lexical_cast&)
|
||||
catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
}
|
||||
return defaultValue;
|
||||
@@ -345,7 +350,7 @@ get(Section const& section, std::string const& name, char const* defaultValue)
|
||||
if (val.has_value())
|
||||
return *val;
|
||||
}
|
||||
catch (boost::bad_lexical_cast&)
|
||||
catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
}
|
||||
return defaultValue;
|
||||
|
||||
@@ -24,7 +24,8 @@ public:
|
||||
Buffer() = default;
|
||||
|
||||
/** Create an uninitialized buffer with the given size. */
|
||||
explicit Buffer(std::size_t size) : p_(size ? new std::uint8_t[size] : nullptr), size_(size)
|
||||
explicit Buffer(std::size_t size)
|
||||
: p_((size != 0u) ? new std::uint8_t[size] : nullptr), size_(size)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,7 +37,7 @@ public:
|
||||
*/
|
||||
Buffer(void const* data, std::size_t size) : Buffer(size)
|
||||
{
|
||||
if (size)
|
||||
if (size != 0u)
|
||||
std::memcpy(p_.get(), data, size);
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ public:
|
||||
{
|
||||
// Ensure the slice isn't a subset of the buffer.
|
||||
XRPL_ASSERT(
|
||||
s.size() == 0 || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_,
|
||||
s.empty() || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_,
|
||||
"xrpl::Buffer::operator=(Slice) : input not a subset");
|
||||
|
||||
if (auto p = alloc(s.size()))
|
||||
@@ -100,13 +101,13 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the number of bytes in the buffer. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
size() const noexcept
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const noexcept
|
||||
{
|
||||
return 0 == size_;
|
||||
@@ -114,7 +115,7 @@ public:
|
||||
|
||||
operator Slice() const noexcept
|
||||
{
|
||||
if (!size_)
|
||||
if (size_ == 0u)
|
||||
return Slice{};
|
||||
return Slice{p_.get(), size_};
|
||||
}
|
||||
@@ -124,7 +125,7 @@ public:
|
||||
to a single byte, to facilitate pointer arithmetic.
|
||||
*/
|
||||
/** @{ */
|
||||
std::uint8_t const*
|
||||
[[nodiscard]] std::uint8_t const*
|
||||
data() const noexcept
|
||||
{
|
||||
return p_.get();
|
||||
@@ -155,7 +156,7 @@ public:
|
||||
{
|
||||
if (n != size_)
|
||||
{
|
||||
p_.reset(n ? new std::uint8_t[n] : nullptr);
|
||||
p_.reset((n != 0u) ? new std::uint8_t[n] : nullptr);
|
||||
size_ = n;
|
||||
}
|
||||
return p_.get();
|
||||
@@ -168,25 +169,25 @@ public:
|
||||
return alloc(n);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const noexcept
|
||||
{
|
||||
return p_.get();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const noexcept
|
||||
{
|
||||
return p_.get();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return p_.get() + size_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return p_.get() + size_;
|
||||
@@ -199,7 +200,7 @@ operator==(Buffer const& lhs, Buffer const& rhs) noexcept
|
||||
if (lhs.size() != rhs.size())
|
||||
return false;
|
||||
|
||||
if (lhs.size() == 0)
|
||||
if (lhs.empty())
|
||||
return true;
|
||||
|
||||
return std::memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
namespace compression_algorithms {
|
||||
namespace xrpl::compression_algorithms {
|
||||
|
||||
/** LZ4 block compression.
|
||||
* @tparam BufferFactory Callable object or lambda.
|
||||
@@ -68,12 +66,15 @@ lz4Decompress(
|
||||
if (decompressedSize <= 0)
|
||||
Throw<std::runtime_error>("lz4Decompress: integer overflow (output)");
|
||||
|
||||
// NOLINTNEXTLINE(readability-suspicious-call-argument)
|
||||
if (LZ4_decompress_safe(
|
||||
reinterpret_cast<char const*>(in),
|
||||
reinterpret_cast<char*>(decompressed),
|
||||
inSize,
|
||||
decompressedSize) != decompressedSize)
|
||||
{
|
||||
Throw<std::runtime_error>("lz4Decompress: failed");
|
||||
}
|
||||
|
||||
return decompressedSize;
|
||||
}
|
||||
@@ -138,6 +139,4 @@ lz4Decompress(
|
||||
return lz4Decompress(chunk, inSize, decompressed, decompressedSize);
|
||||
}
|
||||
|
||||
} // namespace compression_algorithms
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::compression_algorithms
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
using Entry = std::pair<std::string, int>;
|
||||
using List = std::vector<Entry>;
|
||||
|
||||
List
|
||||
[[nodiscard]] List
|
||||
getCounts(int minimumThreshold) const;
|
||||
|
||||
public:
|
||||
@@ -59,19 +59,19 @@ public:
|
||||
return --count_;
|
||||
}
|
||||
|
||||
int
|
||||
[[nodiscard]] int
|
||||
getCount() const noexcept
|
||||
{
|
||||
return count_.load();
|
||||
}
|
||||
|
||||
Counter*
|
||||
[[nodiscard]] Counter*
|
||||
getNext() const noexcept
|
||||
{
|
||||
return next_;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
getName() const noexcept
|
||||
{
|
||||
return name_;
|
||||
@@ -112,7 +112,6 @@ private:
|
||||
return c;
|
||||
}
|
||||
|
||||
public:
|
||||
CountedObject() noexcept
|
||||
{
|
||||
getCounter().increment();
|
||||
@@ -126,10 +125,13 @@ public:
|
||||
CountedObject&
|
||||
operator=(CountedObject const&) noexcept = default;
|
||||
|
||||
public:
|
||||
~CountedObject() noexcept
|
||||
{
|
||||
getCounter().decrement();
|
||||
}
|
||||
|
||||
friend Object;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
while (elapsed--)
|
||||
while ((elapsed--) != 0u)
|
||||
m_value -= (m_value + Window - 1) / Window;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ template <class E>
|
||||
class Unexpected
|
||||
{
|
||||
public:
|
||||
static_assert(!std::is_same<E, void>::value, "E must not be void");
|
||||
static_assert(!std::is_same_v<E, void>, "E must not be void");
|
||||
|
||||
Unexpected() = delete;
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr E const&
|
||||
[[nodiscard]] constexpr E const&
|
||||
value() const&
|
||||
{
|
||||
return val_;
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
return std::move(val_);
|
||||
}
|
||||
|
||||
constexpr E const&&
|
||||
[[nodiscard]] constexpr E const&&
|
||||
value() const&&
|
||||
{
|
||||
return std::move(val_);
|
||||
@@ -125,13 +125,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr bool
|
||||
[[nodiscard]] constexpr bool
|
||||
has_value() const
|
||||
{
|
||||
return Base::has_value();
|
||||
}
|
||||
|
||||
constexpr T const&
|
||||
[[nodiscard]] constexpr T const&
|
||||
value() const
|
||||
{
|
||||
return Base::value();
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
return Base::value();
|
||||
}
|
||||
|
||||
constexpr E const&
|
||||
[[nodiscard]] constexpr E const&
|
||||
error() const
|
||||
{
|
||||
return Base::error();
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
constexpr E const&
|
||||
[[nodiscard]] constexpr E const&
|
||||
error() const
|
||||
{
|
||||
return Base::error();
|
||||
|
||||
@@ -159,11 +159,11 @@ public:
|
||||
reset();
|
||||
|
||||
/** Get the raw pointer */
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
get() const;
|
||||
|
||||
/** Return the strong count */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
use_count() const;
|
||||
|
||||
template <class TT, class... Args>
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
|
||||
private:
|
||||
/** Return the raw pointer held by this object. */
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
unsafeGetRawPtr() const;
|
||||
|
||||
/** Exchange the current raw pointer held by this object with the given
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
lock() const;
|
||||
|
||||
/** Return true if the strong count is zero. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
expired() const;
|
||||
|
||||
/** Set the pointer to null and decrement the weak count.
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
don't lock the weak pointer. Use the `lock` method if that's what's
|
||||
needed)
|
||||
*/
|
||||
SharedIntrusive<T>
|
||||
[[nodiscard]] SharedIntrusive<T>
|
||||
getStrong() const;
|
||||
|
||||
/** Return true if this is a strong pointer and the strong pointer is
|
||||
@@ -357,31 +357,31 @@ public:
|
||||
/** If this is a strong pointer, return the raw pointer. Otherwise
|
||||
return null.
|
||||
*/
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
get() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong count. Otherwise
|
||||
* return 0
|
||||
*/
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
use_count() const;
|
||||
|
||||
/** Return true if there is a non-zero strong count. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
expired() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong pointer. Otherwise
|
||||
attempt to lock the weak pointer.
|
||||
*/
|
||||
SharedIntrusive<T>
|
||||
[[nodiscard]] SharedIntrusive<T>
|
||||
lock() const;
|
||||
|
||||
/** Return true is this represents a strong pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isStrong() const;
|
||||
|
||||
/** Return true is this represents a weak pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isWeak() const;
|
||||
|
||||
/** If this is a weak pointer, attempt to convert it to a strong
|
||||
@@ -412,7 +412,7 @@ private:
|
||||
private:
|
||||
/** Return the raw pointer held by this object.
|
||||
*/
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
unsafeGetRawPtr() const;
|
||||
|
||||
enum class RefStrength { strong, weak };
|
||||
|
||||
@@ -207,7 +207,7 @@ private:
|
||||
RefCountPair(CountType s, CountType w) noexcept;
|
||||
|
||||
/** Convert back to the packed integer form. */
|
||||
FieldType
|
||||
[[nodiscard]] FieldType
|
||||
combinedValue() const noexcept;
|
||||
|
||||
static constexpr CountType maxStrongValue =
|
||||
@@ -247,7 +247,7 @@ IntrusiveRefCounts::releaseStrongRef() const
|
||||
|
||||
using enum ReleaseStrongRefAction;
|
||||
auto prevIntVal = refCounts.load(std::memory_order_acquire);
|
||||
while (1)
|
||||
while (true)
|
||||
{
|
||||
RefCountPair const prevVal{prevIntVal};
|
||||
XRPL_ASSERT(
|
||||
@@ -298,7 +298,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const
|
||||
// Note: If this becomes a perf bottleneck, the `partialDestroyStartedMask`
|
||||
// may be able to be set non-atomically. But it is easier to reason about
|
||||
// the code if the flag is set atomically.
|
||||
while (1)
|
||||
while (true)
|
||||
{
|
||||
RefCountPair const prevVal{prevIntVal};
|
||||
// Converted the last strong pointer to a weak pointer.
|
||||
@@ -343,7 +343,7 @@ IntrusiveRefCounts::releaseWeakRef() const
|
||||
RefCountPair prev = prevIntVal;
|
||||
if (prev.weak == 1 && prev.strong == 0)
|
||||
{
|
||||
if (!prev.partialDestroyStartedBit)
|
||||
if (prev.partialDestroyStartedBit == 0u)
|
||||
{
|
||||
// This case should only be hit if the partialDestroyStartedBit is
|
||||
// set non-atomically (and even then very rarely). The code is kept
|
||||
@@ -352,7 +352,7 @@ IntrusiveRefCounts::releaseWeakRef() const
|
||||
prevIntVal = refCounts.load(std::memory_order_acquire);
|
||||
prev = RefCountPair{prevIntVal};
|
||||
}
|
||||
if (!prev.partialDestroyFinishedBit)
|
||||
if (prev.partialDestroyFinishedBit == 0u)
|
||||
{
|
||||
// partial destroy MUST finish before running a full destroy (when
|
||||
// using weak pointers)
|
||||
@@ -372,7 +372,7 @@ IntrusiveRefCounts::checkoutStrongRefFromWeak() const noexcept
|
||||
while (!refCounts.compare_exchange_weak(curValue, desiredValue, std::memory_order_acq_rel))
|
||||
{
|
||||
RefCountPair const prev{curValue};
|
||||
if (!prev.strong)
|
||||
if (prev.strong == 0u)
|
||||
return false;
|
||||
|
||||
desiredValue = curValue + strongDelta;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
@@ -28,7 +29,7 @@ struct LocalValues
|
||||
T t_;
|
||||
|
||||
Value() = default;
|
||||
explicit Value(T const& t) : t_(t)
|
||||
explicit Value(T t) : t_(std::move(t))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,10 +43,10 @@ struct LocalValues
|
||||
// Keys are the address of a LocalValue.
|
||||
std::unordered_map<void const*, std::unique_ptr<BasicValue>> values;
|
||||
|
||||
static inline void
|
||||
static void
|
||||
cleanup(LocalValues* lvs)
|
||||
{
|
||||
if (lvs && !lvs->onCoro)
|
||||
if ((lvs != nullptr) && !lvs->onCoro)
|
||||
delete lvs;
|
||||
}
|
||||
};
|
||||
@@ -89,7 +90,7 @@ T&
|
||||
LocalValue<T>::operator*()
|
||||
{
|
||||
auto lvs = detail::getLocalValues().get();
|
||||
if (!lvs)
|
||||
if (lvs == nullptr)
|
||||
{
|
||||
lvs = new detail::LocalValues();
|
||||
lvs->onCoro = false;
|
||||
|
||||
@@ -38,7 +38,7 @@ private:
|
||||
std::string partition_;
|
||||
|
||||
public:
|
||||
Sink(std::string const& partition, beast::severities::Severity thresh, Logs& logs);
|
||||
Sink(std::string partition, beast::severities::Severity thresh, Logs& logs);
|
||||
|
||||
Sink(Sink const&) = delete;
|
||||
Sink&
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
@return `true` if a system file is associated and opened for
|
||||
writing.
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isOpen() const noexcept;
|
||||
|
||||
/** Associate a system file with the log.
|
||||
@@ -226,7 +226,7 @@ private:
|
||||
// expensive argument lists if the stream is not active.
|
||||
#ifndef JLOG
|
||||
#define JLOG(x) \
|
||||
if (!x) \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
} \
|
||||
else \
|
||||
@@ -235,7 +235,7 @@ private:
|
||||
|
||||
#ifndef CLOG
|
||||
#define CLOG(ss) \
|
||||
if (!ss) \
|
||||
if (!(ss)) \
|
||||
; \
|
||||
else \
|
||||
*ss
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
return data_;
|
||||
}
|
||||
|
||||
ProtectedDataType const&
|
||||
[[nodiscard]] ProtectedDataType const&
|
||||
get() const
|
||||
{
|
||||
return data_;
|
||||
|
||||
@@ -78,7 +78,7 @@ struct MantissaRange
|
||||
}
|
||||
|
||||
rep min;
|
||||
rep max{min * 10 - 1};
|
||||
rep max{(min * 10) - 1};
|
||||
int log;
|
||||
mantissa_scale scale;
|
||||
|
||||
@@ -252,9 +252,9 @@ public:
|
||||
// Assume unsigned values are... unsigned. i.e. positive
|
||||
explicit Number(internalrep mantissa, int exponent, normalized);
|
||||
|
||||
constexpr rep
|
||||
[[nodiscard]] constexpr rep
|
||||
mantissa() const noexcept;
|
||||
constexpr int
|
||||
[[nodiscard]] constexpr int
|
||||
exponent() const noexcept;
|
||||
|
||||
constexpr Number
|
||||
@@ -339,13 +339,15 @@ public:
|
||||
}
|
||||
|
||||
/** Return the sign of the amount */
|
||||
constexpr int
|
||||
[[nodiscard]] constexpr int
|
||||
signum() const noexcept
|
||||
{
|
||||
return negative_ ? -1 : (mantissa_ ? 1 : 0);
|
||||
if (negative_)
|
||||
return -1;
|
||||
return (mantissa_ != 0u) ? 1 : 0;
|
||||
}
|
||||
|
||||
Number
|
||||
[[nodiscard]] Number
|
||||
truncate() const noexcept;
|
||||
|
||||
friend constexpr bool
|
||||
@@ -402,19 +404,19 @@ public:
|
||||
static void
|
||||
setMantissaScale(MantissaRange::mantissa_scale scale);
|
||||
|
||||
inline static internalrep
|
||||
static internalrep
|
||||
minMantissa()
|
||||
{
|
||||
return range_.get().min;
|
||||
}
|
||||
|
||||
inline static internalrep
|
||||
static internalrep
|
||||
maxMantissa()
|
||||
{
|
||||
return range_.get().max;
|
||||
}
|
||||
|
||||
inline static int
|
||||
static int
|
||||
mantissaLog()
|
||||
{
|
||||
return range_.get().log;
|
||||
@@ -488,13 +490,13 @@ private:
|
||||
MantissaRange::rep const& minMantissa,
|
||||
MantissaRange::rep const& maxMantissa);
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isnormal() const noexcept;
|
||||
|
||||
// Copy the number, but modify the exponent by "exponentDelta". Because the
|
||||
// mantissa doesn't change, the result will be "mostly" normalized, but the
|
||||
// exponent could go out of range, so it will be checked.
|
||||
Number
|
||||
[[nodiscard]] Number
|
||||
shiftExponent(int exponentDelta) const;
|
||||
|
||||
// Safely convert rep (int64) mantissa to internalrep (uint64). If the rep
|
||||
@@ -507,16 +509,12 @@ private:
|
||||
class Guard;
|
||||
};
|
||||
|
||||
inline constexpr Number::Number(
|
||||
bool negative,
|
||||
internalrep mantissa,
|
||||
int exponent,
|
||||
unchecked) noexcept
|
||||
constexpr Number::Number(bool negative, internalrep mantissa, int exponent, unchecked) noexcept
|
||||
: negative_(negative), mantissa_{mantissa}, exponent_{exponent}
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Number::Number(internalrep mantissa, int exponent, unchecked) noexcept
|
||||
constexpr Number::Number(internalrep mantissa, int exponent, unchecked) noexcept
|
||||
: Number(false, mantissa, exponent, unchecked{})
|
||||
{
|
||||
}
|
||||
@@ -548,7 +546,7 @@ inline Number::Number(rep mantissa) : Number{mantissa, 0}
|
||||
* Please see the "---- External Interface ----" section of the class
|
||||
* documentation for an explanation of why the internal value may be modified.
|
||||
*/
|
||||
inline constexpr Number::rep
|
||||
constexpr Number::rep
|
||||
Number::mantissa() const noexcept
|
||||
{
|
||||
auto m = mantissa_;
|
||||
@@ -569,7 +567,7 @@ Number::mantissa() const noexcept
|
||||
* Please see the "---- External Interface ----" section of the class
|
||||
* documentation for an explanation of why the internal value may be modified.
|
||||
*/
|
||||
inline constexpr int
|
||||
constexpr int
|
||||
Number::exponent() const noexcept
|
||||
{
|
||||
auto e = exponent_;
|
||||
@@ -584,13 +582,13 @@ Number::exponent() const noexcept
|
||||
return e;
|
||||
}
|
||||
|
||||
inline constexpr Number
|
||||
constexpr Number
|
||||
Number::operator+() const noexcept
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline constexpr Number
|
||||
constexpr Number
|
||||
Number::operator-() const noexcept
|
||||
{
|
||||
if (mantissa_ == 0)
|
||||
@@ -705,17 +703,19 @@ Number::normalizeToRange(T minMantissa, T maxMantissa) const
|
||||
int exponent = exponent_;
|
||||
|
||||
if constexpr (std::is_unsigned_v<T>)
|
||||
{
|
||||
XRPL_ASSERT_PARTS(
|
||||
!negative,
|
||||
"xrpl::Number::normalizeToRange",
|
||||
"Number is non-negative for unsigned range.");
|
||||
}
|
||||
Number::normalize(negative, mantissa, exponent, minMantissa, maxMantissa);
|
||||
|
||||
auto const sign = negative ? -1 : 1;
|
||||
return std::make_pair(static_cast<T>(sign * mantissa), exponent);
|
||||
}
|
||||
|
||||
inline constexpr Number
|
||||
constexpr Number
|
||||
abs(Number x) noexcept
|
||||
{
|
||||
if (x < Number{})
|
||||
@@ -746,7 +746,7 @@ power(Number const& f, unsigned n, unsigned d);
|
||||
|
||||
// Return 0 if abs(x) < limit, else returns x
|
||||
|
||||
inline constexpr Number
|
||||
constexpr Number
|
||||
squelch(Number const& x, Number const& limit) noexcept
|
||||
{
|
||||
if (abs(x) < limit)
|
||||
|
||||
@@ -117,22 +117,32 @@ from_string(RangeSet<T>& rs, std::string const& s)
|
||||
case 1: {
|
||||
T front;
|
||||
if (!beast::lexicalCastChecked(front, intervals.front()))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rs.insert(front);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
T front;
|
||||
if (!beast::lexicalCastChecked(front, intervals.front()))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
T back;
|
||||
if (!beast::lexicalCastChecked(back, intervals.back()))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rs.insert(range(front, back));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
uint256 const&
|
||||
[[nodiscard]] uint256 const&
|
||||
as_uint256() const
|
||||
{
|
||||
return hash_;
|
||||
@@ -30,17 +30,17 @@ public:
|
||||
{
|
||||
return hash_;
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isZero() const
|
||||
{
|
||||
return hash_.isZero();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isNonZero() const
|
||||
{
|
||||
return hash_.isNonZero();
|
||||
}
|
||||
int
|
||||
[[nodiscard]] int
|
||||
signum() const
|
||||
{
|
||||
return hash_.signum();
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
/** Return a strong pointer if this is already a strong pointer (i.e. don't
|
||||
lock the weak pointer. Use the `lock` method if that's what's needed)
|
||||
*/
|
||||
std::shared_ptr<T> const&
|
||||
[[nodiscard]] std::shared_ptr<T> const&
|
||||
getStrong() const;
|
||||
|
||||
/** Return true if this is a strong pointer and the strong pointer is
|
||||
@@ -67,30 +67,30 @@ public:
|
||||
/** If this is a strong pointer, return the raw pointer. Otherwise return
|
||||
null.
|
||||
*/
|
||||
T*
|
||||
[[nodiscard]] T*
|
||||
get() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong count. Otherwise return 0
|
||||
*/
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
use_count() const;
|
||||
|
||||
/** Return true if there is a non-zero strong count. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
expired() const;
|
||||
|
||||
/** If this is a strong pointer, return the strong pointer. Otherwise
|
||||
attempt to lock the weak pointer.
|
||||
*/
|
||||
std::shared_ptr<T>
|
||||
[[nodiscard]] std::shared_ptr<T>
|
||||
lock() const;
|
||||
|
||||
/** Return true is this represents a strong pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isStrong() const;
|
||||
|
||||
/** Return true is this represents a weak pointer. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isWeak() const;
|
||||
|
||||
/** If this is a weak pointer, attempt to convert it to a strong pointer.
|
||||
|
||||
@@ -60,18 +60,16 @@ class SlabAllocator
|
||||
{
|
||||
// Use memcpy to avoid unaligned UB
|
||||
// (will optimize to equivalent code)
|
||||
std::memcpy(data, &l_, sizeof(std::uint8_t*));
|
||||
std::memcpy(data, static_cast<void const*>(&l_), sizeof(std::uint8_t*));
|
||||
l_ = data;
|
||||
data += item;
|
||||
}
|
||||
}
|
||||
|
||||
~SlabBlock()
|
||||
{
|
||||
// Calling this destructor will release the allocated memory but
|
||||
// will not properly destroy any objects that are constructed in
|
||||
// the block itself.
|
||||
}
|
||||
// Calling this destructor will release the allocated memory but
|
||||
// will not properly destroy any objects that are constructed in
|
||||
// the block itself.
|
||||
~SlabBlock() = default;
|
||||
|
||||
SlabBlock(SlabBlock const& other) = delete;
|
||||
SlabBlock&
|
||||
@@ -98,11 +96,11 @@ class SlabAllocator
|
||||
|
||||
ret = l_;
|
||||
|
||||
if (ret)
|
||||
if (ret != nullptr)
|
||||
{
|
||||
// Use memcpy to avoid unaligned UB
|
||||
// (will optimize to equivalent code)
|
||||
std::memcpy(&l_, ret, sizeof(std::uint8_t*));
|
||||
std::memcpy(static_cast<void*>(&l_), ret, sizeof(std::uint8_t*));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +125,7 @@ class SlabAllocator
|
||||
|
||||
// Use memcpy to avoid unaligned UB
|
||||
// (will optimize to equivalent code)
|
||||
std::memcpy(ptr, &l_, sizeof(std::uint8_t*));
|
||||
std::memcpy(ptr, static_cast<void const*>(&l_), sizeof(std::uint8_t*));
|
||||
l_ = ptr;
|
||||
}
|
||||
};
|
||||
@@ -159,7 +157,7 @@ public:
|
||||
std::size_t extra,
|
||||
std::size_t alloc = 0,
|
||||
std::size_t align = 0)
|
||||
: itemAlignment_(align ? align : alignof(Type))
|
||||
: itemAlignment_((align != 0u) ? align : alignof(Type))
|
||||
, itemSize_(boost::alignment::align_up(sizeof(Type) + extra, itemAlignment_))
|
||||
, slabSize_(alloc)
|
||||
{
|
||||
@@ -176,15 +174,13 @@ public:
|
||||
SlabAllocator&
|
||||
operator=(SlabAllocator&& other) = delete;
|
||||
|
||||
~SlabAllocator()
|
||||
{
|
||||
// FIXME: We can't destroy the memory blocks we've allocated, because
|
||||
// we can't be sure that they are not being used. Cleaning the
|
||||
// shutdown process up could make this possible.
|
||||
}
|
||||
// FIXME: We can't destroy the memory blocks we've allocated, because
|
||||
// we can't be sure that they are not being used. Cleaning the
|
||||
// shutdown process up could make this possible.
|
||||
~SlabAllocator() = default;
|
||||
|
||||
/** Returns the size of the memory block this allocator returns. */
|
||||
constexpr std::size_t
|
||||
[[nodiscard]] constexpr std::size_t
|
||||
size() const noexcept
|
||||
{
|
||||
return itemSize_;
|
||||
@@ -215,7 +211,7 @@ public:
|
||||
// We want to allocate the memory at a 2 MiB boundary, to make it
|
||||
// possible to use hugepage mappings on Linux:
|
||||
auto buf = boost::alignment::aligned_alloc(megabytes(std::size_t(2)), size);
|
||||
if (!buf) [[unlikely]]
|
||||
if (buf == nullptr) [[unlikely]]
|
||||
return nullptr;
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
@@ -235,7 +231,7 @@ public:
|
||||
|
||||
// This operation is essentially guaranteed not to fail but
|
||||
// let's be careful anyways.
|
||||
if (!boost::alignment::align(itemAlignment_, itemSize_, slabData, slabSize))
|
||||
if (boost::alignment::align(itemAlignment_, itemSize_, slabData, slabSize) == nullptr)
|
||||
{
|
||||
boost::alignment::aligned_free(buf);
|
||||
return nullptr;
|
||||
@@ -288,7 +284,7 @@ class SlabAllocatorSet
|
||||
{
|
||||
private:
|
||||
// The list of allocators that belong to this set
|
||||
boost::container::static_vector<SlabAllocator<Type>, 64> allocators_;
|
||||
boost::container::static_vector<SlabAllocator<Type>, 64> allocators_{};
|
||||
|
||||
std::size_t maxSize_ = 0;
|
||||
|
||||
@@ -347,9 +343,7 @@ public:
|
||||
SlabAllocatorSet&
|
||||
operator=(SlabAllocatorSet&& other) = delete;
|
||||
|
||||
~SlabAllocatorSet()
|
||||
{
|
||||
}
|
||||
~SlabAllocatorSet() = default;
|
||||
|
||||
/** Returns a suitably aligned pointer, if one is available.
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
@note The return type is guaranteed to be a pointer
|
||||
to a single byte, to facilitate pointer arithmetic.
|
||||
*/
|
||||
std::uint8_t const*
|
||||
[[nodiscard]] std::uint8_t const*
|
||||
data() const noexcept
|
||||
{
|
||||
return data_;
|
||||
@@ -123,25 +123,25 @@ public:
|
||||
size_ -= n;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const noexcept
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const noexcept
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return data_ + size_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return data_ + size_;
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
@returns The requested subslice, if the request is valid.
|
||||
@throws std::out_of_range if pos > size()
|
||||
*/
|
||||
Slice
|
||||
[[nodiscard]] Slice
|
||||
substr(std::size_t pos, std::size_t count = std::numeric_limits<std::size_t>::max()) const
|
||||
{
|
||||
if (pos > size())
|
||||
@@ -183,7 +183,7 @@ operator==(Slice const& lhs, Slice const& rhs) noexcept
|
||||
if (lhs.size() != rhs.size())
|
||||
return false;
|
||||
|
||||
if (lhs.size() == 0)
|
||||
if (lhs.empty())
|
||||
return true;
|
||||
|
||||
return std::memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
|
||||
@@ -211,14 +211,14 @@ operator<<(Stream& s, Slice const& v)
|
||||
}
|
||||
|
||||
template <class T, std::size_t N>
|
||||
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
|
||||
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
|
||||
makeSlice(std::array<T, N> const& a)
|
||||
{
|
||||
return Slice(a.data(), a.size());
|
||||
}
|
||||
|
||||
template <class T, class Alloc>
|
||||
std::enable_if_t<std::is_same<T, char>::value || std::is_same<T, unsigned char>::value, Slice>
|
||||
std::enable_if_t<std::is_same_v<T, char> || std::is_same_v<T, unsigned char>, Slice>
|
||||
makeSlice(std::vector<T, Alloc> const& v)
|
||||
{
|
||||
return Slice(v.data(), v.size());
|
||||
|
||||
@@ -222,19 +222,19 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isWeak() const
|
||||
{
|
||||
if (!ptr)
|
||||
return true;
|
||||
return ptr.isWeak();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isCached() const
|
||||
{
|
||||
return ptr && ptr.isStrong();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isExpired() const
|
||||
{
|
||||
return ptr.expired();
|
||||
@@ -251,7 +251,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
typedef typename std::conditional<IsKeyCache, KeyOnlyEntry, ValueEntry>::type Entry;
|
||||
using Entry = std::conditional_t<IsKeyCache, KeyOnlyEntry, ValueEntry>;
|
||||
|
||||
using KeyOnlyCacheType = hardened_partitioned_hash_map<key_type, KeyOnlyEntry, Hash, KeyEqual>;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace xrpl {
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, std::string>::type
|
||||
std::enable_if_t<std::is_arithmetic_v<T>, std::string>
|
||||
to_string(T t)
|
||||
{
|
||||
return std::to_string(t);
|
||||
|
||||
@@ -23,8 +23,10 @@ generalized_set_intersection(
|
||||
{
|
||||
while (first1 != last1 && first2 != last2)
|
||||
{
|
||||
if (comp(*first1, *first2)) // if *first1 < *first2
|
||||
++first1; // then reduce first range
|
||||
if (comp(*first1, *first2))
|
||||
{ // if *first1 < *first2
|
||||
++first1; // then reduce first range
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!comp(*first2, *first1)) // if *first1 == *first2
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
{
|
||||
return reinterpret_cast<pointer>(data_.data());
|
||||
}
|
||||
const_pointer
|
||||
[[nodiscard]] const_pointer
|
||||
data() const
|
||||
{
|
||||
return reinterpret_cast<const_pointer>(data_.data());
|
||||
@@ -118,22 +118,22 @@ public:
|
||||
{
|
||||
return data() + bytes;
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return data();
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return data() + bytes;
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return data();
|
||||
}
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return data() + bytes;
|
||||
@@ -183,11 +183,17 @@ private:
|
||||
return ParseResult::badChar;
|
||||
|
||||
if (c >= 'a')
|
||||
{
|
||||
nibble = static_cast<std::uint32_t>(c - 'a' + 0xA);
|
||||
}
|
||||
else if (c >= 'A')
|
||||
{
|
||||
nibble = static_cast<std::uint32_t>(c - 'A' + 0xA);
|
||||
}
|
||||
else if (c <= '9')
|
||||
{
|
||||
nibble = static_cast<std::uint32_t>(c - '0');
|
||||
}
|
||||
|
||||
if (nibble > 0xFu)
|
||||
return ParseResult::badChar;
|
||||
@@ -263,7 +269,7 @@ public:
|
||||
class Container,
|
||||
class = std::enable_if_t<
|
||||
detail::is_contiguous_container<Container>::value &&
|
||||
std::is_trivially_copyable<typename Container::value_type>::value>>
|
||||
std::is_trivially_copyable_v<typename Container::value_type>>>
|
||||
explicit base_uint(Container const& c)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
@@ -275,7 +281,7 @@ public:
|
||||
template <class Container>
|
||||
std::enable_if_t<
|
||||
detail::is_contiguous_container<Container>::value &&
|
||||
std::is_trivially_copyable<typename Container::value_type>::value,
|
||||
std::is_trivially_copyable_v<typename Container::value_type>,
|
||||
base_uint&>
|
||||
operator=(Container const& c)
|
||||
{
|
||||
@@ -304,12 +310,14 @@ public:
|
||||
return fromVoid(from.data());
|
||||
}
|
||||
|
||||
constexpr int
|
||||
[[nodiscard]] constexpr int
|
||||
signum() const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
{
|
||||
if (data_[i] != 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -390,7 +398,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint const
|
||||
base_uint
|
||||
operator++(int)
|
||||
{
|
||||
// postfix operator
|
||||
@@ -415,7 +423,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint const
|
||||
base_uint
|
||||
operator--(int)
|
||||
{
|
||||
// postfix operator
|
||||
@@ -425,14 +433,14 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint
|
||||
[[nodiscard]] base_uint
|
||||
next() const
|
||||
{
|
||||
auto ret = *this;
|
||||
return ++ret;
|
||||
}
|
||||
|
||||
base_uint
|
||||
[[nodiscard]] base_uint
|
||||
prev() const
|
||||
{
|
||||
auto ret = *this;
|
||||
@@ -444,7 +452,7 @@ public:
|
||||
{
|
||||
std::uint64_t carry = 0;
|
||||
|
||||
for (int i = WIDTH; i--;)
|
||||
for (int i = WIDTH - 1; i >= 0; i--)
|
||||
{
|
||||
std::uint64_t const n = carry + boost::endian::big_to_native(data_[i]) +
|
||||
boost::endian::big_to_native(b.data_[i]);
|
||||
@@ -509,12 +517,12 @@ public:
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isZero() const
|
||||
{
|
||||
return *this == beast::zero;
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
isNonZero() const
|
||||
{
|
||||
return *this != beast::zero;
|
||||
@@ -532,7 +540,7 @@ using uint256 = base_uint<256>;
|
||||
using uint192 = base_uint<192>;
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
[[nodiscard]] inline constexpr std::strong_ordering
|
||||
[[nodiscard]] constexpr std::strong_ordering
|
||||
operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
||||
{
|
||||
// This comparison might seem wrong on a casual inspection because it
|
||||
@@ -553,7 +561,7 @@ operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
||||
}
|
||||
|
||||
template <std::size_t Bits, typename Tag>
|
||||
[[nodiscard]] inline constexpr bool
|
||||
[[nodiscard]] constexpr bool
|
||||
operator==(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
||||
{
|
||||
return (lhs <=> rhs) == 0;
|
||||
@@ -561,7 +569,7 @@ operator==(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline constexpr bool
|
||||
constexpr bool
|
||||
operator==(base_uint<Bits, Tag> const& a, std::uint64_t b)
|
||||
{
|
||||
return a == base_uint<Bits, Tag>(b);
|
||||
@@ -569,28 +577,28 @@ operator==(base_uint<Bits, Tag> const& a, std::uint64_t b)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline constexpr base_uint<Bits, Tag>
|
||||
constexpr base_uint<Bits, Tag>
|
||||
operator^(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
|
||||
{
|
||||
return base_uint<Bits, Tag>(a) ^= b;
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline constexpr base_uint<Bits, Tag>
|
||||
constexpr base_uint<Bits, Tag>
|
||||
operator&(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
|
||||
{
|
||||
return base_uint<Bits, Tag>(a) &= b;
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline constexpr base_uint<Bits, Tag>
|
||||
constexpr base_uint<Bits, Tag>
|
||||
operator|(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
|
||||
{
|
||||
return base_uint<Bits, Tag>(a) |= b;
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline constexpr base_uint<Bits, Tag>
|
||||
constexpr base_uint<Bits, Tag>
|
||||
operator+(base_uint<Bits, Tag> const& a, base_uint<Bits, Tag> const& b)
|
||||
{
|
||||
return base_uint<Bits, Tag>(a) += b;
|
||||
|
||||
@@ -49,8 +49,7 @@ template <class E, class... Args>
|
||||
Throw(Args&&... args)
|
||||
{
|
||||
static_assert(
|
||||
std::is_convertible<E*, std::exception*>::value,
|
||||
"Exception must derive from std::exception.");
|
||||
std::is_convertible_v<E*, std::exception*>, "Exception must derive from std::exception.");
|
||||
|
||||
E e(std::forward<Args>(args)...);
|
||||
LogThrow(std::string("Throwing exception of type " + beast::type_name<E>() + ": ") + e.what());
|
||||
|
||||
@@ -72,14 +72,12 @@ template <class HashAlgorithm = beast::xxhasher>
|
||||
class hardened_hash
|
||||
{
|
||||
private:
|
||||
detail::seed_pair m_seeds;
|
||||
detail::seed_pair m_seeds{detail::make_seed_pair<>()};
|
||||
|
||||
public:
|
||||
using result_type = typename HashAlgorithm::result_type;
|
||||
|
||||
hardened_hash() : m_seeds(detail::make_seed_pair<>())
|
||||
{
|
||||
}
|
||||
hardened_hash() = default;
|
||||
|
||||
template <class T>
|
||||
result_type
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
{
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
partition_map_type* map_{nullptr};
|
||||
typename partition_map_type::iterator ait_;
|
||||
typename partition_map_type::iterator ait_{};
|
||||
typename map_type::iterator mit_;
|
||||
|
||||
iterator() = default;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
|
||||
partition_map_type* map_{nullptr};
|
||||
typename partition_map_type::iterator ait_;
|
||||
typename partition_map_type::iterator ait_{};
|
||||
typename map_type::iterator mit_;
|
||||
|
||||
const_iterator() = default;
|
||||
@@ -231,7 +231,8 @@ public:
|
||||
{
|
||||
// Set partitions to the number of hardware threads if the parameter
|
||||
// is either empty or set to 0.
|
||||
partitions_ = partitions && *partitions ? *partitions : std::thread::hardware_concurrency();
|
||||
partitions_ =
|
||||
partitions && (*partitions != 0u) ? *partitions : std::thread::hardware_concurrency();
|
||||
map_.resize(partitions_);
|
||||
XRPL_ASSERT(
|
||||
partitions_,
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace xrpl {
|
||||
#ifndef __INTELLISENSE__
|
||||
static_assert(
|
||||
// NOLINTNEXTLINE(misc-redundant-expression)
|
||||
std::is_integral<beast::xor_shift_engine::result_type>::value &&
|
||||
std::is_unsigned<beast::xor_shift_engine::result_type>::value,
|
||||
std::is_integral_v<beast::xor_shift_engine::result_type> &&
|
||||
std::is_unsigned_v<beast::xor_shift_engine::result_type>,
|
||||
"The XRPL default PRNG engine must return an unsigned integral type.");
|
||||
|
||||
static_assert(
|
||||
@@ -91,7 +91,7 @@ default_prng()
|
||||
*/
|
||||
/** @{ */
|
||||
template <class Engine, class Integral>
|
||||
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
|
||||
rand_int(Engine& engine, Integral min, Integral max)
|
||||
{
|
||||
XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs");
|
||||
@@ -103,35 +103,35 @@ rand_int(Engine& engine, Integral min, Integral max)
|
||||
}
|
||||
|
||||
template <class Integral>
|
||||
std::enable_if_t<std::is_integral<Integral>::value, Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral>, Integral>
|
||||
rand_int(Integral min, Integral max)
|
||||
{
|
||||
return rand_int(default_prng(), min, max);
|
||||
}
|
||||
|
||||
template <class Engine, class Integral>
|
||||
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
|
||||
rand_int(Engine& engine, Integral max)
|
||||
{
|
||||
return rand_int(engine, Integral(0), max);
|
||||
}
|
||||
|
||||
template <class Integral>
|
||||
std::enable_if_t<std::is_integral<Integral>::value, Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral>, Integral>
|
||||
rand_int(Integral max)
|
||||
{
|
||||
return rand_int(default_prng(), max);
|
||||
}
|
||||
|
||||
template <class Integral, class Engine>
|
||||
std::enable_if_t<std::is_integral<Integral>::value && detail::is_engine<Engine>::value, Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
|
||||
rand_int(Engine& engine)
|
||||
{
|
||||
return rand_int(engine, std::numeric_limits<Integral>::max());
|
||||
}
|
||||
|
||||
template <class Integral = int>
|
||||
std::enable_if_t<std::is_integral<Integral>::value, Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral>, Integral>
|
||||
rand_int()
|
||||
{
|
||||
return rand_int(default_prng(), std::numeric_limits<Integral>::max());
|
||||
@@ -142,7 +142,7 @@ rand_int()
|
||||
/** @{ */
|
||||
template <class Byte, class Engine>
|
||||
std::enable_if_t<
|
||||
(std::is_same<Byte, unsigned char>::value || std::is_same<Byte, std::uint8_t>::value) &&
|
||||
(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>) &&
|
||||
detail::is_engine<Engine>::value,
|
||||
Byte>
|
||||
rand_byte(Engine& engine)
|
||||
@@ -152,9 +152,7 @@ rand_byte(Engine& engine)
|
||||
}
|
||||
|
||||
template <class Byte = std::uint8_t>
|
||||
std::enable_if_t<
|
||||
(std::is_same<Byte, unsigned char>::value || std::is_same<Byte, std::uint8_t>::value),
|
||||
Byte>
|
||||
std::enable_if_t<(std::is_same_v<Byte, unsigned char> || std::is_same_v<Byte, std::uint8_t>), Byte>
|
||||
rand_byte()
|
||||
{
|
||||
return rand_byte<Byte>(default_prng());
|
||||
|
||||
@@ -12,12 +12,12 @@ namespace xrpl {
|
||||
|
||||
template <class Src, class Dest>
|
||||
concept SafeToCast = (std::is_integral_v<Src> && std::is_integral_v<Dest>) &&
|
||||
(std::is_signed<Src>::value || std::is_unsigned<Dest>::value) &&
|
||||
(std::is_signed<Src>::value != std::is_signed<Dest>::value ? sizeof(Dest) > sizeof(Src)
|
||||
: sizeof(Dest) >= sizeof(Src));
|
||||
(std::is_signed_v<Src> || std::is_unsigned_v<Dest>) &&
|
||||
(std::is_signed_v<Src> != std::is_signed_v<Dest> ? sizeof(Dest) > sizeof(Src)
|
||||
: sizeof(Dest) >= sizeof(Src));
|
||||
|
||||
template <class Dest, class Src>
|
||||
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
safe_cast(Src s) noexcept
|
||||
{
|
||||
static_assert(
|
||||
@@ -30,14 +30,14 @@ safe_cast(Src s) noexcept
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
inline constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
safe_cast(Src s) noexcept
|
||||
{
|
||||
return static_cast<Dest>(safe_cast<std::underlying_type_t<Dest>>(s));
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
|
||||
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
|
||||
safe_cast(Src s) noexcept
|
||||
{
|
||||
return safe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
|
||||
@@ -48,7 +48,7 @@ safe_cast(Src s) noexcept
|
||||
// underlying types become safe, it can be converted to a safe_cast.
|
||||
|
||||
template <class Dest, class Src>
|
||||
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
unsafe_cast(Src s) noexcept
|
||||
{
|
||||
static_assert(
|
||||
@@ -59,14 +59,14 @@ unsafe_cast(Src s) noexcept
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
inline constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
constexpr std::enable_if_t<std::is_enum_v<Dest> && std::is_integral_v<Src>, Dest>
|
||||
unsafe_cast(Src s) noexcept
|
||||
{
|
||||
return static_cast<Dest>(unsafe_cast<std::underlying_type_t<Dest>>(s));
|
||||
}
|
||||
|
||||
template <class Dest, class Src>
|
||||
inline constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
|
||||
constexpr std::enable_if_t<std::is_integral_v<Dest> && std::is_enum_v<Src>, Dest>
|
||||
unsafe_cast(Src s) noexcept
|
||||
{
|
||||
return unsafe_cast<Dest>(static_cast<std::underlying_type_t<Src>>(s));
|
||||
|
||||
@@ -10,9 +10,9 @@ std::string
|
||||
strHex(FwdIt begin, FwdIt end)
|
||||
{
|
||||
static_assert(
|
||||
std::is_convertible<
|
||||
std::is_convertible_v<
|
||||
typename std::iterator_traits<FwdIt>::iterator_category,
|
||||
std::forward_iterator_tag>::value,
|
||||
std::forward_iterator_tag>,
|
||||
"FwdIt must be a forward iterator");
|
||||
std::string result;
|
||||
result.reserve(2 * std::distance(begin, end));
|
||||
|
||||
@@ -44,8 +44,7 @@ public:
|
||||
|
||||
template <
|
||||
class OtherInt,
|
||||
class = typename std::enable_if<
|
||||
std::is_integral<OtherInt>::value && sizeof(OtherInt) <= sizeof(Int)>::type>
|
||||
class = std::enable_if_t<std::is_integral_v<OtherInt> && sizeof(OtherInt) <= sizeof(Int)>>
|
||||
explicit constexpr tagged_integer(OtherInt value) noexcept : m_value(value)
|
||||
{
|
||||
static_assert(sizeof(tagged_integer) == sizeof(Int), "tagged_integer is adding padding");
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
return m_ios;
|
||||
}
|
||||
|
||||
boost::asio::io_context const&
|
||||
[[nodiscard]] boost::asio::io_context const&
|
||||
get_io_context() const
|
||||
{
|
||||
return m_ios;
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
void
|
||||
operator()() const
|
||||
{
|
||||
if (!m_probe)
|
||||
if (m_probe == nullptr)
|
||||
return;
|
||||
typename Clock::time_point const now(Clock::now());
|
||||
typename Clock::duration const elapsed(now - m_start);
|
||||
@@ -202,7 +202,7 @@ private:
|
||||
// Calculate when we want to sample again, and
|
||||
// adjust for the expected latency.
|
||||
//
|
||||
typename Clock::time_point const when(now + m_probe->m_period - 2 * elapsed);
|
||||
typename Clock::time_point const when(now + m_probe->m_period - (2 * elapsed));
|
||||
|
||||
if (when <= now)
|
||||
{
|
||||
@@ -224,7 +224,7 @@ private:
|
||||
void
|
||||
operator()(boost::system::error_code const& ec)
|
||||
{
|
||||
if (!m_probe)
|
||||
if (m_probe == nullptr)
|
||||
return;
|
||||
typename Clock::time_point const now(Clock::now());
|
||||
boost::asio::post(
|
||||
|
||||
@@ -63,7 +63,7 @@ struct abstract_clock_wrapper : public abstract_clock<Facade>
|
||||
using typename abstract_clock<Facade>::duration;
|
||||
using typename abstract_clock<Facade>::time_point;
|
||||
|
||||
time_point
|
||||
[[nodiscard]] time_point
|
||||
now() const override
|
||||
{
|
||||
return Clock::now();
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
time_point
|
||||
[[nodiscard]] time_point
|
||||
now() const override
|
||||
{
|
||||
return now_;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace beast {
|
||||
|
||||
/** Expire aged container items past the specified age. */
|
||||
template <class AgedContainer, class Rep, class Period>
|
||||
typename std::enable_if<is_aged_container<AgedContainer>::value, std::size_t>::type
|
||||
std::enable_if_t<is_aged_container<AgedContainer>::value, std::size_t>
|
||||
expire(AgedContainer& c, std::chrono::duration<Rep, Period> const& age)
|
||||
{
|
||||
std::size_t n(0);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
namespace beast::detail {
|
||||
|
||||
// Extracts the key portion of value
|
||||
template <bool maybe_map>
|
||||
@@ -26,9 +25,8 @@ struct aged_associative_container_extract_t<false>
|
||||
Value const&
|
||||
operator()(Value const& value) const
|
||||
{
|
||||
return value;
|
||||
return value; // NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace beast
|
||||
} // namespace beast::detail
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -16,10 +17,10 @@ class aged_container_iterator
|
||||
{
|
||||
public:
|
||||
using iterator_category = typename std::iterator_traits<Iterator>::iterator_category;
|
||||
using value_type = typename std::conditional<
|
||||
using value_type = std::conditional_t<
|
||||
is_const,
|
||||
typename Iterator::value_type::stashed::value_type const,
|
||||
typename Iterator::value_type::stashed::value_type>::type;
|
||||
typename Iterator::value_type::stashed::value_type>;
|
||||
using difference_type = typename std::iterator_traits<Iterator>::difference_type;
|
||||
using pointer = value_type*;
|
||||
using reference = value_type&;
|
||||
@@ -32,9 +33,9 @@ public:
|
||||
template <
|
||||
bool other_is_const,
|
||||
class OtherIterator,
|
||||
class = typename std::enable_if<
|
||||
(other_is_const == false || is_const == true) &&
|
||||
std::is_same<Iterator, OtherIterator>::value == false>::type>
|
||||
class = std::enable_if_t<
|
||||
(!other_is_const || is_const) &&
|
||||
!static_cast<bool>(std::is_same_v<Iterator, OtherIterator>)>>
|
||||
explicit aged_container_iterator(
|
||||
aged_container_iterator<other_is_const, OtherIterator> const& other)
|
||||
: m_iter(other.m_iter)
|
||||
@@ -42,9 +43,7 @@ public:
|
||||
}
|
||||
|
||||
// Disable constructing a const_iterator from a non-const_iterator.
|
||||
template <
|
||||
bool other_is_const,
|
||||
class = typename std::enable_if<other_is_const == false || is_const == true>::type>
|
||||
template <bool other_is_const, class = std::enable_if_t<!other_is_const || is_const>>
|
||||
aged_container_iterator(aged_container_iterator<other_is_const, Iterator> const& other)
|
||||
: m_iter(other.m_iter)
|
||||
{
|
||||
@@ -53,8 +52,8 @@ public:
|
||||
// Disable assigning a const_iterator to a non-const iterator
|
||||
template <bool other_is_const, class OtherIterator>
|
||||
auto
|
||||
operator=(aged_container_iterator<other_is_const, OtherIterator> const& other) -> typename std::
|
||||
enable_if<other_is_const == false || is_const == true, aged_container_iterator&>::type
|
||||
operator=(aged_container_iterator<other_is_const, OtherIterator> const& other)
|
||||
-> std::enable_if_t<!other_is_const || is_const, aged_container_iterator&>
|
||||
{
|
||||
m_iter = other.m_iter;
|
||||
return *this;
|
||||
@@ -116,7 +115,7 @@ public:
|
||||
return &m_iter->value;
|
||||
}
|
||||
|
||||
time_point const&
|
||||
[[nodiscard]] time_point const&
|
||||
when() const
|
||||
{
|
||||
return m_iter->when;
|
||||
@@ -133,11 +132,11 @@ private:
|
||||
friend class aged_container_iterator;
|
||||
|
||||
template <class OtherIterator>
|
||||
aged_container_iterator(OtherIterator const& iter) : m_iter(iter)
|
||||
aged_container_iterator(OtherIterator iter) : m_iter(std::move(iter))
|
||||
{
|
||||
}
|
||||
|
||||
Iterator const&
|
||||
[[nodiscard]] Iterator const&
|
||||
iterator() const
|
||||
{
|
||||
return m_iter;
|
||||
|
||||
@@ -57,8 +57,7 @@ template <
|
||||
class T,
|
||||
class Clock = std::chrono::steady_clock,
|
||||
class Compare = std::less<Key>,
|
||||
class Allocator =
|
||||
std::allocator<typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type>>
|
||||
class Allocator = std::allocator<std::conditional_t<IsMap, std::pair<Key const, T>, Key>>>
|
||||
class aged_ordered_container
|
||||
{
|
||||
public:
|
||||
@@ -67,7 +66,7 @@ public:
|
||||
using duration = typename clock_type::duration;
|
||||
using key_type = Key;
|
||||
using mapped_type = T;
|
||||
using value_type = typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type;
|
||||
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
|
||||
using size_type = std::size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
@@ -110,8 +109,7 @@ private:
|
||||
|
||||
template <
|
||||
class... Args,
|
||||
class =
|
||||
typename std::enable_if<std::is_constructible<value_type, Args...>::value>::type>
|
||||
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
|
||||
element(time_point const& when_, Args&&... args)
|
||||
: value(std::forward<Args>(args)...), when(when_)
|
||||
{
|
||||
@@ -135,9 +133,7 @@ private:
|
||||
return Compare::operator()(lhs.first, rhs.first);
|
||||
}
|
||||
|
||||
pair_value_compare()
|
||||
{
|
||||
}
|
||||
pair_value_compare() = default;
|
||||
|
||||
pair_value_compare(pair_value_compare const& other) : Compare(other)
|
||||
{
|
||||
@@ -190,7 +186,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
Compare const&
|
||||
[[nodiscard]] Compare const&
|
||||
compare() const
|
||||
{
|
||||
return *this;
|
||||
@@ -200,7 +196,7 @@ private:
|
||||
using list_type = typename boost::intrusive::
|
||||
make_list<element, boost::intrusive::constant_time_size<false>>::type;
|
||||
|
||||
using cont_type = typename std::conditional<
|
||||
using cont_type = std::conditional_t<
|
||||
IsMulti,
|
||||
typename boost::intrusive::make_multiset<
|
||||
element,
|
||||
@@ -209,7 +205,7 @@ private:
|
||||
typename boost::intrusive::make_set<
|
||||
element,
|
||||
boost::intrusive::constant_time_size<true>,
|
||||
boost::intrusive::compare<KeyValueCompare>>::type>::type;
|
||||
boost::intrusive::compare<KeyValueCompare>>::type>;
|
||||
|
||||
using ElementAllocator =
|
||||
typename std::allocator_traits<Allocator>::template rebind_alloc<element>;
|
||||
@@ -257,7 +253,8 @@ private:
|
||||
|
||||
config_t(config_t&& other)
|
||||
: KeyValueCompare(std::move(other.key_compare()))
|
||||
, beast::detail::empty_base_optimization<ElementAllocator>(std::move(other))
|
||||
, beast::detail::empty_base_optimization<ElementAllocator>(std::move(
|
||||
static_cast<beast::detail::empty_base_optimization<ElementAllocator>&>(other)))
|
||||
, clock(other.clock)
|
||||
{
|
||||
}
|
||||
@@ -298,7 +295,7 @@ private:
|
||||
return KeyValueCompare::compare();
|
||||
}
|
||||
|
||||
Compare const&
|
||||
[[nodiscard]] Compare const&
|
||||
compare() const
|
||||
{
|
||||
return KeyValueCompare::compare();
|
||||
@@ -310,7 +307,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyValueCompare const&
|
||||
[[nodiscard]] KeyValueCompare const&
|
||||
key_compare() const
|
||||
{
|
||||
return *this;
|
||||
@@ -322,7 +319,7 @@ private:
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const&
|
||||
[[nodiscard]] ElementAllocator const&
|
||||
alloc() const
|
||||
{
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
@@ -373,7 +370,7 @@ private:
|
||||
|
||||
public:
|
||||
using key_compare = Compare;
|
||||
using value_compare = typename std::conditional<IsMap, pair_value_compare, Compare>::type;
|
||||
using value_compare = std::conditional_t<IsMap, pair_value_compare, Compare>;
|
||||
using allocator_type = Allocator;
|
||||
using reference = value_type&;
|
||||
using const_reference = value_type const&;
|
||||
@@ -401,6 +398,8 @@ public:
|
||||
|
||||
class chronological_t
|
||||
{
|
||||
chronological_t() = default;
|
||||
|
||||
public:
|
||||
// A set iterator (IsMap==false) is always const
|
||||
// because the elements of a set are immutable.
|
||||
@@ -488,7 +487,7 @@ public:
|
||||
iterator
|
||||
iterator_to(value_type& value)
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return list.iterator_to(*reinterpret_cast<element*>(
|
||||
reinterpret_cast<uint8_t*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
@@ -497,20 +496,16 @@ public:
|
||||
const_iterator
|
||||
iterator_to(value_type const& value) const
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return list.iterator_to(*reinterpret_cast<element const*>(
|
||||
reinterpret_cast<uint8_t const*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
}
|
||||
|
||||
private:
|
||||
chronological_t()
|
||||
{
|
||||
}
|
||||
|
||||
chronological_t(chronological_t const&) = delete;
|
||||
chronological_t(chronological_t&&) = delete;
|
||||
|
||||
private:
|
||||
friend class aged_ordered_container;
|
||||
list_type mutable list;
|
||||
} chronological;
|
||||
@@ -616,30 +611,30 @@ public:
|
||||
class K,
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
at(K const& k);
|
||||
|
||||
template <
|
||||
class K,
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
typename std::conditional<IsMap, T, void*>::type const&
|
||||
at(K const& k) const;
|
||||
|
||||
template <
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key const& key);
|
||||
|
||||
template <
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key&& key);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -723,7 +718,7 @@ public:
|
||||
iterator
|
||||
iterator_to(value_type& value)
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return m_cont.iterator_to(*reinterpret_cast<element*>(
|
||||
reinterpret_cast<uint8_t*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
@@ -732,7 +727,7 @@ public:
|
||||
const_iterator
|
||||
iterator_to(value_type const& value) const
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return m_cont.iterator_to(*reinterpret_cast<element const*>(
|
||||
reinterpret_cast<uint8_t const*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
@@ -774,37 +769,35 @@ public:
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
|
||||
insert(value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type;
|
||||
insert(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
|
||||
|
||||
// set
|
||||
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
|
||||
auto
|
||||
insert(value_type&& value) ->
|
||||
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type;
|
||||
insert(value_type&& value)
|
||||
-> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>;
|
||||
|
||||
// multiset
|
||||
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
|
||||
auto
|
||||
insert(value_type&& value) ->
|
||||
typename std::enable_if<maybe_multi && !maybe_map, iterator>::type;
|
||||
insert(value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>;
|
||||
|
||||
//---
|
||||
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert(const_iterator hint, value_type const& value) ->
|
||||
typename std::enable_if<!maybe_multi, iterator>::type;
|
||||
insert(const_iterator hint, value_type const& value)
|
||||
-> std::enable_if_t<!maybe_multi, iterator>;
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<maybe_multi, iterator>::type
|
||||
std::enable_if_t<maybe_multi, iterator>
|
||||
insert(const_iterator /*hint*/, value_type const& value)
|
||||
{
|
||||
// VFALCO TODO Figure out how to utilize 'hint'
|
||||
@@ -814,12 +807,11 @@ public:
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert(const_iterator hint, value_type&& value) ->
|
||||
typename std::enable_if<!maybe_multi, iterator>::type;
|
||||
insert(const_iterator hint, value_type&& value) -> std::enable_if_t<!maybe_multi, iterator>;
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<maybe_multi, iterator>::type
|
||||
std::enable_if_t<maybe_multi, iterator>
|
||||
insert(const_iterator /*hint*/, value_type&& value)
|
||||
{
|
||||
// VFALCO TODO Figure out how to utilize 'hint'
|
||||
@@ -828,9 +820,9 @@ public:
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool maybe_map = IsMap>
|
||||
typename std::enable_if<
|
||||
maybe_map && std::is_constructible<value_type, P&&>::value,
|
||||
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
|
||||
std::enable_if_t<
|
||||
maybe_map && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
insert(P&& value)
|
||||
{
|
||||
return emplace(std::forward<P>(value));
|
||||
@@ -838,9 +830,9 @@ public:
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool maybe_map = IsMap>
|
||||
typename std::enable_if<
|
||||
maybe_map && std::is_constructible<value_type, P&&>::value,
|
||||
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
|
||||
std::enable_if_t<
|
||||
maybe_map && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
insert(const_iterator hint, P&& value)
|
||||
{
|
||||
return emplace_hint(hint, std::forward<P>(value));
|
||||
@@ -863,23 +855,22 @@ public:
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
|
||||
emplace(Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
|
||||
|
||||
// multiset, multimap
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type;
|
||||
emplace(Args&&... args) -> std::enable_if_t<maybe_multi, iterator>;
|
||||
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
auto
|
||||
emplace_hint(const_iterator hint, Args&&... args) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
|
||||
emplace_hint(const_iterator hint, Args&&... args)
|
||||
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
|
||||
|
||||
// multiset, multimap
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
typename std::enable_if<maybe_multi, iterator>::type
|
||||
std::enable_if_t<maybe_multi, iterator>
|
||||
emplace_hint(const_iterator /*hint*/, Args&&... args)
|
||||
{
|
||||
// VFALCO TODO Figure out how to utilize 'hint'
|
||||
@@ -1163,12 +1154,12 @@ private:
|
||||
|
||||
template <
|
||||
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
typename std::enable_if<maybe_propagate>::type
|
||||
std::enable_if_t<maybe_propagate>
|
||||
swap_data(aged_ordered_container& other) noexcept;
|
||||
|
||||
template <
|
||||
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
typename std::enable_if<!maybe_propagate>::type
|
||||
std::enable_if_t<!maybe_propagate>
|
||||
swap_data(aged_ordered_container& other) noexcept;
|
||||
|
||||
private:
|
||||
@@ -1395,7 +1386,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::opera
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <class K, bool maybe_multi, bool maybe_map, class>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K const& k)
|
||||
{
|
||||
auto const iter(m_cont.find(k, std::cref(m_config.key_compare())));
|
||||
@@ -1417,7 +1408,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::at(K
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool maybe_multi, bool maybe_map, class>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](
|
||||
Key const& key)
|
||||
{
|
||||
@@ -1436,7 +1427,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::opera
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool maybe_multi, bool maybe_map, class>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::operator[](Key&& key)
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
@@ -1471,8 +1462,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool maybe_multi>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
value_type const& value) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(m_cont.insert_check(extract(value), std::cref(m_config.key_compare()), d));
|
||||
@@ -1491,7 +1481,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool maybe_multi>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type
|
||||
value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
|
||||
{
|
||||
auto const before(m_cont.upper_bound(extract(value), std::cref(m_config.key_compare())));
|
||||
element* const p(new_element(value));
|
||||
@@ -1505,8 +1495,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool maybe_multi, bool maybe_map>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
value_type&& value) ->
|
||||
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type
|
||||
value_type&& value) -> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(m_cont.insert_check(extract(value), std::cref(m_config.key_compare()), d));
|
||||
@@ -1525,7 +1514,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool maybe_multi, bool maybe_map>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
value_type&& value) -> typename std::enable_if<maybe_multi && !maybe_map, iterator>::type
|
||||
value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>
|
||||
{
|
||||
auto const before(m_cont.upper_bound(extract(value), std::cref(m_config.key_compare())));
|
||||
element* const p(new_element(std::move(value)));
|
||||
@@ -1542,7 +1531,7 @@ template <bool maybe_multi>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
const_iterator hint,
|
||||
value_type const& value) -> typename std::enable_if<!maybe_multi, iterator>::type
|
||||
value_type const& value) -> std::enable_if_t<!maybe_multi, iterator>
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(
|
||||
@@ -1563,7 +1552,7 @@ template <bool maybe_multi>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::insert(
|
||||
const_iterator hint,
|
||||
value_type&& value) -> typename std::enable_if<!maybe_multi, iterator>::type
|
||||
value_type&& value) -> std::enable_if_t<!maybe_multi, iterator>
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(
|
||||
@@ -1583,7 +1572,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool maybe_multi, class... Args>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
|
||||
-> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
|
||||
{
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
// construct element here
|
||||
@@ -1605,7 +1594,7 @@ template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compa
|
||||
template <bool maybe_multi, class... Args>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace(Args&&... args)
|
||||
-> typename std::enable_if<maybe_multi, iterator>::type
|
||||
-> std::enable_if_t<maybe_multi, iterator>
|
||||
{
|
||||
element* const p(new_element(std::forward<Args>(args)...));
|
||||
auto const before(m_cont.upper_bound(extract(p->value), std::cref(m_config.key_compare())));
|
||||
@@ -1620,7 +1609,7 @@ template <bool maybe_multi, class... Args>
|
||||
auto
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::emplace_hint(
|
||||
const_iterator hint,
|
||||
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
|
||||
{
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
// construct element here
|
||||
@@ -1770,7 +1759,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::touch
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool maybe_propagate>
|
||||
typename std::enable_if<maybe_propagate>::type
|
||||
std::enable_if_t<maybe_propagate>
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_data(
|
||||
aged_ordered_container& other) noexcept
|
||||
{
|
||||
@@ -1781,7 +1770,7 @@ aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_
|
||||
|
||||
template <bool IsMulti, bool IsMap, class Key, class T, class Clock, class Compare, class Allocator>
|
||||
template <bool maybe_propagate>
|
||||
typename std::enable_if<!maybe_propagate>::type
|
||||
std::enable_if_t<!maybe_propagate>
|
||||
aged_ordered_container<IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::swap_data(
|
||||
aged_ordered_container& other) noexcept
|
||||
{
|
||||
|
||||
@@ -62,8 +62,7 @@ template <
|
||||
class Clock = std::chrono::steady_clock,
|
||||
class Hash = std::hash<Key>,
|
||||
class KeyEqual = std::equal_to<Key>,
|
||||
class Allocator =
|
||||
std::allocator<typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type>>
|
||||
class Allocator = std::allocator<std::conditional_t<IsMap, std::pair<Key const, T>, Key>>>
|
||||
class aged_unordered_container
|
||||
{
|
||||
public:
|
||||
@@ -72,7 +71,7 @@ public:
|
||||
using duration = typename clock_type::duration;
|
||||
using key_type = Key;
|
||||
using mapped_type = T;
|
||||
using value_type = typename std::conditional<IsMap, std::pair<Key const, T>, Key>::type;
|
||||
using value_type = std::conditional_t<IsMap, std::pair<Key const, T>, Key>;
|
||||
using size_type = std::size_t;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
|
||||
@@ -115,8 +114,7 @@ private:
|
||||
|
||||
template <
|
||||
class... Args,
|
||||
class =
|
||||
typename std::enable_if<std::is_constructible<value_type, Args...>::value>::type>
|
||||
class = std::enable_if_t<std::is_constructible_v<value_type, Args...>>>
|
||||
element(time_point const& when_, Args&&... args)
|
||||
: value(std::forward<Args>(args)...), when(when_)
|
||||
{
|
||||
@@ -133,9 +131,7 @@ private:
|
||||
using argument_type = element;
|
||||
using result_type = size_t;
|
||||
|
||||
ValueHash()
|
||||
{
|
||||
}
|
||||
ValueHash() = default;
|
||||
|
||||
ValueHash(Hash const& h) : Hash(h)
|
||||
{
|
||||
@@ -153,7 +149,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
Hash const&
|
||||
[[nodiscard]] Hash const&
|
||||
hash_function() const
|
||||
{
|
||||
return *this;
|
||||
@@ -169,9 +165,7 @@ private:
|
||||
using second_argument_type = element;
|
||||
using result_type = bool;
|
||||
|
||||
KeyValueEqual()
|
||||
{
|
||||
}
|
||||
KeyValueEqual() = default;
|
||||
|
||||
KeyValueEqual(KeyEqual const& keyEqual) : KeyEqual(keyEqual)
|
||||
{
|
||||
@@ -201,7 +195,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyEqual const&
|
||||
[[nodiscard]] KeyEqual const&
|
||||
key_eq() const
|
||||
{
|
||||
return *this;
|
||||
@@ -211,7 +205,7 @@ private:
|
||||
using list_type = typename boost::intrusive::
|
||||
make_list<element, boost::intrusive::constant_time_size<false>>::type;
|
||||
|
||||
using cont_type = typename std::conditional<
|
||||
using cont_type = std::conditional_t<
|
||||
IsMulti,
|
||||
typename boost::intrusive::make_unordered_multiset<
|
||||
element,
|
||||
@@ -224,7 +218,7 @@ private:
|
||||
boost::intrusive::constant_time_size<true>,
|
||||
boost::intrusive::hash<ValueHash>,
|
||||
boost::intrusive::equal<KeyValueEqual>,
|
||||
boost::intrusive::cache_begin<true>>::type>::type;
|
||||
boost::intrusive::cache_begin<true>>::type>;
|
||||
|
||||
using bucket_type = typename cont_type::bucket_type;
|
||||
using bucket_traits = typename cont_type::bucket_traits;
|
||||
@@ -354,7 +348,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
ValueHash const&
|
||||
[[nodiscard]] ValueHash const&
|
||||
value_hash() const
|
||||
{
|
||||
return *this;
|
||||
@@ -366,7 +360,7 @@ private:
|
||||
return ValueHash::hash_function();
|
||||
}
|
||||
|
||||
Hash const&
|
||||
[[nodiscard]] Hash const&
|
||||
hash_function() const
|
||||
{
|
||||
return ValueHash::hash_function();
|
||||
@@ -378,7 +372,7 @@ private:
|
||||
return *this;
|
||||
}
|
||||
|
||||
KeyValueEqual const&
|
||||
[[nodiscard]] KeyValueEqual const&
|
||||
key_value_equal() const
|
||||
{
|
||||
return *this;
|
||||
@@ -390,7 +384,7 @@ private:
|
||||
return key_value_equal().key_eq();
|
||||
}
|
||||
|
||||
KeyEqual const&
|
||||
[[nodiscard]] KeyEqual const&
|
||||
key_eq() const
|
||||
{
|
||||
return key_value_equal().key_eq();
|
||||
@@ -402,7 +396,7 @@ private:
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const&
|
||||
[[nodiscard]] ElementAllocator const&
|
||||
alloc() const
|
||||
{
|
||||
return beast::detail::empty_base_optimization<ElementAllocator>::member();
|
||||
@@ -439,7 +433,7 @@ private:
|
||||
m_vec.clear();
|
||||
}
|
||||
|
||||
size_type
|
||||
[[nodiscard]] size_type
|
||||
max_bucket_count() const
|
||||
{
|
||||
return m_vec.max_size();
|
||||
@@ -451,7 +445,7 @@ private:
|
||||
return m_max_load_factor;
|
||||
}
|
||||
|
||||
float const&
|
||||
[[nodiscard]] float const&
|
||||
max_load_factor() const
|
||||
{
|
||||
return m_max_load_factor;
|
||||
@@ -662,7 +656,7 @@ public:
|
||||
iterator
|
||||
iterator_to(value_type& value)
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return list.iterator_to(*reinterpret_cast<element*>(
|
||||
reinterpret_cast<uint8_t*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
@@ -671,20 +665,17 @@ public:
|
||||
const_iterator
|
||||
iterator_to(value_type const& value) const
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return list.iterator_to(*reinterpret_cast<element const*>(
|
||||
reinterpret_cast<uint8_t const*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
}
|
||||
|
||||
private:
|
||||
chronological_t()
|
||||
{
|
||||
}
|
||||
|
||||
chronological_t(chronological_t const&) = delete;
|
||||
chronological_t(chronological_t&&) = delete;
|
||||
chronological_t() = default;
|
||||
|
||||
private:
|
||||
friend class aged_unordered_container;
|
||||
list_type mutable list;
|
||||
} chronological;
|
||||
@@ -862,30 +853,30 @@ public:
|
||||
class K,
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
at(K const& k);
|
||||
|
||||
template <
|
||||
class K,
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
typename std::conditional<IsMap, T, void*>::type const&
|
||||
at(K const& k) const;
|
||||
|
||||
template <
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key const& key);
|
||||
|
||||
template <
|
||||
bool maybe_multi = IsMulti,
|
||||
bool maybe_map = IsMap,
|
||||
class = typename std::enable_if<maybe_map && !maybe_multi>::type>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
class = std::enable_if_t<maybe_map && !maybe_multi>>
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
operator[](Key&& key);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -933,7 +924,7 @@ public:
|
||||
iterator
|
||||
iterator_to(value_type& value)
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return m_cont.iterator_to(*reinterpret_cast<element*>(
|
||||
reinterpret_cast<uint8_t*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
@@ -942,7 +933,7 @@ public:
|
||||
const_iterator
|
||||
iterator_to(value_type const& value) const
|
||||
{
|
||||
static_assert(std::is_standard_layout<element>::value, "must be standard layout");
|
||||
static_assert(std::is_standard_layout_v<element>, "must be standard layout");
|
||||
return m_cont.iterator_to(*reinterpret_cast<element const*>(
|
||||
reinterpret_cast<uint8_t const*>(&value) -
|
||||
((std::size_t)std::addressof(((element*)0)->member))));
|
||||
@@ -984,29 +975,27 @@ public:
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
|
||||
insert(value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert(value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type;
|
||||
insert(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
|
||||
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
|
||||
auto
|
||||
insert(value_type&& value) ->
|
||||
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type;
|
||||
insert(value_type&& value)
|
||||
-> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>;
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti, bool maybe_map = IsMap>
|
||||
auto
|
||||
insert(value_type&& value) ->
|
||||
typename std::enable_if<maybe_multi && !maybe_map, iterator>::type;
|
||||
insert(value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>;
|
||||
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<!maybe_multi, iterator>::type
|
||||
std::enable_if_t<!maybe_multi, iterator>
|
||||
insert(const_iterator /*hint*/, value_type const& value)
|
||||
{
|
||||
// Hint is ignored but we provide the interface so
|
||||
@@ -1016,7 +1005,7 @@ public:
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<maybe_multi, iterator>::type
|
||||
std::enable_if_t<maybe_multi, iterator>
|
||||
insert(const_iterator /*hint*/, value_type const& value)
|
||||
{
|
||||
// VFALCO TODO The hint could be used to let
|
||||
@@ -1026,7 +1015,7 @@ public:
|
||||
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<!maybe_multi, iterator>::type
|
||||
std::enable_if_t<!maybe_multi, iterator>
|
||||
insert(const_iterator /*hint*/, value_type&& value)
|
||||
{
|
||||
// Hint is ignored but we provide the interface so
|
||||
@@ -1036,7 +1025,7 @@ public:
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<maybe_multi, iterator>::type
|
||||
std::enable_if_t<maybe_multi, iterator>
|
||||
insert(const_iterator /*hint*/, value_type&& value)
|
||||
{
|
||||
// VFALCO TODO The hint could be used to let
|
||||
@@ -1046,9 +1035,9 @@ public:
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool maybe_map = IsMap>
|
||||
typename std::enable_if<
|
||||
maybe_map && std::is_constructible<value_type, P&&>::value,
|
||||
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
|
||||
std::enable_if_t<
|
||||
maybe_map && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
insert(P&& value)
|
||||
{
|
||||
return emplace(std::forward<P>(value));
|
||||
@@ -1056,9 +1045,9 @@ public:
|
||||
|
||||
// map, multimap
|
||||
template <class P, bool maybe_map = IsMap>
|
||||
typename std::enable_if<
|
||||
maybe_map && std::is_constructible<value_type, P&&>::value,
|
||||
typename std::conditional<IsMulti, iterator, std::pair<iterator, bool>>::type>::type
|
||||
std::enable_if_t<
|
||||
maybe_map && std::is_constructible_v<value_type, P&&>,
|
||||
std::conditional_t<IsMulti, iterator, std::pair<iterator, bool>>>
|
||||
insert(const_iterator hint, P&& value)
|
||||
{
|
||||
return emplace_hint(hint, std::forward<P>(value));
|
||||
@@ -1080,23 +1069,22 @@ public:
|
||||
// set, map
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
|
||||
emplace(Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
|
||||
|
||||
// multiset, multimap
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
auto
|
||||
emplace(Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type;
|
||||
emplace(Args&&... args) -> std::enable_if_t<maybe_multi, iterator>;
|
||||
|
||||
// set, map
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
auto
|
||||
emplace_hint(const_iterator /*hint*/, Args&&... args) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
|
||||
emplace_hint(const_iterator /*hint*/, Args&&... args)
|
||||
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
|
||||
|
||||
// multiset, multimap
|
||||
template <bool maybe_multi = IsMulti, class... Args>
|
||||
typename std::enable_if<maybe_multi, iterator>::type
|
||||
std::enable_if_t<maybe_multi, iterator>
|
||||
emplace_hint(const_iterator /*hint*/, Args&&... args)
|
||||
{
|
||||
// VFALCO TODO The hint could be used for multi, to let
|
||||
@@ -1328,7 +1316,7 @@ public:
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<!maybe_multi, bool>::type
|
||||
std::enable_if_t<!maybe_multi, bool>
|
||||
operator==(aged_unordered_container<
|
||||
false,
|
||||
OtherIsMap,
|
||||
@@ -1347,7 +1335,7 @@ public:
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool maybe_multi = IsMulti>
|
||||
typename std::enable_if<maybe_multi, bool>::type
|
||||
std::enable_if_t<maybe_multi, bool>
|
||||
operator==(aged_unordered_container<
|
||||
true,
|
||||
OtherIsMap,
|
||||
@@ -1401,14 +1389,13 @@ private:
|
||||
// map, set
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert_unchecked(value_type const& value) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type;
|
||||
insert_unchecked(value_type const& value)
|
||||
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>;
|
||||
|
||||
// multimap, multiset
|
||||
template <bool maybe_multi = IsMulti>
|
||||
auto
|
||||
insert_unchecked(value_type const& value) ->
|
||||
typename std::enable_if<maybe_multi, iterator>::type;
|
||||
insert_unchecked(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>;
|
||||
|
||||
template <class InputIt>
|
||||
void
|
||||
@@ -1449,7 +1436,7 @@ private:
|
||||
|
||||
template <
|
||||
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
typename std::enable_if<maybe_propagate>::type
|
||||
std::enable_if_t<maybe_propagate>
|
||||
swap_data(aged_unordered_container& other) noexcept
|
||||
{
|
||||
std::swap(m_config.key_compare(), other.m_config.key_compare());
|
||||
@@ -1459,7 +1446,7 @@ private:
|
||||
|
||||
template <
|
||||
bool maybe_propagate = std::allocator_traits<Allocator>::propagate_on_container_swap::value>
|
||||
typename std::enable_if<!maybe_propagate>::type
|
||||
std::enable_if_t<!maybe_propagate>
|
||||
swap_data(aged_unordered_container& other) noexcept
|
||||
{
|
||||
std::swap(m_config.key_compare(), other.m_config.key_compare());
|
||||
@@ -2114,7 +2101,7 @@ template <
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <class K, bool maybe_multi, bool maybe_map, class>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::at(K const& k)
|
||||
{
|
||||
auto const iter(
|
||||
@@ -2155,7 +2142,7 @@ template <
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <bool maybe_multi, bool maybe_map, class>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
|
||||
Key const& key)
|
||||
{
|
||||
@@ -2184,7 +2171,7 @@ template <
|
||||
class KeyEqual,
|
||||
class Allocator>
|
||||
template <bool maybe_multi, bool maybe_map, class>
|
||||
typename std::conditional<IsMap, T, void*>::type&
|
||||
std::conditional_t<IsMap, T, void*>&
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator[](
|
||||
Key&& key)
|
||||
{
|
||||
@@ -2239,8 +2226,7 @@ template <
|
||||
template <bool maybe_multi>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type const& value) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
value_type const& value) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
|
||||
{
|
||||
maybe_rehash(1);
|
||||
typename cont_type::insert_commit_data d;
|
||||
@@ -2272,7 +2258,7 @@ template <
|
||||
template <bool maybe_multi>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type const& value) -> typename std::enable_if<maybe_multi, iterator>::type
|
||||
value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
|
||||
{
|
||||
maybe_rehash(1);
|
||||
element* const p(new_element(value));
|
||||
@@ -2294,8 +2280,7 @@ template <
|
||||
template <bool maybe_multi, bool maybe_map>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type&& value) ->
|
||||
typename std::enable_if<!maybe_multi && !maybe_map, std::pair<iterator, bool>>::type
|
||||
value_type&& value) -> std::enable_if_t<!maybe_multi && !maybe_map, std::pair<iterator, bool>>
|
||||
{
|
||||
maybe_rehash(1);
|
||||
typename cont_type::insert_commit_data d;
|
||||
@@ -2327,7 +2312,7 @@ template <
|
||||
template <bool maybe_multi, bool maybe_map>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::insert(
|
||||
value_type&& value) -> typename std::enable_if<maybe_multi && !maybe_map, iterator>::type
|
||||
value_type&& value) -> std::enable_if_t<maybe_multi && !maybe_map, iterator>
|
||||
{
|
||||
maybe_rehash(1);
|
||||
element* const p(new_element(std::move(value)));
|
||||
@@ -2350,7 +2335,7 @@ template <
|
||||
template <bool maybe_multi, class... Args>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
|
||||
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
|
||||
{
|
||||
maybe_rehash(1);
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
@@ -2415,7 +2400,7 @@ template <
|
||||
template <bool maybe_multi, class... Args>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace(
|
||||
Args&&... args) -> typename std::enable_if<maybe_multi, iterator>::type
|
||||
Args&&... args) -> std::enable_if_t<maybe_multi, iterator>
|
||||
{
|
||||
maybe_rehash(1);
|
||||
element* const p(new_element(std::forward<Args>(args)...));
|
||||
@@ -2438,7 +2423,7 @@ template <bool maybe_multi, class... Args>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::emplace_hint(
|
||||
const_iterator /*hint*/,
|
||||
Args&&... args) -> typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
Args&&... args) -> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
|
||||
{
|
||||
maybe_rehash(1);
|
||||
// VFALCO NOTE Its unfortunate that we need to
|
||||
@@ -2590,7 +2575,7 @@ template <
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool maybe_multi>
|
||||
typename std::enable_if<!maybe_multi, bool>::type
|
||||
std::enable_if_t<!maybe_multi, bool>
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
|
||||
aged_unordered_container<
|
||||
false,
|
||||
@@ -2630,7 +2615,7 @@ template <
|
||||
class OtherHash,
|
||||
class OtherAllocator,
|
||||
bool maybe_multi>
|
||||
typename std::enable_if<maybe_multi, bool>::type
|
||||
std::enable_if_t<maybe_multi, bool>
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::operator==(
|
||||
aged_unordered_container<
|
||||
true,
|
||||
@@ -2677,8 +2662,8 @@ template <
|
||||
template <bool maybe_multi>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
|
||||
insert_unchecked(value_type const& value) ->
|
||||
typename std::enable_if<!maybe_multi, std::pair<iterator, bool>>::type
|
||||
insert_unchecked(value_type const& value)
|
||||
-> std::enable_if_t<!maybe_multi, std::pair<iterator, bool>>
|
||||
{
|
||||
typename cont_type::insert_commit_data d;
|
||||
auto const result(m_cont.insert_check(
|
||||
@@ -2709,8 +2694,7 @@ template <
|
||||
template <bool maybe_multi>
|
||||
auto
|
||||
aged_unordered_container<IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
|
||||
insert_unchecked(value_type const& value) ->
|
||||
typename std::enable_if<maybe_multi, iterator>::type
|
||||
insert_unchecked(value_type const& value) -> std::enable_if_t<maybe_multi, iterator>
|
||||
{
|
||||
element* const p(new_element(value));
|
||||
chronological.list.push_back(*p);
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
namespace beast::detail {
|
||||
|
||||
template <class T>
|
||||
struct is_empty_base_optimization_derived
|
||||
: std::integral_constant<bool, std::is_empty<T>::value && !boost::is_final<T>::value>
|
||||
: std::integral_constant<bool, std::is_empty_v<T> && !boost::is_final<T>::value>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -44,7 +43,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
T const&
|
||||
[[nodiscard]] T const&
|
||||
member() const noexcept
|
||||
{
|
||||
return *this;
|
||||
@@ -86,5 +85,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace beast
|
||||
} // namespace beast::detail
|
||||
|
||||
@@ -16,7 +16,7 @@ struct CopyConst
|
||||
{
|
||||
explicit CopyConst() = default;
|
||||
|
||||
using type = typename std::remove_const<U>::type;
|
||||
using type = std::remove_const_t<U>;
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
@@ -35,9 +35,11 @@ struct CopyConst<T const, U>
|
||||
template <typename T, typename Tag>
|
||||
class ListNode
|
||||
{
|
||||
private:
|
||||
ListNode() = default;
|
||||
|
||||
using value_type = T;
|
||||
|
||||
friend T;
|
||||
friend class List<T, Tag>;
|
||||
|
||||
template <typename>
|
||||
@@ -126,7 +128,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
reference
|
||||
[[nodiscard]] reference
|
||||
dereference() const noexcept
|
||||
{
|
||||
return static_cast<reference>(*m_node);
|
||||
@@ -285,14 +287,14 @@ public:
|
||||
/** Determine if the list is empty.
|
||||
@return `true` if the list is empty.
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const noexcept
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
/** Returns the number of elements in the list. */
|
||||
size_type
|
||||
[[nodiscard]] size_type
|
||||
size() const noexcept
|
||||
{
|
||||
return m_size;
|
||||
@@ -312,7 +314,7 @@ public:
|
||||
@invariant The list may not be empty.
|
||||
@return A const reference to the first element.
|
||||
*/
|
||||
const_reference
|
||||
[[nodiscard]] const_reference
|
||||
front() const noexcept
|
||||
{
|
||||
return element_from(m_head.m_next);
|
||||
@@ -332,7 +334,7 @@ public:
|
||||
@invariant The list may not be empty.
|
||||
@return A const reference to the last element.
|
||||
*/
|
||||
const_reference
|
||||
[[nodiscard]] const_reference
|
||||
back() const noexcept
|
||||
{
|
||||
return element_from(m_tail.m_prev);
|
||||
@@ -350,7 +352,7 @@ public:
|
||||
/** Obtain a const iterator to the beginning of the list.
|
||||
@return A const iterator pointing to the beginning of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const noexcept
|
||||
{
|
||||
return const_iterator(m_head.m_next);
|
||||
@@ -359,7 +361,7 @@ public:
|
||||
/** Obtain a const iterator to the beginning of the list.
|
||||
@return A const iterator pointing to the beginning of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const noexcept
|
||||
{
|
||||
return const_iterator(m_head.m_next);
|
||||
@@ -377,7 +379,7 @@ public:
|
||||
/** Obtain a const iterator to the end of the list.
|
||||
@return A constiterator pointing to the end of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return const_iterator(&m_tail);
|
||||
@@ -386,7 +388,7 @@ public:
|
||||
/** Obtain a const iterator to the end of the list
|
||||
@return A constiterator pointing to the end of the list.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return const_iterator(&m_tail);
|
||||
@@ -547,7 +549,7 @@ public:
|
||||
@param element The element to obtain an iterator for.
|
||||
@return A const iterator to the element.
|
||||
*/
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
const_iterator_to(T const& element) const noexcept
|
||||
{
|
||||
return const_iterator(static_cast<Node const*>(&element));
|
||||
|
||||
@@ -13,22 +13,18 @@ class LockFreeStackIterator
|
||||
{
|
||||
protected:
|
||||
using Node = typename Container::Node;
|
||||
using NodePtr = typename std::conditional<IsConst, Node const*, Node*>::type;
|
||||
using NodePtr = std::conditional_t<IsConst, Node const*, Node*>;
|
||||
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = typename Container::value_type;
|
||||
using difference_type = typename Container::difference_type;
|
||||
using pointer = typename std::
|
||||
conditional<IsConst, typename Container::const_pointer, typename Container::pointer>::type;
|
||||
using reference = typename std::conditional<
|
||||
IsConst,
|
||||
typename Container::const_reference,
|
||||
typename Container::reference>::type;
|
||||
using pointer =
|
||||
std::conditional_t<IsConst, typename Container::const_pointer, typename Container::pointer>;
|
||||
using reference = std::
|
||||
conditional_t<IsConst, typename Container::const_reference, typename Container::reference>;
|
||||
|
||||
LockFreeStackIterator() : m_node()
|
||||
{
|
||||
}
|
||||
LockFreeStackIterator() = default;
|
||||
|
||||
LockFreeStackIterator(NodePtr node) : m_node(node)
|
||||
{
|
||||
@@ -81,7 +77,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
NodePtr m_node;
|
||||
NodePtr m_node{};
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -166,7 +162,7 @@ public:
|
||||
operator=(LockFreeStack const&) = delete;
|
||||
|
||||
/** Returns true if the stack is empty. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
{
|
||||
return m_head.load() == &m_end;
|
||||
@@ -241,25 +237,25 @@ public:
|
||||
return iterator(&m_end);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return const_iterator(m_head.load());
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return const_iterator(&m_end);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return const_iterator(m_head.load());
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return const_iterator(&m_end);
|
||||
|
||||
@@ -37,15 +37,15 @@ public:
|
||||
parse(std::string_view input);
|
||||
|
||||
/** Produce a string from semantic version components. */
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
print() const;
|
||||
|
||||
inline bool
|
||||
[[nodiscard]] bool
|
||||
isRelease() const noexcept
|
||||
{
|
||||
return preReleaseIdentifiers.empty();
|
||||
}
|
||||
inline bool
|
||||
[[nodiscard]] bool
|
||||
isPreRelease() const noexcept
|
||||
{
|
||||
return !isRelease();
|
||||
|
||||
@@ -69,7 +69,7 @@ template <class T>
|
||||
struct is_uniquely_represented
|
||||
: public std::integral_constant<
|
||||
bool,
|
||||
std::is_integral<T>::value || std::is_enum<T>::value || std::is_pointer<T>::value>
|
||||
std::is_integral_v<T> || std::is_enum_v<T> || std::is_pointer_v<T>>
|
||||
{
|
||||
explicit is_uniquely_represented() = default;
|
||||
};
|
||||
@@ -203,13 +203,14 @@ template <class Hasher, class T>
|
||||
inline std::enable_if_t<is_contiguously_hashable<T, Hasher>::value>
|
||||
hash_append(Hasher& h, T const& t) noexcept
|
||||
{
|
||||
h(std::addressof(t), sizeof(t));
|
||||
// NOLINTNEXTLINE(bugprone-sizeof-expression)
|
||||
h(static_cast<void const*>(std::addressof(t)), sizeof(t));
|
||||
}
|
||||
|
||||
template <class Hasher, class T>
|
||||
inline std::enable_if_t<
|
||||
!is_contiguously_hashable<T, Hasher>::value &&
|
||||
(std::is_integral<T>::value || std::is_pointer<T>::value || std::is_enum<T>::value)>
|
||||
(std::is_integral_v<T> || std::is_pointer_v<T> || std::is_enum_v<T>)>
|
||||
hash_append(Hasher& h, T t) noexcept
|
||||
{
|
||||
detail::reverse_bytes(t);
|
||||
@@ -217,7 +218,7 @@ hash_append(Hasher& h, T t) noexcept
|
||||
}
|
||||
|
||||
template <class Hasher, class T>
|
||||
inline std::enable_if_t<std::is_floating_point<T>::value>
|
||||
inline std::enable_if_t<std::is_floating_point_v<T>>
|
||||
hash_append(Hasher& h, T t) noexcept
|
||||
{
|
||||
if (t == 0)
|
||||
|
||||
@@ -64,7 +64,7 @@ private:
|
||||
void
|
||||
flushToState(void const* data, std::size_t len)
|
||||
{
|
||||
if (!state_)
|
||||
if (state_ == nullptr)
|
||||
{
|
||||
state_ = allocState();
|
||||
if (seed_.has_value())
|
||||
@@ -78,7 +78,7 @@ private:
|
||||
}
|
||||
XXH3_64bits_update(state_, readBuffer_.data(), readBuffer_.size());
|
||||
resetBuffers();
|
||||
if (data && len)
|
||||
if ((data != nullptr) && (len != 0u))
|
||||
{
|
||||
XXH3_64bits_update(state_, data, len);
|
||||
}
|
||||
@@ -87,22 +87,18 @@ private:
|
||||
result_type
|
||||
retrieveHash()
|
||||
{
|
||||
if (state_)
|
||||
if (state_ != nullptr)
|
||||
{
|
||||
flushToState(nullptr, 0);
|
||||
return XXH3_64bits_digest(state_);
|
||||
}
|
||||
else
|
||||
|
||||
if (seed_.has_value())
|
||||
{
|
||||
if (seed_.has_value())
|
||||
{
|
||||
return XXH3_64bits_withSeed(readBuffer_.data(), readBuffer_.size(), *seed_);
|
||||
}
|
||||
else
|
||||
{
|
||||
return XXH3_64bits(readBuffer_.data(), readBuffer_.size());
|
||||
}
|
||||
return XXH3_64bits_withSeed(readBuffer_.data(), readBuffer_.size(), *seed_);
|
||||
}
|
||||
|
||||
return XXH3_64bits(readBuffer_.data(), readBuffer_.size());
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -119,19 +115,19 @@ public:
|
||||
|
||||
~xxhasher() noexcept
|
||||
{
|
||||
if (state_)
|
||||
if (state_ != nullptr)
|
||||
{
|
||||
XXH3_freeState(state_);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Seed, std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
|
||||
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
|
||||
explicit xxhasher(Seed seed) : seed_(seed)
|
||||
{
|
||||
resetBuffers();
|
||||
}
|
||||
|
||||
template <class Seed, std::enable_if_t<std::is_unsigned<Seed>::value>* = nullptr>
|
||||
template <class Seed, std::enable_if_t<std::is_unsigned_v<Seed>>* = nullptr>
|
||||
xxhasher(Seed seed, Seed) : seed_(seed)
|
||||
{
|
||||
resetBuffers();
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** Interface for a manager that allows collection of metrics.
|
||||
|
||||
@@ -117,5 +116,4 @@ public:
|
||||
/** @} */
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A metric for measuring an integral value.
|
||||
|
||||
@@ -23,9 +22,7 @@ public:
|
||||
/** Create a null metric.
|
||||
A null metric reports no information.
|
||||
*/
|
||||
Counter()
|
||||
{
|
||||
}
|
||||
Counter() = default;
|
||||
|
||||
/** Create the metric reference the specified implementation.
|
||||
Normally this won't be called directly. Instead, call the appropriate
|
||||
@@ -91,5 +88,4 @@ private:
|
||||
std::shared_ptr<CounterImpl> m_impl;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
class Counter;
|
||||
|
||||
@@ -18,5 +17,4 @@ public:
|
||||
increment(value_type amount) = 0;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A metric for reporting event timing.
|
||||
|
||||
@@ -25,9 +24,7 @@ public:
|
||||
/** Create a null metric.
|
||||
A null metric reports no information.
|
||||
*/
|
||||
Event()
|
||||
{
|
||||
}
|
||||
Event() = default;
|
||||
|
||||
/** Create the metric reference the specified implementation.
|
||||
Normally this won't be called directly. Instead, call the appropriate
|
||||
@@ -48,7 +45,7 @@ public:
|
||||
m_impl->notify(ceil<value_type>(value));
|
||||
}
|
||||
|
||||
std::shared_ptr<EventImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<EventImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
@@ -58,5 +55,4 @@ private:
|
||||
std::shared_ptr<EventImpl> m_impl;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
class Event;
|
||||
|
||||
@@ -18,5 +17,4 @@ public:
|
||||
notify(value_type const& value) = 0;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A metric for measuring an integral value.
|
||||
|
||||
@@ -25,9 +24,7 @@ public:
|
||||
/** Create a null metric.
|
||||
A null metric reports no information.
|
||||
*/
|
||||
Gauge()
|
||||
{
|
||||
}
|
||||
Gauge() = default;
|
||||
|
||||
/** Create the metric reference the specified implementation.
|
||||
Normally this won't be called directly. Instead, call the appropriate
|
||||
@@ -111,7 +108,7 @@ public:
|
||||
}
|
||||
/** @} */
|
||||
|
||||
std::shared_ptr<GaugeImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<GaugeImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
@@ -121,5 +118,4 @@ private:
|
||||
std::shared_ptr<GaugeImpl> m_impl;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
class Gauge;
|
||||
|
||||
@@ -21,5 +20,4 @@ public:
|
||||
increment(difference_type amount) = 0;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A collector front-end that manages a group of metrics. */
|
||||
class Group : public Collector
|
||||
@@ -15,9 +14,8 @@ public:
|
||||
using ptr = std::shared_ptr<Group>;
|
||||
|
||||
/** Returns the name of this group, for diagnostics. */
|
||||
virtual std::string const&
|
||||
[[nodiscard]] virtual std::string const&
|
||||
name() const = 0;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A container for managing a set of metric groups. */
|
||||
class Groups
|
||||
@@ -32,5 +31,4 @@ public:
|
||||
std::unique_ptr<Groups>
|
||||
make_Groups(Collector::ptr const& collector);
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A reference to a handler for performing polled collection. */
|
||||
class Hook final
|
||||
@@ -14,9 +13,7 @@ public:
|
||||
/** Create a null hook.
|
||||
A null hook has no associated handler.
|
||||
*/
|
||||
Hook()
|
||||
{
|
||||
}
|
||||
Hook() = default;
|
||||
|
||||
/** Create a hook referencing the specified implementation.
|
||||
Normally this won't be called directly. Instead, call the appropriate
|
||||
@@ -27,7 +24,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<HookImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<HookImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
@@ -37,5 +34,4 @@ private:
|
||||
std::shared_ptr<HookImpl> m_impl;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
class HookImpl : public std::enable_shared_from_this<HookImpl>
|
||||
{
|
||||
@@ -14,5 +13,4 @@ public:
|
||||
virtual ~HookImpl() = 0;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A metric for measuring an integral value.
|
||||
|
||||
@@ -22,9 +21,7 @@ public:
|
||||
/** Create a null metric.
|
||||
A null metric reports no information.
|
||||
*/
|
||||
Meter()
|
||||
{
|
||||
}
|
||||
Meter() = default;
|
||||
|
||||
/** Create the metric reference the specified implementation.
|
||||
Normally this won't be called directly. Instead, call the appropriate
|
||||
@@ -66,7 +63,7 @@ public:
|
||||
}
|
||||
/** @} */
|
||||
|
||||
std::shared_ptr<MeterImpl> const&
|
||||
[[nodiscard]] std::shared_ptr<MeterImpl> const&
|
||||
impl() const
|
||||
{
|
||||
return m_impl;
|
||||
@@ -76,5 +73,4 @@ private:
|
||||
std::shared_ptr<MeterImpl> m_impl;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
class Meter;
|
||||
|
||||
@@ -18,5 +17,4 @@ public:
|
||||
increment(value_type amount) = 0;
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include <xrpl/beast/insight/Collector.h>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A Collector which does not collect metrics. */
|
||||
class NullCollector : public Collector
|
||||
@@ -15,5 +14,4 @@ public:
|
||||
New();
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include <xrpl/beast/net/IPEndpoint.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
namespace beast::insight {
|
||||
|
||||
/** A Collector that reports metrics to a StatsD server.
|
||||
Reference:
|
||||
@@ -25,5 +24,4 @@ public:
|
||||
New(IP::Endpoint const& address, std::string const& prefix, Journal journal);
|
||||
};
|
||||
|
||||
} // namespace insight
|
||||
} // namespace beast
|
||||
} // namespace beast::insight
|
||||
|
||||
@@ -70,9 +70,13 @@ hash_append(Hasher& h, beast::IP::Address const& addr) noexcept
|
||||
{
|
||||
using beast::hash_append;
|
||||
if (addr.is_v4())
|
||||
{
|
||||
hash_append(h, addr.to_v4().to_bytes());
|
||||
}
|
||||
else if (addr.is_v6())
|
||||
{
|
||||
hash_append(h, addr.to_v6().to_bytes());
|
||||
}
|
||||
else
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace IP {
|
||||
namespace beast::IP {
|
||||
|
||||
/** Convert to Endpoint.
|
||||
The port is set to zero.
|
||||
@@ -27,8 +26,7 @@ to_asio_address(Endpoint const& endpoint);
|
||||
boost::asio::ip::tcp::endpoint
|
||||
to_asio_endpoint(Endpoint const& endpoint);
|
||||
|
||||
} // namespace IP
|
||||
} // namespace beast
|
||||
} // namespace beast::IP
|
||||
|
||||
namespace beast {
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <boost/asio/ip/address_v4.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace IP {
|
||||
namespace beast::IP {
|
||||
|
||||
using AddressV4 = boost::asio::ip::address_v4;
|
||||
|
||||
@@ -23,5 +22,4 @@ is_public(AddressV4 const& addr);
|
||||
char
|
||||
get_class(AddressV4 const& address);
|
||||
|
||||
} // namespace IP
|
||||
} // namespace beast
|
||||
} // namespace beast::IP
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
#include <boost/asio/ip/address_v6.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace IP {
|
||||
namespace beast::IP {
|
||||
|
||||
using AddressV6 = boost::asio::ip::address_v6;
|
||||
|
||||
@@ -17,5 +16,4 @@ is_private(AddressV6 const& addr);
|
||||
bool
|
||||
is_public(AddressV6 const& addr);
|
||||
|
||||
} // namespace IP
|
||||
} // namespace beast
|
||||
} // namespace beast::IP
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace IP {
|
||||
namespace beast::IP {
|
||||
|
||||
using Port = std::uint16_t;
|
||||
|
||||
@@ -21,7 +20,7 @@ public:
|
||||
Endpoint();
|
||||
|
||||
/** Create an endpoint from the address and optional port. */
|
||||
explicit Endpoint(Address const& addr, Port port = 0);
|
||||
explicit Endpoint(Address addr, Port port = 0);
|
||||
|
||||
/** Create an Endpoint from a string.
|
||||
If the port is omitted, the endpoint will have a zero port.
|
||||
@@ -33,25 +32,25 @@ public:
|
||||
from_string(std::string const& s);
|
||||
|
||||
/** Returns a string representing the endpoint. */
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
to_string() const;
|
||||
|
||||
/** Returns the port number on the endpoint. */
|
||||
Port
|
||||
[[nodiscard]] Port
|
||||
port() const
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
/** Returns a new Endpoint with a different port. */
|
||||
Endpoint
|
||||
[[nodiscard]] Endpoint
|
||||
at_port(Port port) const
|
||||
{
|
||||
return Endpoint(m_addr, port);
|
||||
}
|
||||
|
||||
/** Returns the address portion of this endpoint. */
|
||||
Address const&
|
||||
[[nodiscard]] Address const&
|
||||
address() const
|
||||
{
|
||||
return m_addr;
|
||||
@@ -59,22 +58,22 @@ public:
|
||||
|
||||
/** Convenience accessors for the address part. */
|
||||
/** @{ */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
is_v4() const
|
||||
{
|
||||
return m_addr.is_v4();
|
||||
}
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
is_v6() const
|
||||
{
|
||||
return m_addr.is_v6();
|
||||
}
|
||||
AddressV4 const
|
||||
[[nodiscard]] AddressV4
|
||||
to_v4() const
|
||||
{
|
||||
return m_addr.to_v4();
|
||||
}
|
||||
AddressV6 const
|
||||
[[nodiscard]] AddressV6
|
||||
to_v6() const
|
||||
{
|
||||
return m_addr.to_v6();
|
||||
@@ -184,8 +183,7 @@ operator<<(OutputStream& os, Endpoint const& endpoint)
|
||||
std::istream&
|
||||
operator>>(std::istream& is, Endpoint& endpoint);
|
||||
|
||||
} // namespace IP
|
||||
} // namespace beast
|
||||
} // namespace beast::IP
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace beast {
|
||||
namespace rfc2616 {
|
||||
namespace beast::rfc2616 {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -53,8 +52,9 @@ is_white(char c)
|
||||
case '\t':
|
||||
case '\v':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class FwdIter>
|
||||
@@ -349,8 +349,10 @@ bool
|
||||
token_in_list(boost::string_ref const& value, boost::string_ref const& token)
|
||||
{
|
||||
for (auto const& item : make_list(value))
|
||||
{
|
||||
if (ci_equal(item, token))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -359,11 +361,12 @@ bool
|
||||
is_keep_alive(boost::beast::http::message<isRequest, Body, Fields> const& m)
|
||||
{
|
||||
if (m.version() <= 10)
|
||||
{
|
||||
return boost::beast::http::token_list{m[boost::beast::http::field::connection]}.exists(
|
||||
"keep-alive");
|
||||
}
|
||||
return !boost::beast::http::token_list{m[boost::beast::http::field::connection]}.exists(
|
||||
"close");
|
||||
}
|
||||
|
||||
} // namespace rfc2616
|
||||
} // namespace beast
|
||||
} // namespace beast::rfc2616
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
namespace beast {
|
||||
namespace test {
|
||||
namespace beast::test {
|
||||
|
||||
/** Mix-in to support tests using asio coroutines.
|
||||
|
||||
@@ -44,7 +43,7 @@ public:
|
||||
: work_(boost::asio::make_work_guard(ios_))
|
||||
{
|
||||
threads_.reserve(concurrency);
|
||||
while (concurrency--)
|
||||
while ((concurrency--) != 0u)
|
||||
threads_.emplace_back([&] { ios_.run(); });
|
||||
}
|
||||
|
||||
@@ -125,5 +124,4 @@ enable_yield_to::spawn(F0&& f, FN&&... fn)
|
||||
spawn(fn...);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace beast
|
||||
} // namespace beast::test
|
||||
|
||||
@@ -15,7 +15,7 @@ template <typename T>
|
||||
std::string
|
||||
type_name()
|
||||
{
|
||||
using TR = typename std::remove_reference<T>::type;
|
||||
using TR = std::remove_reference_t<T>;
|
||||
|
||||
std::string name = typeid(TR).name();
|
||||
|
||||
@@ -27,14 +27,18 @@ type_name()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (std::is_const<TR>::value)
|
||||
if (std::is_const_v<TR>)
|
||||
name += " const";
|
||||
if (std::is_volatile<TR>::value)
|
||||
if (std::is_volatile_v<TR>)
|
||||
name += " volatile";
|
||||
if (std::is_lvalue_reference<T>::value)
|
||||
if (std::is_lvalue_reference_v<T>)
|
||||
{
|
||||
name += "&";
|
||||
else if (std::is_rvalue_reference<T>::value)
|
||||
}
|
||||
else if (std::is_rvalue_reference_v<T>)
|
||||
{
|
||||
name += "&&";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
/** Utility for producing nicely composed output of amounts with units. */
|
||||
class amount
|
||||
@@ -42,5 +41,4 @@ operator<<(std::ostream& s, amount const& t)
|
||||
return s;
|
||||
}
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace detail {
|
||||
namespace beast::unit_test::detail {
|
||||
|
||||
/** Adapter to constrain a container interface.
|
||||
The interface allows for limited read only operations. Derived classes
|
||||
@@ -27,7 +25,7 @@ protected:
|
||||
return m_cont;
|
||||
}
|
||||
|
||||
cont_type const&
|
||||
[[nodiscard]] cont_type const&
|
||||
cont() const
|
||||
{
|
||||
return m_cont;
|
||||
@@ -41,14 +39,14 @@ public:
|
||||
using const_iterator = typename cont_type::const_iterator;
|
||||
|
||||
/** Returns `true` if the container is empty. */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
empty() const
|
||||
{
|
||||
return m_cont.empty();
|
||||
}
|
||||
|
||||
/** Returns the number of items in the container. */
|
||||
size_type
|
||||
[[nodiscard]] size_type
|
||||
size() const
|
||||
{
|
||||
return m_cont.size();
|
||||
@@ -56,25 +54,25 @@ public:
|
||||
|
||||
/** Returns forward iterators for traversal. */
|
||||
/** @{ */
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return m_cont.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return m_cont.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return m_cont.cend();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return m_cont.cend();
|
||||
@@ -82,6 +80,4 @@ public:
|
||||
/** @} */
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test::detail
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
#include <xrpl/beast/unit_test/suite_list.h>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -42,5 +41,4 @@ global_suites()
|
||||
return detail::global_suites();
|
||||
}
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
// Predicate for implementing matches
|
||||
class selector
|
||||
@@ -163,5 +162,4 @@ match_library(std::string const& name)
|
||||
return selector(selector::library, name);
|
||||
}
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#include <xrpl/beast/unit_test/results.h>
|
||||
#include <xrpl/beast/unit_test/runner.h>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
/** A test runner that stores the results. */
|
||||
class recorder : public runner
|
||||
@@ -22,56 +21,55 @@ public:
|
||||
recorder() = default;
|
||||
|
||||
/** Returns a report with the results of all completed suites. */
|
||||
results const&
|
||||
[[nodiscard]] results const&
|
||||
report() const
|
||||
{
|
||||
return m_results;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void
|
||||
void
|
||||
on_suite_begin(suite_info const& info) override
|
||||
{
|
||||
m_suite = suite_results(info.full_name());
|
||||
}
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_suite_end() override
|
||||
{
|
||||
m_results.insert(std::move(m_suite));
|
||||
}
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_case_begin(std::string const& name) override
|
||||
{
|
||||
m_case = case_results(name);
|
||||
}
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_case_end() override
|
||||
{
|
||||
if (m_case.tests.size() > 0)
|
||||
if (!m_case.tests.empty())
|
||||
m_suite.insert(std::move(m_case));
|
||||
}
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_pass() override
|
||||
{
|
||||
m_case.tests.pass();
|
||||
}
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_fail(std::string const& reason) override
|
||||
{
|
||||
m_case.tests.fail(reason);
|
||||
}
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_log(std::string const& s) override
|
||||
{
|
||||
m_case.log.insert(s);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -86,7 +85,7 @@ public:
|
||||
reporter&
|
||||
operator=(reporter const&) = delete;
|
||||
|
||||
~reporter();
|
||||
~reporter() override;
|
||||
|
||||
explicit reporter(std::ostream& os = std::cout);
|
||||
|
||||
@@ -94,42 +93,42 @@ private:
|
||||
static std::string
|
||||
fmtdur(typename clock_type::duration const& d);
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_suite_begin(suite_info const& info) override;
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_suite_end() override;
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_case_begin(std::string const& name) override;
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_case_end() override;
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_pass() override;
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_fail(std::string const& reason) override;
|
||||
|
||||
virtual void
|
||||
void
|
||||
on_log(std::string const& s) override;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::suite_results::add(case_results const& r)
|
||||
reporter<Unused>::suite_results::add(case_results const& r)
|
||||
{
|
||||
++cases;
|
||||
total += r.total;
|
||||
failed += r.failed;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::results::add(suite_results const& r)
|
||||
reporter<Unused>::results::add(suite_results const& r)
|
||||
{
|
||||
++suites;
|
||||
total += r.total;
|
||||
@@ -160,13 +159,13 @@ reporter<_>::results::add(suite_results const& r)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class _>
|
||||
reporter<_>::reporter(std::ostream& os) : os_(os)
|
||||
template <class Unused>
|
||||
reporter<Unused>::reporter(std::ostream& os) : os_(os)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _>
|
||||
reporter<_>::~reporter()
|
||||
template <class Unused>
|
||||
reporter<Unused>::~reporter()
|
||||
{
|
||||
if (results_.top.size() > 0)
|
||||
{
|
||||
@@ -180,9 +179,9 @@ reporter<_>::~reporter()
|
||||
<< amount{results_.failed, "failure"} << std::endl;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
std::string
|
||||
reporter<_>::fmtdur(typename clock_type::duration const& d)
|
||||
reporter<Unused>::fmtdur(typename clock_type::duration const& d)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto const ms = duration_cast<milliseconds>(d);
|
||||
@@ -193,46 +192,46 @@ reporter<_>::fmtdur(typename clock_type::duration const& d)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_suite_begin(suite_info const& info)
|
||||
reporter<Unused>::on_suite_begin(suite_info const& info)
|
||||
{
|
||||
suite_results_ = suite_results{info.full_name()};
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_suite_end()
|
||||
reporter<Unused>::on_suite_end()
|
||||
{
|
||||
results_.add(suite_results_);
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_case_begin(std::string const& name)
|
||||
reporter<Unused>::on_case_begin(std::string const& name)
|
||||
{
|
||||
case_results_ = case_results(name);
|
||||
os_ << suite_results_.name << (case_results_.name.empty() ? "" : (" " + case_results_.name))
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_case_end()
|
||||
reporter<Unused>::on_case_end()
|
||||
{
|
||||
suite_results_.add(case_results_);
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_pass()
|
||||
reporter<Unused>::on_pass()
|
||||
{
|
||||
++case_results_.total;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_fail(std::string const& reason)
|
||||
reporter<Unused>::on_fail(std::string const& reason)
|
||||
{
|
||||
++case_results_.failed;
|
||||
++case_results_.total;
|
||||
@@ -240,9 +239,9 @@ reporter<_>::on_fail(std::string const& reason)
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_log(std::string const& s)
|
||||
reporter<Unused>::on_log(std::string const& s)
|
||||
{
|
||||
os_ << s;
|
||||
}
|
||||
@@ -251,5 +250,4 @@ reporter<_>::on_log(std::string const& s)
|
||||
|
||||
using reporter = detail::reporter<>;
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include <xrpl/beast/unit_test/detail/const_container.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
/** Holds a set of test condition outcomes in a testcase. */
|
||||
class case_results
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
test(bool pass_, std::string const& reason_) : pass(pass_), reason(reason_)
|
||||
test(bool pass_, std::string reason_) : pass(pass_), reason(std::move(reason_))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,19 +38,17 @@ private:
|
||||
std::size_t failed_{0};
|
||||
|
||||
public:
|
||||
tests_t()
|
||||
{
|
||||
}
|
||||
tests_t() = default;
|
||||
|
||||
/** Returns the total number of test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
total() const
|
||||
{
|
||||
return cont().size();
|
||||
}
|
||||
|
||||
/** Returns the number of failed test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
failed() const
|
||||
{
|
||||
return failed_;
|
||||
@@ -86,12 +84,12 @@ private:
|
||||
std::string name_;
|
||||
|
||||
public:
|
||||
explicit case_results(std::string const& name = "") : name_(name)
|
||||
explicit case_results(std::string name = "") : name_(std::move(name))
|
||||
{
|
||||
}
|
||||
|
||||
/** Returns the name of this testcase. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
@@ -115,26 +113,26 @@ private:
|
||||
std::size_t failed_ = 0;
|
||||
|
||||
public:
|
||||
explicit suite_results(std::string const& name = "") : name_(name)
|
||||
explicit suite_results(std::string name = "") : name_(std::move(name))
|
||||
{
|
||||
}
|
||||
|
||||
/** Returns the name of this suite. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
/** Returns the total number of test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
total() const
|
||||
{
|
||||
return total_;
|
||||
}
|
||||
|
||||
/** Returns the number of failures. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
failed() const
|
||||
{
|
||||
return failed_;
|
||||
@@ -145,9 +143,9 @@ public:
|
||||
void
|
||||
insert(case_results&& r)
|
||||
{
|
||||
cont().emplace_back(std::move(r));
|
||||
total_ += r.tests.total();
|
||||
failed_ += r.tests.failed();
|
||||
cont().emplace_back(std::move(r));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -172,26 +170,24 @@ private:
|
||||
std::size_t failed_{0};
|
||||
|
||||
public:
|
||||
results()
|
||||
{
|
||||
}
|
||||
results() = default;
|
||||
|
||||
/** Returns the total number of test cases. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
cases() const
|
||||
{
|
||||
return m_cases;
|
||||
}
|
||||
|
||||
/** Returns the total number of test conditions. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
total() const
|
||||
{
|
||||
return total_;
|
||||
}
|
||||
|
||||
/** Returns the number of failures. */
|
||||
std::size_t
|
||||
[[nodiscard]] std::size_t
|
||||
failed() const
|
||||
{
|
||||
return failed_;
|
||||
@@ -219,5 +215,4 @@ public:
|
||||
/** @} */
|
||||
};
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
/** Unit test runner interface.
|
||||
|
||||
@@ -48,7 +47,7 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the argument string. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
arg() const
|
||||
{
|
||||
return arg_;
|
||||
@@ -198,8 +197,10 @@ runner::run_if(FwdIter first, FwdIter last, Pred pred)
|
||||
{
|
||||
bool failed(false);
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
if (pred(*first))
|
||||
failed = run(*first) || failed;
|
||||
}
|
||||
return failed;
|
||||
}
|
||||
|
||||
@@ -219,8 +220,10 @@ runner::run_each_if(SequenceContainer const& c, Pred pred)
|
||||
{
|
||||
bool failed(false);
|
||||
for (auto const& s : c)
|
||||
{
|
||||
if (pred(s))
|
||||
failed = run(s) || failed;
|
||||
}
|
||||
return failed;
|
||||
}
|
||||
|
||||
@@ -273,5 +276,4 @@ runner::log(std::string const& s)
|
||||
on_log(s);
|
||||
}
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -36,7 +35,7 @@ make_reason(String const& reason, char const* file, int line)
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class thread;
|
||||
class Thread;
|
||||
|
||||
enum abort_t { no_abort_on_fail, abort_on_fail };
|
||||
|
||||
@@ -58,7 +57,7 @@ private:
|
||||
// in the event of a failure, if the option to stop is set.
|
||||
struct abort_exception : public std::exception
|
||||
{
|
||||
char const*
|
||||
[[nodiscard]] char const*
|
||||
what() const noexcept override
|
||||
{
|
||||
return "test suite aborted";
|
||||
@@ -75,7 +74,7 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
~log_buf()
|
||||
~log_buf() override
|
||||
{
|
||||
sync();
|
||||
}
|
||||
@@ -295,7 +294,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
friend class thread;
|
||||
friend class Thread;
|
||||
|
||||
static suite**
|
||||
p_this_suite()
|
||||
@@ -309,7 +308,7 @@ private:
|
||||
run() = 0;
|
||||
|
||||
void
|
||||
propagate_abort();
|
||||
propagate_abort() const;
|
||||
|
||||
template <class = void>
|
||||
void
|
||||
@@ -486,9 +485,13 @@ suite::unexpected(Condition shouldBeFalse, String const& reason)
|
||||
{
|
||||
bool const b = static_cast<bool>(shouldBeFalse);
|
||||
if (!b)
|
||||
{
|
||||
pass();
|
||||
}
|
||||
else
|
||||
{
|
||||
fail(reason);
|
||||
}
|
||||
return !b;
|
||||
}
|
||||
|
||||
@@ -522,7 +525,7 @@ suite::fail(String const& reason, char const* file, int line)
|
||||
}
|
||||
|
||||
inline void
|
||||
suite::propagate_abort()
|
||||
suite::propagate_abort() const
|
||||
{
|
||||
if (abort_ && aborted_)
|
||||
BOOST_THROW_EXCEPTION(abort_exception());
|
||||
@@ -538,7 +541,7 @@ suite::run(runner& r)
|
||||
{
|
||||
run();
|
||||
}
|
||||
catch (abort_exception const&)
|
||||
catch (abort_exception const&) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
// ends the suite
|
||||
}
|
||||
@@ -569,8 +572,7 @@ suite::run(runner& r)
|
||||
((cond) ? (pass(), true) : (fail((reason), __FILE__, __LINE__), false))
|
||||
#endif
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
class runner;
|
||||
|
||||
@@ -43,33 +42,33 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
module() const
|
||||
{
|
||||
return module_;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
library() const
|
||||
{
|
||||
return library_;
|
||||
}
|
||||
|
||||
/// Returns `true` if this suite only runs manually.
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
manual() const
|
||||
{
|
||||
return manual_;
|
||||
}
|
||||
|
||||
/// Return the canonical suite name as a string.
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
full_name() const
|
||||
{
|
||||
return library_ + "." + module_ + "." + name_;
|
||||
@@ -110,5 +109,4 @@ make_suite_info(
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
#include <typeindex>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
/// A container of test suites.
|
||||
class suite_list : public detail::const_container<std::set<suite_info>>
|
||||
@@ -62,5 +61,4 @@ suite_list::insert(
|
||||
cont().emplace(make_suite_info<Suite>(name, module, library, manual, priority));
|
||||
}
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
namespace unit_test {
|
||||
namespace beast::unit_test {
|
||||
|
||||
/** Replacement for std::thread that handles exceptions in unit tests. */
|
||||
class thread
|
||||
class Thread
|
||||
{
|
||||
private:
|
||||
suite* s_ = nullptr;
|
||||
@@ -24,17 +23,17 @@ public:
|
||||
using id = std::thread::id;
|
||||
using native_handle_type = std::thread::native_handle_type;
|
||||
|
||||
thread() = default;
|
||||
thread(thread const&) = delete;
|
||||
thread&
|
||||
operator=(thread const&) = delete;
|
||||
Thread() = default;
|
||||
Thread(Thread const&) = delete;
|
||||
Thread&
|
||||
operator=(Thread const&) = delete;
|
||||
|
||||
thread(thread&& other) : s_(other.s_), t_(std::move(other.t_))
|
||||
Thread(Thread&& other) : s_(other.s_), t_(std::move(other.t_))
|
||||
{
|
||||
}
|
||||
|
||||
thread&
|
||||
operator=(thread&& other)
|
||||
Thread&
|
||||
operator=(Thread&& other)
|
||||
{
|
||||
s_ = other.s_;
|
||||
t_ = std::move(other.t_);
|
||||
@@ -42,19 +41,19 @@ public:
|
||||
}
|
||||
|
||||
template <class F, class... Args>
|
||||
explicit thread(suite& s, F&& f, Args&&... args) : s_(&s)
|
||||
explicit Thread(suite& s, F&& f, Args&&... args) : s_(&s)
|
||||
{
|
||||
std::function<void(void)> b = std::bind(std::forward<F>(f), std::forward<Args>(args)...);
|
||||
t_ = std::thread(&thread::run, this, std::move(b));
|
||||
t_ = std::thread(&Thread::run, this, std::move(b));
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
joinable() const
|
||||
{
|
||||
return t_.joinable();
|
||||
}
|
||||
|
||||
std::thread::id
|
||||
[[nodiscard]] std::thread::id
|
||||
get_id() const
|
||||
{
|
||||
return t_.get_id();
|
||||
@@ -80,7 +79,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
swap(thread& other)
|
||||
swap(Thread& other)
|
||||
{
|
||||
std::swap(s_, other.s_);
|
||||
std::swap(t_, other.t_);
|
||||
@@ -94,7 +93,7 @@ private:
|
||||
{
|
||||
f();
|
||||
}
|
||||
catch (suite::abort_exception const&)
|
||||
catch (suite::abort_exception const&) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
@@ -108,5 +107,4 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace beast
|
||||
} // namespace beast::unit_test
|
||||
|
||||
@@ -13,13 +13,13 @@ enum Severity {
|
||||
kAll = 0,
|
||||
|
||||
kTrace = kAll,
|
||||
kDebug,
|
||||
kInfo,
|
||||
kWarning,
|
||||
kError,
|
||||
kFatal,
|
||||
kDebug = 1,
|
||||
kInfo = 2,
|
||||
kWarning = 3,
|
||||
kError = 4,
|
||||
kFatal = 5,
|
||||
|
||||
kDisabled,
|
||||
kDisabled = 6,
|
||||
kNone = kDisabled
|
||||
};
|
||||
} // namespace severities
|
||||
@@ -55,22 +55,23 @@ public:
|
||||
class Sink
|
||||
{
|
||||
protected:
|
||||
Sink() = delete;
|
||||
explicit Sink(Sink const& sink) = default;
|
||||
Sink(Severity thresh, bool console);
|
||||
Sink&
|
||||
operator=(Sink const& lhs) = delete;
|
||||
|
||||
public:
|
||||
virtual ~Sink() = 0;
|
||||
|
||||
Sink() = delete;
|
||||
Sink&
|
||||
operator=(Sink const& lhs) = delete;
|
||||
|
||||
/** Returns `true` if text at the passed severity produces output. */
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
active(Severity level) const;
|
||||
|
||||
/** Returns `true` if a message is also written to the Output Window
|
||||
* (MSVC). */
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
console() const;
|
||||
|
||||
/** Set whether messages are also written to the Output Window (MSVC).
|
||||
@@ -79,7 +80,7 @@ public:
|
||||
console(bool output);
|
||||
|
||||
/** Returns the minimum severity level this sink will report. */
|
||||
virtual Severity
|
||||
[[nodiscard]] virtual Severity
|
||||
threshold() const;
|
||||
|
||||
/** Set the minimum severity this sink will report. */
|
||||
@@ -109,12 +110,12 @@ public:
|
||||
};
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
static_assert(std::is_default_constructible<Sink>::value == false, "");
|
||||
static_assert(std::is_copy_constructible<Sink>::value == false, "");
|
||||
static_assert(std::is_move_constructible<Sink>::value == false, "");
|
||||
static_assert(std::is_copy_assignable<Sink>::value == false, "");
|
||||
static_assert(std::is_move_assignable<Sink>::value == false, "");
|
||||
static_assert(std::is_nothrow_destructible<Sink>::value == true, "");
|
||||
static_assert(!std::is_default_constructible_v<Sink>, "");
|
||||
static_assert(!std::is_copy_constructible_v<Sink>, "");
|
||||
static_assert(!std::is_move_constructible_v<Sink>, "");
|
||||
static_assert(!std::is_copy_assignable_v<Sink>, "");
|
||||
static_assert(!std::is_move_assignable_v<Sink>, "");
|
||||
static_assert(std::is_nothrow_destructible_v<Sink>, "");
|
||||
#endif
|
||||
|
||||
/** Returns a Sink which does nothing. */
|
||||
@@ -165,12 +166,12 @@ public:
|
||||
};
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
static_assert(std::is_default_constructible<ScopedStream>::value == false, "");
|
||||
static_assert(std::is_copy_constructible<ScopedStream>::value == true, "");
|
||||
static_assert(std::is_move_constructible<ScopedStream>::value == true, "");
|
||||
static_assert(std::is_copy_assignable<ScopedStream>::value == false, "");
|
||||
static_assert(std::is_move_assignable<ScopedStream>::value == false, "");
|
||||
static_assert(std::is_nothrow_destructible<ScopedStream>::value == true, "");
|
||||
static_assert(!std::is_default_constructible_v<ScopedStream>, "");
|
||||
static_assert(std::is_copy_constructible_v<ScopedStream>, "");
|
||||
static_assert(std::is_move_constructible_v<ScopedStream>, "");
|
||||
static_assert(!std::is_copy_assignable_v<ScopedStream>, "");
|
||||
static_assert(!std::is_move_assignable_v<ScopedStream>, "");
|
||||
static_assert(std::is_nothrow_destructible_v<ScopedStream>, "");
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -203,14 +204,14 @@ public:
|
||||
operator=(Stream const& other) = delete;
|
||||
|
||||
/** Returns the Sink that this Stream writes to. */
|
||||
Sink&
|
||||
[[nodiscard]] Sink&
|
||||
sink() const
|
||||
{
|
||||
return m_sink;
|
||||
}
|
||||
|
||||
/** Returns the Severity level of messages this Stream reports. */
|
||||
Severity
|
||||
[[nodiscard]] Severity
|
||||
level() const
|
||||
{
|
||||
return m_level;
|
||||
@@ -218,7 +219,7 @@ public:
|
||||
|
||||
/** Returns `true` if sink logs anything at this stream's level. */
|
||||
/** @{ */
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
active() const
|
||||
{
|
||||
return m_sink.active(m_level);
|
||||
@@ -247,12 +248,12 @@ public:
|
||||
};
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
static_assert(std::is_default_constructible<Stream>::value == true, "");
|
||||
static_assert(std::is_copy_constructible<Stream>::value == true, "");
|
||||
static_assert(std::is_move_constructible<Stream>::value == true, "");
|
||||
static_assert(std::is_copy_assignable<Stream>::value == false, "");
|
||||
static_assert(std::is_move_assignable<Stream>::value == false, "");
|
||||
static_assert(std::is_nothrow_destructible<Stream>::value == true, "");
|
||||
static_assert(std::is_default_constructible_v<Stream>, "");
|
||||
static_assert(std::is_copy_constructible_v<Stream>, "");
|
||||
static_assert(std::is_move_constructible_v<Stream>, "");
|
||||
static_assert(!std::is_copy_assignable_v<Stream>, "");
|
||||
static_assert(!std::is_move_assignable_v<Stream>, "");
|
||||
static_assert(std::is_nothrow_destructible_v<Stream>, "");
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -266,14 +267,14 @@ public:
|
||||
}
|
||||
|
||||
/** Returns the Sink associated with this Journal. */
|
||||
Sink&
|
||||
[[nodiscard]] Sink&
|
||||
sink() const
|
||||
{
|
||||
return *m_sink;
|
||||
}
|
||||
|
||||
/** Returns a stream for this sink, with the specified severity level. */
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
stream(Severity level) const
|
||||
{
|
||||
return Stream(*m_sink, level);
|
||||
@@ -283,7 +284,7 @@ public:
|
||||
For a message to be logged, the severity must be at or above the
|
||||
sink's severity threshold.
|
||||
*/
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
active(Severity level) const
|
||||
{
|
||||
return m_sink->active(level);
|
||||
@@ -291,37 +292,37 @@ public:
|
||||
|
||||
/** Severity stream access functions. */
|
||||
/** @{ */
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
trace() const
|
||||
{
|
||||
return {*m_sink, severities::kTrace};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
debug() const
|
||||
{
|
||||
return {*m_sink, severities::kDebug};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
info() const
|
||||
{
|
||||
return {*m_sink, severities::kInfo};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
warn() const
|
||||
{
|
||||
return {*m_sink, severities::kWarning};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
error() const
|
||||
{
|
||||
return {*m_sink, severities::kError};
|
||||
}
|
||||
|
||||
Stream
|
||||
[[nodiscard]] Stream
|
||||
fatal() const
|
||||
{
|
||||
return {*m_sink, severities::kFatal};
|
||||
@@ -330,12 +331,12 @@ public:
|
||||
};
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
static_assert(std::is_default_constructible<Journal>::value == false, "");
|
||||
static_assert(std::is_copy_constructible<Journal>::value == true, "");
|
||||
static_assert(std::is_move_constructible<Journal>::value == true, "");
|
||||
static_assert(std::is_copy_assignable<Journal>::value == true, "");
|
||||
static_assert(std::is_move_assignable<Journal>::value == true, "");
|
||||
static_assert(std::is_nothrow_destructible<Journal>::value == true, "");
|
||||
static_assert(!std::is_default_constructible_v<Journal>, "");
|
||||
static_assert(std::is_copy_constructible_v<Journal>, "");
|
||||
static_assert(std::is_move_constructible_v<Journal>, "");
|
||||
static_assert(std::is_copy_assignable_v<Journal>, "");
|
||||
static_assert(std::is_move_assignable_v<Journal>, "");
|
||||
static_assert(std::is_nothrow_destructible_v<Journal>, "");
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -371,10 +372,6 @@ class logstream_buf : public std::basic_stringbuf<CharT, Traits>
|
||||
{
|
||||
beast::Journal::Stream strm_;
|
||||
|
||||
template <class T>
|
||||
void
|
||||
write(T const*) = delete;
|
||||
|
||||
void
|
||||
write(char const* s)
|
||||
{
|
||||
@@ -394,7 +391,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~logstream_buf()
|
||||
~logstream_buf() override
|
||||
{
|
||||
sync();
|
||||
}
|
||||
@@ -406,6 +403,10 @@ public:
|
||||
this->str("");
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
write(T const*) = delete;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@@ -413,11 +414,11 @@ public:
|
||||
template <class CharT, class Traits = std::char_traits<CharT>>
|
||||
class basic_logstream : public std::basic_ostream<CharT, Traits>
|
||||
{
|
||||
typedef CharT char_type;
|
||||
typedef Traits traits_type;
|
||||
typedef typename traits_type::int_type int_type;
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
using char_type = CharT;
|
||||
using traits_type = Traits;
|
||||
using int_type = typename traits_type::int_type;
|
||||
using pos_type = typename traits_type::pos_type;
|
||||
using off_type = typename traits_type::off_type;
|
||||
|
||||
detail::logstream_buf<CharT, Traits> buf_;
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ class PropertyStream::Item : public List<Item>::Node
|
||||
{
|
||||
public:
|
||||
explicit Item(Source* source);
|
||||
Source&
|
||||
[[nodiscard]] Source&
|
||||
source() const;
|
||||
Source*
|
||||
operator->() const;
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
std::ostringstream mutable m_ostream;
|
||||
|
||||
public:
|
||||
Proxy(Map const& map, std::string const& key);
|
||||
Proxy(Map const& map, std::string key);
|
||||
Proxy(Proxy const& other);
|
||||
~Proxy();
|
||||
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
|
||||
PropertyStream&
|
||||
stream();
|
||||
PropertyStream const&
|
||||
[[nodiscard]] PropertyStream const&
|
||||
stream() const;
|
||||
|
||||
template <typename Value>
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
|
||||
PropertyStream&
|
||||
stream();
|
||||
PropertyStream const&
|
||||
[[nodiscard]] PropertyStream const&
|
||||
stream() const;
|
||||
|
||||
template <typename Value>
|
||||
@@ -315,7 +315,7 @@ private:
|
||||
List<Item> children_;
|
||||
|
||||
public:
|
||||
explicit Source(std::string const& name);
|
||||
explicit Source(std::string name);
|
||||
virtual ~Source();
|
||||
|
||||
Source(Source const&) = delete;
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
operator=(Source const&) = delete;
|
||||
|
||||
/** Returns the name of this source. */
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const;
|
||||
|
||||
/** Add a child source. */
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** Wraps a Journal::Sink to prefix its output with a string. */
|
||||
@@ -17,8 +19,8 @@ private:
|
||||
std::string prefix_;
|
||||
|
||||
public:
|
||||
explicit WrappedSink(beast::Journal::Sink& sink, std::string const& prefix = "")
|
||||
: Sink(sink), sink_(sink), prefix_(prefix)
|
||||
explicit WrappedSink(beast::Journal::Sink& sink, std::string prefix = "")
|
||||
: Sink(sink), sink_(sink), prefix_(std::move(prefix))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,13 +35,13 @@ public:
|
||||
prefix_ = s;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
active(beast::severities::Severity level) const override
|
||||
{
|
||||
return sink_.active(level);
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
console() const override
|
||||
{
|
||||
return sink_.console();
|
||||
@@ -51,7 +53,7 @@ public:
|
||||
sink_.console(output);
|
||||
}
|
||||
|
||||
beast::severities::Severity
|
||||
[[nodiscard]] beast::severities::Severity
|
||||
threshold() const override
|
||||
{
|
||||
return sink_.threshold();
|
||||
|
||||
@@ -27,7 +27,7 @@ struct Zero
|
||||
};
|
||||
|
||||
namespace {
|
||||
static constexpr Zero zero{};
|
||||
constexpr Zero zero{};
|
||||
} // namespace
|
||||
|
||||
/** Default implementation of signum calls the method on the class. */
|
||||
@@ -38,8 +38,7 @@ signum(T const& t)
|
||||
return t.signum();
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
namespace zero_helper {
|
||||
namespace detail::zero_helper {
|
||||
|
||||
// For argument dependent lookup to function properly, calls to signum must
|
||||
// be made from a namespace that does not include overloads of the function..
|
||||
@@ -50,8 +49,7 @@ call_signum(T const& t)
|
||||
return signum(t);
|
||||
}
|
||||
|
||||
} // namespace zero_helper
|
||||
} // namespace detail
|
||||
} // namespace detail::zero_helper
|
||||
|
||||
// Handle operators where T is on the left side using signum.
|
||||
|
||||
|
||||
@@ -9,10 +9,8 @@ template <bool IsConst, class T>
|
||||
struct maybe_const
|
||||
{
|
||||
explicit maybe_const() = default;
|
||||
using type = typename std::conditional<
|
||||
IsConst,
|
||||
typename std::remove_const<T>::type const,
|
||||
typename std::remove_const<T>::type>::type;
|
||||
using type = std::
|
||||
conditional_t<IsConst, typename std::remove_const<T>::type const, std::remove_const_t<T>>;
|
||||
};
|
||||
|
||||
/** Alias for omitting `typename`. */
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
/// Get the native path for the temporary directory
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
path() const
|
||||
{
|
||||
return path_.string();
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
The file does not need to exist.
|
||||
*/
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
file(std::string const& name) const
|
||||
{
|
||||
return (path_ / name).string();
|
||||
|
||||
@@ -43,15 +43,15 @@ private:
|
||||
murmurhash3(result_type x);
|
||||
};
|
||||
|
||||
template <class _>
|
||||
xor_shift_engine<_>::xor_shift_engine(result_type val)
|
||||
template <class Unused>
|
||||
xor_shift_engine<Unused>::xor_shift_engine(result_type val)
|
||||
{
|
||||
seed(val);
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
xor_shift_engine<_>::seed(result_type seed)
|
||||
xor_shift_engine<Unused>::seed(result_type seed)
|
||||
{
|
||||
if (seed == 0)
|
||||
throw std::domain_error("invalid seed");
|
||||
@@ -59,9 +59,9 @@ xor_shift_engine<_>::seed(result_type seed)
|
||||
s_[1] = murmurhash3(s_[0]);
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
auto
|
||||
xor_shift_engine<_>::operator()() -> result_type
|
||||
xor_shift_engine<Unused>::operator()() -> result_type
|
||||
{
|
||||
result_type s1 = s_[0];
|
||||
result_type const s0 = s_[1];
|
||||
@@ -70,9 +70,9 @@ xor_shift_engine<_>::operator()() -> result_type
|
||||
return (s_[1] = (s1 ^ s0 ^ (s1 >> 17) ^ (s0 >> 26))) + s0;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
auto
|
||||
xor_shift_engine<_>::murmurhash3(result_type x) -> result_type
|
||||
xor_shift_engine<Unused>::murmurhash3(result_type x) -> result_type
|
||||
{
|
||||
x ^= x >> 33;
|
||||
x *= 0xff51afd7ed558ccdULL;
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
|
||||
namespace xrpl {
|
||||
namespace cryptoconditions {
|
||||
namespace xrpl::cryptoconditions {
|
||||
|
||||
enum class Type : std::uint8_t {
|
||||
preimageSha256 = 0,
|
||||
@@ -88,6 +87,4 @@ operator!=(Condition const& lhs, Condition const& rhs)
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace cryptoconditions
|
||||
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::cryptoconditions
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include <xrpl/basics/Slice.h>
|
||||
#include <xrpl/conditions/Condition.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace cryptoconditions {
|
||||
namespace xrpl::cryptoconditions {
|
||||
|
||||
struct Fulfillment
|
||||
{
|
||||
@@ -42,15 +41,15 @@ public:
|
||||
with respect to other conditions of the
|
||||
same type.
|
||||
*/
|
||||
virtual Buffer
|
||||
[[nodiscard]] virtual Buffer
|
||||
fingerprint() const = 0;
|
||||
|
||||
/** Returns the type of this condition. */
|
||||
virtual Type
|
||||
[[nodiscard]] virtual Type
|
||||
type() const = 0;
|
||||
|
||||
/** Validates a fulfillment. */
|
||||
virtual bool
|
||||
[[nodiscard]] virtual bool
|
||||
validate(Slice data) const = 0;
|
||||
|
||||
/** Calculates the cost associated with this fulfillment. *
|
||||
@@ -59,7 +58,7 @@ public:
|
||||
type and properties of the condition and the fulfillment
|
||||
that the condition is generated from.
|
||||
*/
|
||||
virtual std::uint32_t
|
||||
[[nodiscard]] virtual std::uint32_t
|
||||
cost() const = 0;
|
||||
|
||||
/** Returns the condition associated with the given fulfillment.
|
||||
@@ -68,7 +67,7 @@ public:
|
||||
will, if compliant, produce the identical condition for the
|
||||
same fulfillment.
|
||||
*/
|
||||
virtual Condition
|
||||
[[nodiscard]] virtual Condition
|
||||
condition() const = 0;
|
||||
};
|
||||
|
||||
@@ -119,5 +118,4 @@ validate(Fulfillment const& f, Condition const& c, Slice m);
|
||||
bool
|
||||
validate(Fulfillment const& f, Condition const& c);
|
||||
|
||||
} // namespace cryptoconditions
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::cryptoconditions
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl {
|
||||
namespace cryptoconditions {
|
||||
namespace xrpl::cryptoconditions {
|
||||
|
||||
class PreimageSha256 final : public Fulfillment
|
||||
{
|
||||
@@ -91,13 +90,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Type
|
||||
[[nodiscard]] Type
|
||||
type() const override
|
||||
{
|
||||
return Type::preimageSha256;
|
||||
}
|
||||
|
||||
Buffer
|
||||
[[nodiscard]] Buffer
|
||||
fingerprint() const override
|
||||
{
|
||||
sha256_hasher h;
|
||||
@@ -106,19 +105,19 @@ public:
|
||||
return {d.data(), d.size()};
|
||||
}
|
||||
|
||||
std::uint32_t
|
||||
[[nodiscard]] std::uint32_t
|
||||
cost() const override
|
||||
{
|
||||
return static_cast<std::uint32_t>(payload_.size());
|
||||
}
|
||||
|
||||
Condition
|
||||
[[nodiscard]] Condition
|
||||
condition() const override
|
||||
{
|
||||
return {type(), cost(), fingerprint()};
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
validate(Slice) const override
|
||||
{
|
||||
// Perhaps counterintuitively, the message isn't
|
||||
@@ -127,5 +126,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cryptoconditions
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::cryptoconditions
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include <system_error>
|
||||
|
||||
namespace xrpl {
|
||||
namespace cryptoconditions {
|
||||
namespace xrpl::cryptoconditions {
|
||||
|
||||
enum class error {
|
||||
generic = 1,
|
||||
@@ -28,8 +27,7 @@ enum class error {
|
||||
std::error_code
|
||||
make_error_code(error ev);
|
||||
|
||||
} // namespace cryptoconditions
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::cryptoconditions
|
||||
|
||||
namespace std {
|
||||
|
||||
|
||||
@@ -8,15 +8,12 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace xrpl {
|
||||
namespace cryptoconditions {
|
||||
|
||||
// A collection of functions to decode binary blobs
|
||||
// encoded with X.690 Distinguished Encoding Rules.
|
||||
//
|
||||
// This is a very trivial decoder and only implements
|
||||
// the bare minimum needed to support PreimageSha256.
|
||||
namespace der {
|
||||
namespace xrpl::cryptoconditions::der {
|
||||
|
||||
// The preamble encapsulates the DER identifier and
|
||||
// length octets:
|
||||
@@ -89,7 +86,7 @@ parsePreamble(Slice& s, std::error_code& ec)
|
||||
p.length = s[0];
|
||||
s += 1;
|
||||
|
||||
if (p.length & 0x80)
|
||||
if ((p.length & 0x80) != 0u)
|
||||
{ // Long form length:
|
||||
std::size_t const cnt = p.length & 0x7F;
|
||||
|
||||
@@ -204,6 +201,4 @@ parseInteger(Slice& s, std::size_t count, std::error_code& ec)
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace der
|
||||
} // namespace cryptoconditions
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::cryptoconditions::der
|
||||
|
||||
@@ -34,9 +34,9 @@ template <typename Ret_t, typename... Args_t>
|
||||
class ClosureCounter
|
||||
{
|
||||
private:
|
||||
std::mutex mutable mutex_{};
|
||||
std::condition_variable allClosuresDoneCond_{}; // guard with mutex_
|
||||
bool waitForClosures_{false}; // guard with mutex_
|
||||
std::mutex mutable mutex_;
|
||||
std::condition_variable allClosuresDoneCond_; // guard with mutex_
|
||||
bool waitForClosures_{false}; // guard with mutex_
|
||||
std::atomic<int> closureCount_{0};
|
||||
|
||||
// Increment the count.
|
||||
@@ -72,10 +72,10 @@ private:
|
||||
{
|
||||
private:
|
||||
ClosureCounter& counter_;
|
||||
std::remove_reference_t<Closure> closure_;
|
||||
std::remove_reference_t<Closure> closure_{};
|
||||
|
||||
static_assert(
|
||||
std::is_same<decltype(closure_(std::declval<Args_t>()...)), Ret_t>::value,
|
||||
std::is_same_v<decltype(closure_(std::declval<Args_t>()...)), Ret_t>,
|
||||
"Closure arguments don't match ClosureCounter Ret_t or Args_t");
|
||||
|
||||
public:
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
++counter_;
|
||||
}
|
||||
|
||||
Substitute(Substitute&& rhs) noexcept(std::is_nothrow_move_constructible<Closure>::value)
|
||||
Substitute(Substitute&& rhs) noexcept(std::is_nothrow_move_constructible_v<Closure>)
|
||||
: counter_(rhs.counter_), closure_(std::move(rhs.closure_))
|
||||
{
|
||||
++counter_;
|
||||
|
||||
@@ -109,9 +109,7 @@ private:
|
||||
class Entry : public CountedObject<Entry>
|
||||
{
|
||||
public:
|
||||
Entry()
|
||||
{
|
||||
}
|
||||
Entry() = default;
|
||||
|
||||
void
|
||||
addPeer(PeerShortID peer)
|
||||
@@ -120,7 +118,7 @@ private:
|
||||
peers_.insert(peer);
|
||||
}
|
||||
|
||||
HashRouterFlags
|
||||
[[nodiscard]] HashRouterFlags
|
||||
getFlags(void) const
|
||||
{
|
||||
return flags_;
|
||||
@@ -140,7 +138,7 @@ private:
|
||||
}
|
||||
|
||||
/** Return seated relay time point if the message has been relayed */
|
||||
std::optional<Stopwatch::time_point>
|
||||
[[nodiscard]] std::optional<Stopwatch::time_point>
|
||||
relayed() const
|
||||
{
|
||||
return relayed_;
|
||||
|
||||
@@ -98,11 +98,11 @@ public:
|
||||
LoadMonitor& lm,
|
||||
std::function<void()> const& job);
|
||||
|
||||
JobType
|
||||
[[nodiscard]] JobType
|
||||
getType() const;
|
||||
|
||||
/** Returns the time when the job was queued. */
|
||||
clock_type::time_point const&
|
||||
[[nodiscard]] clock_type::time_point const&
|
||||
queue_time() const;
|
||||
|
||||
void
|
||||
|
||||
@@ -7,8 +7,13 @@
|
||||
#include <xrpl/core/detail/Workers.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
|
||||
// Include only the specific Boost.Coroutine2 headers actually used here.
|
||||
// Avoid `boost/coroutine2/all.hpp` because it transitively pulls in
|
||||
// `boost/context/pooled_fixedsize_stack.hpp`, whose `.malloc()` / `.free()`
|
||||
// member calls on `boost::pool` collide with MSVC's `_CRTDBG_MAP_ALLOC` macros
|
||||
// in Debug builds (see cmake/XrplCompiler.cmake).
|
||||
#include <boost/context/protected_fixedsize_stack.hpp>
|
||||
#include <boost/coroutine2/all.hpp>
|
||||
#include <boost/coroutine2/coroutine.hpp>
|
||||
|
||||
#include <set>
|
||||
|
||||
@@ -128,7 +133,7 @@ public:
|
||||
beast::Journal journal,
|
||||
Logs& logs,
|
||||
perf::PerfLog& perfLog);
|
||||
~JobQueue();
|
||||
~JobQueue() override;
|
||||
|
||||
/** Adds a job to the JobQueue.
|
||||
|
||||
@@ -141,8 +146,7 @@ public:
|
||||
*/
|
||||
template <
|
||||
typename JobHandler,
|
||||
typename =
|
||||
std::enable_if_t<std::is_same<decltype(std::declval<JobHandler&&>()()), void>::value>>
|
||||
typename = std::enable_if_t<std::is_same_v<decltype(std::declval<JobHandler&&>()()), void>>>
|
||||
bool
|
||||
addJob(JobType type, std::string const& name, JobHandler&& jobHandler)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <xrpl/beast/insight/Collector.h>
|
||||
#include <xrpl/core/JobTypeInfo.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace xrpl {
|
||||
|
||||
struct JobTypeData
|
||||
@@ -33,9 +35,9 @@ public:
|
||||
|
||||
JobTypeData(
|
||||
JobTypeInfo const& info_,
|
||||
beast::insight::Collector::ptr const& collector,
|
||||
beast::insight::Collector::ptr collector,
|
||||
Logs& logs) noexcept
|
||||
: m_load(logs.journal("LoadMonitor")), m_collector(collector), info(info_)
|
||||
: m_load(logs.journal("LoadMonitor")), m_collector(std::move(collector)), info(info_)
|
||||
|
||||
{
|
||||
m_load.setTargetLatency(info.getAverageLatency(), info.getPeakLatency());
|
||||
@@ -52,13 +54,13 @@ public:
|
||||
JobTypeData&
|
||||
operator=(JobTypeData const& other) = delete;
|
||||
|
||||
std::string
|
||||
[[nodiscard]] std::string
|
||||
name() const
|
||||
{
|
||||
return info.name();
|
||||
}
|
||||
|
||||
JobType
|
||||
[[nodiscard]] JobType
|
||||
type() const
|
||||
{
|
||||
return info.type();
|
||||
|
||||
@@ -40,37 +40,37 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
JobType
|
||||
[[nodiscard]] JobType
|
||||
type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
int
|
||||
[[nodiscard]] int
|
||||
limit() const
|
||||
{
|
||||
return m_limit;
|
||||
}
|
||||
|
||||
bool
|
||||
[[nodiscard]] bool
|
||||
special() const
|
||||
{
|
||||
return m_limit == 0;
|
||||
}
|
||||
|
||||
std::chrono::milliseconds
|
||||
[[nodiscard]] std::chrono::milliseconds
|
||||
getAverageLatency() const
|
||||
{
|
||||
return m_avgLatency;
|
||||
}
|
||||
|
||||
std::chrono::milliseconds
|
||||
[[nodiscard]] std::chrono::milliseconds
|
||||
getPeakLatency() const
|
||||
{
|
||||
return m_peakLatency;
|
||||
|
||||
@@ -33,8 +33,7 @@ private:
|
||||
std::chrono::milliseconds avgLatency,
|
||||
std::chrono::milliseconds peakLatency) {
|
||||
XRPL_ASSERT(
|
||||
m_map.find(jt) == m_map.end(),
|
||||
"xrpl::JobTypes::JobTypes::add : unique job type input");
|
||||
!m_map.contains(jt), "xrpl::JobTypes::JobTypes::add : unique job type input");
|
||||
|
||||
[[maybe_unused]] auto const inserted =
|
||||
m_map
|
||||
@@ -114,7 +113,7 @@ public:
|
||||
return instance().get(jt).name();
|
||||
}
|
||||
|
||||
JobTypeInfo const&
|
||||
[[nodiscard]] JobTypeInfo const&
|
||||
get(JobType jt) const
|
||||
{
|
||||
Map::const_iterator const iter(m_map.find(jt));
|
||||
@@ -126,37 +125,37 @@ public:
|
||||
return m_unknown;
|
||||
}
|
||||
|
||||
JobTypeInfo const&
|
||||
[[nodiscard]] JobTypeInfo const&
|
||||
getInvalid() const
|
||||
{
|
||||
return m_unknown;
|
||||
}
|
||||
|
||||
Map::size_type
|
||||
[[nodiscard]] Map::size_type
|
||||
size() const
|
||||
{
|
||||
return m_map.size();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
begin() const
|
||||
{
|
||||
return m_map.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cbegin() const
|
||||
{
|
||||
return m_map.cbegin();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
end() const
|
||||
{
|
||||
return m_map.cend();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
[[nodiscard]] const_iterator
|
||||
cend() const
|
||||
{
|
||||
return m_map.cend();
|
||||
|
||||
@@ -16,20 +16,20 @@ class LoadEvent
|
||||
{
|
||||
public:
|
||||
// VFALCO TODO remove the dependency on LoadMonitor. Is that possible?
|
||||
LoadEvent(LoadMonitor& monitor, std::string const& name, bool shouldStart);
|
||||
LoadEvent(LoadMonitor& monitor, std::string name, bool shouldStart);
|
||||
LoadEvent(LoadEvent const&) = delete;
|
||||
|
||||
~LoadEvent();
|
||||
|
||||
std::string const&
|
||||
[[nodiscard]] std::string const&
|
||||
name() const;
|
||||
|
||||
// The time spent waiting.
|
||||
std::chrono::steady_clock::duration
|
||||
[[nodiscard]] std::chrono::steady_clock::duration
|
||||
waitTime() const;
|
||||
|
||||
// The time spent running.
|
||||
std::chrono::steady_clock::duration
|
||||
[[nodiscard]] std::chrono::steady_clock::duration
|
||||
runTime() const;
|
||||
|
||||
void
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
*
|
||||
* @return The network ID this server is configured for
|
||||
*/
|
||||
virtual std::uint32_t
|
||||
[[nodiscard]] virtual std::uint32_t
|
||||
getNetworkID() const noexcept = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ struct PeerReservation final
|
||||
{
|
||||
public:
|
||||
PublicKey nodeId;
|
||||
std::string description{};
|
||||
std::string description = {}; // NOLINT(readability-redundant-member-init)
|
||||
|
||||
auto
|
||||
[[nodiscard]] auto
|
||||
toJson() const -> Json::Value;
|
||||
|
||||
template <typename Hasher>
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
contains(PublicKey const& nodeId)
|
||||
{
|
||||
std::lock_guard const lock(this->mutex_);
|
||||
return table_.find({nodeId}) != table_.end();
|
||||
return table_.contains({.nodeId = nodeId, .description = {}});
|
||||
}
|
||||
|
||||
// Because `ApplicationImp` has two-phase initialization, so must we.
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
*
|
||||
* @return Counters Json object
|
||||
*/
|
||||
virtual Json::Value
|
||||
[[nodiscard]] virtual Json::Value
|
||||
countersJson() const = 0;
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
*
|
||||
* @return Current executing jobs and RPC calls and durations
|
||||
*/
|
||||
virtual Json::Value
|
||||
[[nodiscard]] virtual Json::Value
|
||||
currentJson() const = 0;
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user