Util: Move staticConst<T> to separate header
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Riyyi
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef JSON_CONVERSION_H
|
||||||
|
#define JSON_CONVERSION_H
|
||||||
|
|
||||||
|
namespace Json {
|
||||||
|
|
||||||
|
namespace Detail {
|
||||||
|
|
||||||
|
// Avoid ODR (One Definition Rule) violations
|
||||||
|
template<typename T>
|
||||||
|
constexpr T staticConst {};
|
||||||
|
|
||||||
|
} // namespace Detail
|
||||||
|
|
||||||
|
} // namespace Json
|
||||||
|
|
||||||
|
#endif // JSON_CONVERSION_H
|
||||||
@@ -13,9 +13,11 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <utility> // forward
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "util/json/array.h"
|
#include "util/json/array.h"
|
||||||
|
#include "util/json/conversion.h"
|
||||||
#include "util/json/object.h"
|
#include "util/json/object.h"
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
@@ -86,10 +88,6 @@ struct fromJsonFunction {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Avoid ODR (One Definition Rule) violations
|
|
||||||
template<typename T>
|
|
||||||
constexpr T staticConst {};
|
|
||||||
|
|
||||||
} // namespace Detail
|
} // namespace Detail
|
||||||
|
|
||||||
// Anonymous namespace prevents multiple definition of the reference
|
// Anonymous namespace prevents multiple definition of the reference
|
||||||
|
|||||||
Reference in New Issue
Block a user