Added forward declaration header json_forward.hpp. Minimise build times.
This commit is contained in:
parent
4c4f60f438
commit
08d5d768d2
19
src/json.hpp
19
src/json.hpp
@ -29,6 +29,10 @@ SOFTWARE.
|
|||||||
#ifndef NLOHMANN_JSON_HPP
|
#ifndef NLOHMANN_JSON_HPP
|
||||||
#define NLOHMANN_JSON_HPP
|
#define NLOHMANN_JSON_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#include "json_forward.hpp" // Some forward declarations are re-used here.
|
||||||
|
|
||||||
|
|
||||||
#include <algorithm> // all_of, copy, fill, find, for_each, generate_n, none_of, remove, reverse, transform
|
#include <algorithm> // all_of, copy, fill, find, for_each, generate_n, none_of, remove, reverse, transform
|
||||||
#include <array> // array
|
#include <array> // array
|
||||||
#include <cassert> // assert
|
#include <cassert> // assert
|
||||||
@ -124,21 +128,6 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
namespace nlohmann
|
namespace nlohmann
|
||||||
{
|
{
|
||||||
template<typename = void, typename = void>
|
|
||||||
struct adl_serializer;
|
|
||||||
|
|
||||||
// forward declaration of basic_json (required to split the class)
|
|
||||||
template<template<typename U, typename V, typename... Args> class ObjectType =
|
|
||||||
std::map,
|
|
||||||
template<typename U, typename... Args> 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<typename U> class AllocatorType = std::allocator,
|
|
||||||
template<typename T, typename SFINAE = void> class JSONSerializer =
|
|
||||||
adl_serializer>
|
|
||||||
class basic_json;
|
|
||||||
|
|
||||||
// Ugly macros to avoid uglier copy-paste when specializing basic_json
|
// Ugly macros to avoid uglier copy-paste when specializing basic_json
|
||||||
// This is only temporary and will be removed in 3.0
|
// This is only temporary and will be removed in 3.0
|
||||||
|
|||||||
65
src/json_forward.hpp
Normal file
65
src/json_forward.hpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
__ _____ _____ _____
|
||||||
|
__| | __| | | | JSON for Modern C++
|
||||||
|
| | |__ | | | | | | version 2.1.1
|
||||||
|
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
||||||
|
|
||||||
|
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
|
||||||
|
Copyright (c) 2013-2017 Niels Lohmann <http://nlohmann.me>.
|
||||||
|
|
||||||
|
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 <cstdint> // std::int64_t, std::uint64_t ...
|
||||||
|
#include <iosfwd> // std::allocator
|
||||||
|
#include <map> // map
|
||||||
|
#include <string> // std::string
|
||||||
|
#include <vector> // std::vector
|
||||||
|
|
||||||
|
|
||||||
|
namespace nlohmann
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename = void, typename = void>
|
||||||
|
struct adl_serializer;
|
||||||
|
|
||||||
|
// forward declaration of basic_json
|
||||||
|
template<template<typename U, typename V, typename... Args> class ObjectType =
|
||||||
|
std::map,
|
||||||
|
template<typename U, typename... Args> 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<typename U> class AllocatorType = std::allocator,
|
||||||
|
template<typename T, typename SFINAE = void> 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
|
||||||
Loading…
Reference in New Issue
Block a user