mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
fix: fix some of the compilation errors #1666
fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1666 Co-authored-by: Horror Proton <107091537+horror-proton@users.noreply.github.com>
This commit is contained in:
7
3rdparty/include/meojson/json.hpp
vendored
7
3rdparty/include/meojson/json.hpp
vendored
@@ -321,7 +321,7 @@ namespace json
|
||||
|
||||
bool empty() const noexcept { return _object_data.empty(); }
|
||||
size_t size() const noexcept { return _object_data.size(); }
|
||||
bool contains(const std::string& key) const { return _object_data.find(key) != _object_data.cend(); }
|
||||
bool contains(const std::string& key) const;
|
||||
bool exists(const std::string& key) const { return contains(key); }
|
||||
const value& at(const std::string& key) const;
|
||||
const std::string to_string() const;
|
||||
@@ -1484,6 +1484,11 @@ namespace json
|
||||
;
|
||||
}
|
||||
|
||||
MEOJSON_INLINE bool object::contains(const std::string& key) const
|
||||
{
|
||||
return _object_data.find(key) != _object_data.cend();
|
||||
}
|
||||
|
||||
MEOJSON_INLINE const value& object::at(const std::string& key) const
|
||||
{
|
||||
return _object_data.at(key);
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
|
||||
namespace asst::utils
|
||||
{
|
||||
// delete instantiation of template with message, when static_assert(false, Message) does not work
|
||||
#define ASST_STATIC_ASSERT_FALSE(Message, ...) \
|
||||
static_assert(::asst::utils::integral_constant_at_template_instantiation<bool, false, __VA_ARGS__>::value, Message)
|
||||
template <typename T, T Val, typename... Unused>
|
||||
struct integral_constant_at_template_instantiation : std::integral_constant<T, Val> {};
|
||||
|
||||
inline void _string_replace_all(std::string& str, const std::string_view& old_value, const std::string_view& new_value)
|
||||
{
|
||||
for (std::string::size_type pos(0); pos != std::string::npos; pos += new_value.length()) {
|
||||
@@ -157,6 +163,7 @@ namespace asst::utils
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename _ = void>
|
||||
inline std::string utf8_to_unicode_escape(const std::string& utf8_str)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@@ -188,7 +195,8 @@ namespace asst::utils
|
||||
|
||||
return unicode_escape_str;
|
||||
#else
|
||||
static_assert(false, "Don't use utf8_to_unicode_escape in non-win32.");
|
||||
ASST_STATIC_ASSERT_FALSE("Workaround for windows, not implemented in other OS yet.", _);
|
||||
return utf8_str;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -368,11 +376,5 @@ namespace asst::utils
|
||||
// }
|
||||
// return str;
|
||||
//}
|
||||
|
||||
template <typename T, T Val, typename... Unused>
|
||||
struct integral_constant_at_template_instantiation : std::integral_constant<T, Val> {};
|
||||
}
|
||||
|
||||
// delete instantiation of template with message, when static_assert(false, Message) does not work
|
||||
#define ASST_STATIC_ASSERT_FALSE(Message, ...) \
|
||||
static_assert(::asst::utils::integral_constant_at_template_instantiation<bool, false, __VA_ARGS__>::value, Message)
|
||||
|
||||
Reference in New Issue
Block a user