Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyVH committed Nov 4, 2019
2 parents ec9647a + 3790bd9 commit c4923e3
Show file tree
Hide file tree
Showing 17 changed files with 121 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- run:
name: Create build files
command: 'mkdir build ; cd build ; cmake ..'
- run:
name: Versions
command: 'g++ --version ; uname -a'
- run:
name: Compile
command: 'cmake --build build'
Expand Down
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,22 @@ matrix:
- os: osx
osx_image: xcode10.1

- os: osx
osx_image: xcode10.2

# Linux / GCC

- os: linux
compiler: gcc
env: compiler=g++-4.8
env: COMPILER=g++-4.8
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.8', 'ninja-build']

- os: linux
compiler: gcc
env: compiler=g++-4.9
env: COMPILER=g++-4.9
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pedantic_clang:

# calling GCC with most warnings
pedantic_gcc:
$(MAKE) json_unit CXX=/usr/local/bin/g++-9 CXXFLAGS=" \
$(MAKE) json_unit CXX=g++-9 CXXFLAGS=" \
-std=c++11 \
-Waddress \
-Waddress-of-packed-member \
Expand Down Expand Up @@ -594,7 +594,7 @@ ChangeLog.md:
release:
rm -fr release_files
mkdir release_files
zip -9 --recurse-paths -X include.zip $(SRCS)
zip -9 --recurse-paths -X include.zip $(SRCS) $(AMALGAMATED_FILE) meson.build
gpg --armor --detach-sig include.zip
mv include.zip include.zip.asc release_files
gpg --armor --detach-sig $(AMALGAMATED_FILE)
Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ endif()

:beer: If you are using OS X and [Homebrew](http://brew.sh), just type `brew tap nlohmann/json` and `brew install nlohmann-json` and you're set. If you want the bleeding edge rather than the latest release, use `brew install nlohmann-json --HEAD`.

If you are using the [Meson Build System](http://mesonbuild.com), then you can get a wrap file by downloading it from [Meson WrapDB](https://wrapdb.mesonbuild.com/nlohmann_json), or simply use `meson wrap install nlohmann_json`.
If you are using the [Meson Build System](http://mesonbuild.com), add this source tree as a [meson subproject](https://mesonbuild.com/Subprojects.html#using-a-subproject). You may also use the `include.zip` published in this project's [Releases](https://github.com/nlohmann/json/releases) to reduce the size of the vendored source tree. Alternatively, you can get a wrap file by downloading it from [Meson WrapDB](https://wrapdb.mesonbuild.com/nlohmann_json), or simply use `meson wrap install nlohmann_json`. Please see the meson project for any issues regarding the packaging.

The provided meson.build can also be used as an alternative to cmake for installing `nlohmann_json` system-wide in which case a pkg-config file is installed. To use it, simply have your build system require the `nlohmann_json` pkg-config dependency. In Meson, it is preferred to use the [`dependency()`](https://mesonbuild.com/Reference-manual.html#dependency) object with a subproject fallback, rather than using the subproject directly.

If you are using [Conan](https://www.conan.io/) to manage your dependencies, merely add `jsonformoderncpp/x.y.z@vthiery/stable` to your `conanfile.py`'s requires, where `x.y.z` is the release version you want to use. Please file issues [here](https://github.com/vthiery/conan-jsonformoderncpp/issues) if you experience problems with the packages.

Expand Down Expand Up @@ -1000,11 +1002,12 @@ json j_from_ubjson = json::from_ubjson(v_ubjson);

Though it's 2019 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:

- GCC 4.8 - 9.0 (and possibly later)
- Clang 3.4 - 8.0 (and possibly later)
- GCC 4.8 - 9.2 (and possibly later)
- Clang 3.4 - 9.0 (and possibly later)
- Intel C++ Compiler 17.0.2 (and possibly later)
- Microsoft Visual C++ 2015 / Build Tools 14.0.25123.0 (and possibly later)
- Microsoft Visual C++ 2017 / Build Tools 15.5.180.51428 (and possibly later)
- Microsoft Visual C++ 2019 / Build Tools 16.3.1+1def00d3d (and possibly later)

I would be happy to learn about other compilers/versions.

Expand All @@ -1025,7 +1028,7 @@ Please note:
- Unsupported versions of GCC and Clang are rejected by `#error` directives. This can be switched off by defining `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK`. Note that you can expect no support in this case.
The following compilers are currently used in continuous integration at [Travis](https://travis-ci.org/nlohmann/json), [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), and [Doozer](https://doozer.io):
The following compilers are currently used in continuous integration at [Travis](https://travis-ci.org/nlohmann/json), [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), [CircleCI](https://circleci.com/gh/nlohmann/json), and [Doozer](https://doozer.io):
| Compiler | Operating System | Version String |
|-----------------------|------------------------------|----------------|
Expand All @@ -1035,11 +1038,13 @@ The following compilers are currently used in continuous integration at [Travis]
| GCC 4.9.4 | Ubuntu 14.04.1 LTS | g++-4.9 (Ubuntu 4.9.4-2ubuntu1~14.04.1) 4.9.4 |
| GCC 5.3.1 (armv7l) | Ubuntu 16.04 LTS | g++ (Ubuntu/Linaro 5.3.1-14ubuntu2) 5.3.1 20160413 |
| GCC 5.5.0 | Ubuntu 14.04.1 LTS | g++-5 (Ubuntu 5.5.0-12ubuntu1~14.04) 5.5.0 20171010 |
| GCC 6.3.0 | Debian 9 (stretch) | g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 |
| GCC 6.3.1 | Fedora release 24 (Twenty Four) | g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) |
| GCC 6.4.0 | Ubuntu 14.04.1 LTS | g++-6 (Ubuntu 6.4.0-17ubuntu1~14.04) 6.4.0 20180424 |
| GCC 7.3.0 | Ubuntu 14.04.1 LTS | g++-7 (Ubuntu 7.3.0-21ubuntu1~14.04) 7.3.0 |
| GCC 7.3.0 | Windows Server 2012 R2 (x64) | g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 7.3.0 |
| GCC 8.1.0 | Ubuntu 14.04.1 LTS | g++-8 (Ubuntu 8.1.0-5ubuntu1~14.04) 8.1.0 |
| GCC 9.2.1 | Ubuntu 14.05.1 LTS | g++-9 (Ubuntu 9.2.1-16ubuntu1~14.04.1) 9.2.1 20191030 |
| Clang 3.5.0 | Ubuntu 14.04.1 LTS | clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0) |
| Clang 3.6.2 | Ubuntu 14.04.1 LTS | clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2) |
| Clang 3.7.1 | Ubuntu 14.04.1 LTS | clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1) |
Expand All @@ -1056,8 +1061,10 @@ The following compilers are currently used in continuous integration at [Travis]
| Clang Xcode 9.3 | OSX 10.13.3 | Apple LLVM version 9.1.0 (clang-902.0.39.2) |
| Clang Xcode 10.0 | OSX 10.13.3 | Apple LLVM version 10.0.0 (clang-1000.11.45.2) |
| Clang Xcode 10.1 | OSX 10.13.3 | Apple LLVM version 10.0.0 (clang-1000.11.45.5) |
| Clang Xcode 10.2 | OSX 10.14.4 | Apple LLVM version 10.0.1 (clang-1001.0.46.4) |
| Visual Studio 14 2015 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 14.0.25420.1, MSVC 19.0.24215.1 |
| Visual Studio 2017 | Windows Server 2016 | Microsoft (R) Build Engine version 15.7.180.61344, MSVC 19.14.26433.0 |
| Visual Studio 15 2017 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 15.9.21+g9802d43bc3, MSVC 19.16.27032.1 |
| Visual Studio 16 2019 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 16.3.1+1def00d3d, MSVC 19.23.28106.4 |
## License
Expand Down Expand Up @@ -1270,6 +1277,15 @@ I deeply appreciate the help of the following people.
- [Gabe Ron](https://github.com/Macr0Nerd) implemented the `to_string` method.
- [Watal M. Iwasaki](https://github.com/heavywatal) fixed a Clang warning.
- [Viktor Kirilov](https://github.com/onqtam) switched the unit tests from [Catch](https://github.com/philsquared/Catch) to [doctest](https://github.com/onqtam/doctest)
- [Juncheng E](https://github.com/ejcjason) fixed a typo.
- [tete17](https://github.com/tete17) fixed a bug in the `contains` function.
- [Xav83](https://github.com/Xav83) fixed some cppcheck warnings.
- [0xflotus](https://github.com/0xflotus) fixed some typos.
- [Christian Deneke](https://github.com/chris0x44) added a const version of `json_pointer::back`.
- [Julien Hamaide](https://github.com/crazyjul) made the `items()` function work with custom string types.
- [Evan Nemerson](https://github.com/nemequ) updated fixed a bug in Hedley and updated this library accordingly.
- [Florian Pigorsch](https://github.com/flopp) fixed a lot of typos.
- [Camille Bégué](https://github.com/cbegue) fixed an issue in the conversion from `std::pair` to `json`.
Thanks a lot for helping out! Please [let me know](mailto:[email protected]) if I forgot someone.
Expand Down
51 changes: 33 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ environment:
LINKER_FLAGS: ""
GENERATOR: Visual Studio 15 2017

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
configuration: Debug
platform: x86
CXX_FLAGS: ""
LINKER_FLAGS: ""
GENERATOR: Visual Studio 16 2019

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
configuration: Debug
platform: x64
CXX_FLAGS: ""
LINKER_FLAGS: ""
GENERATOR: Visual Studio 16 2019

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
configuration: Debug
COMPILER: mingw
Expand Down Expand Up @@ -50,54 +64,55 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
configuration: Release
platform: x86
CXX_FLAGS: ""
CXX_FLAGS: "/permissive- /std:c++latest /utf-8"
LINKER_FLAGS: ""
GENERATOR: Visual Studio 15 2017

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
configuration: Release
platform: x86
CXX_FLAGS: "/permissive- /std:c++latest /utf-8"
CXX_FLAGS: ""
LINKER_FLAGS: ""
GENERATOR: Visual Studio 15 2017
GENERATOR: Visual Studio 16 2019

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
configuration: Release
platform: x64
CXX_FLAGS: ""
LINKER_FLAGS: ""
GENERATOR: Visual Studio 14 2015 Win64
GENERATOR: Visual Studio 14 2015

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
configuration: Release
platform: x64
CXX_FLAGS: ""
LINKER_FLAGS: ""
GENERATOR: Visual Studio 15 2017 Win64
CXX_FLAGS: "/permissive- /std:c++latest /utf-8 /F4000000"
LINKER_FLAGS: "/STACK:4000000"
GENERATOR: Visual Studio 15 2017

- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
configuration: Release
platform: x64
CXX_FLAGS: "/permissive- /std:c++latest /utf-8 /F4000000"
LINKER_FLAGS: "/STACK:4000000"
GENERATOR: Visual Studio 15 2017 Win64
CXX_FLAGS: ""
LINKER_FLAGS: ""
GENERATOR: Visual Studio 16 2019

init:
- cmake --version
- msbuild /version

install:
- if "%COMPILER%"=="mingw" appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip -FileName ninja.zip
- if "%COMPILER%"=="mingw" 7z x ninja.zip -oC:\projects\deps\ninja > nul
- if "%COMPILER%"=="mingw" set PATH=C:\projects\deps\ninja;%PATH%
- if "%COMPILER%"=="mingw" set PATH=C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;%PATH%
- if "%COMPILER%"=="mingw" g++ --version
- if "%COMPILER%"=="mingw" appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip -FileName ninja.zip
- if "%COMPILER%"=="mingw" 7z x ninja.zip -oC:\projects\deps\ninja > nul
- if "%COMPILER%"=="mingw" set PATH=C:\projects\deps\ninja;%PATH%
- if "%COMPILER%"=="mingw" set PATH=C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;%PATH%
- if "%COMPILER%"=="mingw" g++ --version
- if "%platform%"=="x86" set GENERATOR_PLATFORM=Win32

before_build:
# for with_win_header build, inject the inclusion of Windows.h to the single-header library
- ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" }
- ps: if ($env:name -Eq "with_win_header") { "#include <Windows.h>`n" + (Get-Content $header_path | Out-String) | Set-Content $header_path }
- cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin"
- if "%GENERATOR%"=="Ninja" (cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin") else (cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin")

build_script:
- cmake --build . --config "%configuration%"
Expand Down
Binary file modified doc/avatars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/examples/json_pointer__operator_add.link
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/9GFummh9iBAkOFiL"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/B8QFt317rARJWiGI"><b>online</b></a>
2 changes: 1 addition & 1 deletion doc/examples/json_pointer__operator_add_binary.link
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/mxBfUH9gOY9AiOOk"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/SEuKMiM0vuzQDU8U"><b>online</b></a>
2 changes: 1 addition & 1 deletion doc/examples/meta.output
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compiler": {
"c++": "201103",
"family": "clang",
"version": "10.0.1 (clang-1001.0.46.4)"
"version": "11.0.0 (clang-1100.0.33.8)"
},
"copyright": "(C) 2013-2017 Niels Lohmann",
"name": "JSON for Modern C++",
Expand Down
4 changes: 2 additions & 2 deletions include/nlohmann/detail/conversions/to_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ void to_json(BasicJsonType& j, const T(&arr)[N])
external_constructor<value_t::array>::construct(j, arr);
}

template<typename BasicJsonType, typename... Args>
void to_json(BasicJsonType& j, const std::pair<Args...>& p)
template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value, int > = 0 >
void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
{
j = { p.first, p.second };
}
Expand Down
4 changes: 2 additions & 2 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3733,8 +3733,8 @@ void to_json(BasicJsonType& j, const T(&arr)[N])
external_constructor<value_t::array>::construct(j, arr);
}

template<typename BasicJsonType, typename... Args>
void to_json(BasicJsonType& j, const std::pair<Args...>& p)
template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value, int > = 0 >
void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
{
j = { p.first, p.second };
}
Expand Down
1 change: 1 addition & 0 deletions test/cmake_import/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_test(NAME cmake_import_configure
COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
-A "${CMAKE_GENERATOR_PLATFORM}"
-Dnlohmann_json_DIR=${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)
Expand Down
1 change: 1 addition & 0 deletions test/cmake_import_minver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_test(NAME cmake_import_minver_configure
COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
-A "${CMAKE_GENERATOR_PLATFORM}"
-Dnlohmann_json_DIR=${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/project
)
Expand Down
5 changes: 2 additions & 3 deletions test/src/unit-bson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,9 @@ TEST_CASE("BSON input/output_adapters")
{
SECTION("std::ostringstream")
{
std::ostringstream ss;
std::basic_ostringstream<std::uint8_t> ss;
json::to_bson(json_representation, ss);
std::istringstream iss(ss.str());
json j3 = json::from_bson(iss);
json j3 = json::from_bson(ss.str());
CHECK(json_representation == j3);
}

Expand Down
2 changes: 1 addition & 1 deletion test/src/unit-cbor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ TEST_CASE("single CBOR roundtrip")
{
SECTION("std::ostringstream")
{
std::ostringstream ss;
std::basic_ostringstream<std::uint8_t> ss;
json::to_cbor(j1, ss);
json j3 = json::from_cbor(ss.str());
CHECK(j1 == j3);
Expand Down
2 changes: 1 addition & 1 deletion test/src/unit-msgpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ TEST_CASE("single MessagePack roundtrip")
{
SECTION("std::ostringstream")
{
std::ostringstream ss;
std::basic_ostringstream<std::uint8_t> ss;
json::to_msgpack(j1, ss);
json j3 = json::from_msgpack(ss.str());
CHECK(j1 == j3);
Expand Down
Loading

0 comments on commit c4923e3

Please sign in to comment.