From 432a54e5708f961cb4b761a1d2546eea46e5d1c0 Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 16 Feb 2015 23:17:28 +0100 Subject: [PATCH] some type fixes --- src/json.hpp | 6 ++++-- src/json.hpp.re2c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 595f5b2d2..186632f5b 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -3800,7 +3800,8 @@ struct hash inline size_t operator()(const nlohmann::json& j) const { // a naive hashing via the string representation - return hash()(j.dump()); + const auto& h = hash(); + return h(j.dump()); } }; } @@ -3815,7 +3816,8 @@ no parse error occurred. */ inline nlohmann::json operator "" _json(const char* s, std::size_t) { - return nlohmann::json::parse(s); + return nlohmann::json::parse(reinterpret_cast + (const_cast(s))); } #endif diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 4f718bbaf..31d77c6ba 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -3149,7 +3149,8 @@ struct hash inline size_t operator()(const nlohmann::json& j) const { // a naive hashing via the string representation - return hash()(j.dump()); + const auto& h = hash(); + return h(j.dump()); } }; } @@ -3164,7 +3165,8 @@ no parse error occurred. */ inline nlohmann::json operator "" _json(const char* s, std::size_t) { - return nlohmann::json::parse(s); + return nlohmann::json::parse(reinterpret_cast + (const_cast(s))); } #endif