mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Prevent accidental aggregates
* The compiler can provide many non-explicit constructors for aggregate types. This is sometimes desired, but it can happen accidentally, resulting in run-time errors. * This commit assures that no types are aggregates unless existing code is using aggregate initialization.
This commit is contained in:
committed by
Nikolaos D. Bougalis
parent
b7335fdff5
commit
db3b4dd396
@@ -29,6 +29,8 @@ namespace std {
|
||||
template <>
|
||||
struct hash <ripple::error_code_i>
|
||||
{
|
||||
explicit hash() = default;
|
||||
|
||||
std::size_t operator() (ripple::error_code_i value) const
|
||||
{
|
||||
return value;
|
||||
|
||||
@@ -46,6 +46,8 @@ using StaticScopedLockType = std::lock_guard <std::mutex>;
|
||||
// Give this translation unit only, permission to construct SFields
|
||||
struct SField::make
|
||||
{
|
||||
explicit make() = default;
|
||||
|
||||
template <class ...Args>
|
||||
static SField one(SField const* p, Args&& ...args)
|
||||
{
|
||||
|
||||
@@ -31,8 +31,15 @@
|
||||
namespace ripple {
|
||||
namespace detail {
|
||||
|
||||
struct defaultObject_t { };
|
||||
struct nonPresentObject_t { };
|
||||
struct defaultObject_t
|
||||
{
|
||||
explicit defaultObject_t() = default;
|
||||
};
|
||||
|
||||
struct nonPresentObject_t
|
||||
{
|
||||
explicit nonPresentObject_t() = default;
|
||||
};
|
||||
|
||||
extern defaultObject_t defaultObject;
|
||||
extern nonPresentObject_t nonPresentObject;
|
||||
|
||||
Reference in New Issue
Block a user