diff --git a/src/json.hpp b/src/json.hpp index d28325a66..20131188d 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -29,6 +29,10 @@ SOFTWARE. #ifndef NLOHMANN_JSON_HPP #define NLOHMANN_JSON_HPP + +#include "json_forward.hpp" // Some forward declarations are re-used here. + + #include // all_of, copy, fill, find, for_each, generate_n, none_of, remove, reverse, transform #include // array #include // assert @@ -124,21 +128,6 @@ SOFTWARE. */ namespace nlohmann { -template -struct adl_serializer; - -// forward declaration of basic_json (required to split the class) -template class ObjectType = - std::map, - template class ArrayType = std::vector, - class StringType = std::string, class BooleanType = bool, - class NumberIntegerType = std::int64_t, - class NumberUnsignedType = std::uint64_t, - class NumberFloatType = double, - template class AllocatorType = std::allocator, - template class JSONSerializer = - adl_serializer> -class basic_json; // Ugly macros to avoid uglier copy-paste when specializing basic_json // This is only temporary and will be removed in 3.0 diff --git a/src/json_forward.hpp b/src/json_forward.hpp new file mode 100644 index 000000000..b35344d08 --- /dev/null +++ b/src/json_forward.hpp @@ -0,0 +1,65 @@ +/* + __ _____ _____ _____ + __| | __| | | | JSON for Modern C++ +| | |__ | | | | | | version 2.1.1 +|_____|_____|_____|_|___| https://github.com/nlohmann/json + +Licensed under the MIT License . +Copyright (c) 2013-2017 Niels Lohmann . + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#ifndef NLOHMANN_JSON_FORWARD_HPP +#define NLOHMANN_JSON_FORWARD_HPP + +#include // std::int64_t, std::uint64_t ... +#include // std::allocator +#include // map +#include // std::string +#include // std::vector + + +namespace nlohmann +{ + +template +struct adl_serializer; + +// forward declaration of basic_json +template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer> +class basic_json; + + +// nlohmann::json uses defaults of args of basic_json<>. +using json = basic_json<>; + +} // End namespace 'nlohmann' + + +#endif // End NLOHMANN_JSON_FORWARD_HPP