llakssz / Dr-Driller

'Mr Driller' clone in C++ & SDL 2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion for JSON code

bufalo1973 opened this issue · comments

It would avoid some circular inclusion creating a file (p.e. json-helpers.h) that had:

#ifndef JSON_HELPERS_H
#define JSON_HELPERS_H

#include <string>
namespace Json {
    template <typename T> class SecureAllocator;
    #ifdef JSONCPP_USING_SECURE_MEMORY
    #undef JSONCPP_USING_SECURE_MEMORY
    #endif
    #define JSONCPP_USING_SECURE_MEMORY 0
    // If non-zero, the library zeroes any memory that it has allocated before
    // it frees its memory.
    template <typename T> using Allocator = typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>, std::allocator<T>>::type;
    using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
}
#endif // JSON_HELPERS_H

And include it into json.h and json-forwards.h.