Merge branch 'develop' into feature/update
This commit is contained in:
commit
039e2f03bc
3 changed files with 225 additions and 488 deletions
133
.travis.yml
133
.travis.yml
|
@ -120,6 +120,9 @@ matrix:
|
||||||
compiler: clang
|
compiler: clang
|
||||||
before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
|
before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
|
||||||
addons:
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
|
||||||
|
packages: ['g++-6', 'clang-3.6']
|
||||||
coverity_scan:
|
coverity_scan:
|
||||||
project:
|
project:
|
||||||
name: "nlohmann/json"
|
name: "nlohmann/json"
|
||||||
|
@ -129,8 +132,8 @@ matrix:
|
||||||
build_command: "make"
|
build_command: "make"
|
||||||
branch_pattern: coverity_scan
|
branch_pattern: coverity_scan
|
||||||
env:
|
env:
|
||||||
- LLVM_VERSION=3.6.0
|
|
||||||
- SPECIAL=coverity
|
- SPECIAL=coverity
|
||||||
|
- COMPILER=clang++-3.6
|
||||||
|
|
||||||
# OSX / Clang
|
# OSX / Clang
|
||||||
|
|
||||||
|
@ -202,119 +205,71 @@ matrix:
|
||||||
# Linux / Clang
|
# Linux / Clang
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: LLVM_VERSION=3.6.0
|
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env: COMPILER=clang++-3.5
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5']
|
||||||
|
packages: ['g++-6', 'clang-3.5']
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: LLVM_VERSION=3.6.1
|
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env: COMPILER=clang++-3.6
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
|
||||||
|
packages: ['g++-6', 'clang-3.6']
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: LLVM_VERSION=3.6.2
|
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env: COMPILER=clang++-3.7
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
|
||||||
|
packages: ['g++-6', 'clang-3.7']
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: LLVM_VERSION=3.7.0
|
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env: COMPILER=clang++-3.8
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: ['g++-6', 'clang-3.8']
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: LLVM_VERSION=3.7.1
|
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env: COMPILER=clang++-3.9
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: ['g++-6', 'clang-3.9']
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: LLVM_VERSION=3.8.0
|
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env: COMPILER=clang++-4.0
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-4.0']
|
||||||
|
packages: ['g++-6', 'clang-4.0']
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: LLVM_VERSION=3.8.1
|
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
env:
|
||||||
# - os: linux
|
- COMPILER=clang++-4.0
|
||||||
# addons:
|
- CXXFLAGS=-std=c++1z
|
||||||
# apt:
|
addons:
|
||||||
# sources: llvm-toolchain-trusty-3.9
|
apt:
|
||||||
# packages: clang-3.9
|
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-4.0']
|
||||||
# env: COMPILER=clang++-3.9
|
packages: ['g++-6', 'clang-4.0']
|
||||||
#
|
|
||||||
# - os: linux
|
|
||||||
# addons:
|
|
||||||
# apt:
|
|
||||||
# sources: llvm-toolchain-trusty-4.0
|
|
||||||
# packages: clang-4.0
|
|
||||||
# env: COMPILER=clang++-4.0
|
|
||||||
#
|
|
||||||
# - os: linux
|
|
||||||
# addons:
|
|
||||||
# apt:
|
|
||||||
# sources: llvm-toolchain-trusty
|
|
||||||
# packages: clang-5.0
|
|
||||||
# env: COMPILER=clang++-5.0
|
|
||||||
|
|
||||||
#####################
|
|
||||||
# installation step #
|
|
||||||
#####################
|
|
||||||
|
|
||||||
# set directories to cache
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2
|
|
||||||
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.1
|
|
||||||
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.0
|
|
||||||
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.0
|
|
||||||
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1
|
|
||||||
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.0
|
|
||||||
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1
|
|
||||||
|
|
||||||
|
|
||||||
install:
|
|
||||||
# create deps dir if not existing
|
|
||||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
|
||||||
- mkdir -p ${DEPS_DIR}
|
|
||||||
|
|
||||||
# make sure CXX is correctly set
|
|
||||||
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
|
|
||||||
|
|
||||||
# get CMake (only for systems with brew - macOS)
|
|
||||||
- |
|
|
||||||
if [[ !(-x $(which cmake)) && (-x $(which brew)) ]]; then
|
|
||||||
brew update
|
|
||||||
brew install cmake
|
|
||||||
cmake --version
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install LLVM/clang when LLVM_VERSION is set
|
|
||||||
- |
|
|
||||||
if [[ "${LLVM_VERSION}" != "" ]]; then
|
|
||||||
LLVM_DIR=${DEPS_DIR}/llvm-${LLVM_VERSION}
|
|
||||||
if [[ -z "$(ls -A ${LLVM_DIR})" ]]; then
|
|
||||||
travis_retry wget --quiet https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz
|
|
||||||
tar xfz cmake-3.6.1.tar.gz
|
|
||||||
(cd cmake-3.6.1 && ./configure --prefix=${LLVM_DIR}/cmake && make install)
|
|
||||||
export PATH="${LLVM_DIR}/cmake/bin:${PATH}"
|
|
||||||
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
|
|
||||||
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
|
|
||||||
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
|
|
||||||
CLANG_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
|
|
||||||
mkdir -p ${LLVM_DIR} ${LLVM_DIR}/build ${LLVM_DIR}/projects/libcxx ${LLVM_DIR}/projects/libcxxabi ${LLVM_DIR}/clang
|
|
||||||
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}
|
|
||||||
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxx
|
|
||||||
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxxabi
|
|
||||||
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/clang
|
|
||||||
(cd ${LLVM_DIR}/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_DIR}/install -DCMAKE_CXX_COMPILER=clang++)
|
|
||||||
(cd ${LLVM_DIR}/build/projects/libcxx && make install -j2)
|
|
||||||
(cd ${LLVM_DIR}/build/projects/libcxxabi && make install -j2)
|
|
||||||
fi
|
|
||||||
export CXXFLAGS="-nostdinc++ -isystem ${LLVM_DIR}/install/include/c++/v1"
|
|
||||||
export LDFLAGS="-L ${LLVM_DIR}/install/lib -l c++ -l c++abi"
|
|
||||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
|
|
||||||
export PATH="${LLVM_DIR}/clang/bin:${PATH}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# build script #
|
# build script #
|
||||||
################
|
################
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
# make sure CXX is correctly set
|
||||||
|
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
|
||||||
|
|
||||||
# show OS/compiler version
|
# show OS/compiler version
|
||||||
- uname -a
|
- uname -a
|
||||||
- $CXX --version
|
- $CXX --version
|
||||||
|
|
22
README.md
22
README.md
|
@ -368,7 +368,7 @@ json j_umset(c_umset); // both entries for "one" are used
|
||||||
// maybe ["one", "two", "one", "four"]
|
// maybe ["one", "two", "one", "four"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
|
Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };
|
std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };
|
||||||
|
@ -712,7 +712,7 @@ json j_from_msgpack = json::from_msgpack(v_msgpack);
|
||||||
Though it's 2016 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
|
Though it's 2016 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
|
||||||
|
|
||||||
- GCC 4.9 - 7.1 (and possibly later)
|
- GCC 4.9 - 7.1 (and possibly later)
|
||||||
- Clang 3.4 - 3.9 (and possibly later)
|
- Clang 3.4 - 4.0 (and possibly later)
|
||||||
- Microsoft Visual C++ 2015 / Build Tools 14.0.25123.0 (and possibly later)
|
- Microsoft Visual C++ 2015 / Build Tools 14.0.25123.0 (and possibly later)
|
||||||
- Microsoft Visual C++ 2017 / Build Tools 15.1.548.43366 (and possibly later)
|
- Microsoft Visual C++ 2017 / Build Tools 15.1.548.43366 (and possibly later)
|
||||||
|
|
||||||
|
@ -741,13 +741,12 @@ The following compilers are currently used in continuous integration at [Travis]
|
||||||
| GCC 5.4.1 | Ubuntu 14.04.5 LTS | g++-5 (Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904 |
|
| GCC 5.4.1 | Ubuntu 14.04.5 LTS | g++-5 (Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904 |
|
||||||
| GCC 6.3.0 | Ubuntu 14.04.5 LTS | g++-6 (Ubuntu/Linaro 6.3.0-18ubuntu2~14.04) 6.3.0 20170519 |
|
| GCC 6.3.0 | Ubuntu 14.04.5 LTS | g++-6 (Ubuntu/Linaro 6.3.0-18ubuntu2~14.04) 6.3.0 20170519 |
|
||||||
| GCC 7.1.0 | Ubuntu 14.04.5 LTS | g++-7 (Ubuntu 7.1.0-5ubuntu2~14.04) 7.1.0
|
| GCC 7.1.0 | Ubuntu 14.04.5 LTS | g++-7 (Ubuntu 7.1.0-5ubuntu2~14.04) 7.1.0
|
||||||
| Clang 3.6.0 | Ubuntu 14.04.5 LTS | clang version 3.6.0 (tags/RELEASE_360/final) |
|
| Clang 3.5.0 | Ubuntu 14.04.5 LTS | clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) |
|
||||||
| Clang 3.6.1 | Ubuntu 14.04.5 LTS | clang version 3.6.1 (tags/RELEASE_361/final) |
|
| Clang 3.6.2 | Ubuntu 14.04.5 LTS | clang version 3.6.2-svn240577-1~exp1 (branches/release_36) |
|
||||||
| Clang 3.6.2 | Ubuntu 14.04.5 LTS | clang version 3.6.2 (tags/RELEASE_362/final) |
|
| Clang 3.7.1 | Ubuntu 14.04.5 LTS | clang version 3.7.1-svn253571-1~exp1 (branches/release_37) |
|
||||||
| Clang 3.7.0 | Ubuntu 14.04.5 LTS | clang version 3.7.0 (tags/RELEASE_370/final) |
|
| Clang 3.8.0 | Ubuntu 14.04.5 LTS | clang version 3.8.0-2ubuntu3~trusty5 (tags/RELEASE_380/final) |
|
||||||
| Clang 3.7.1 | Ubuntu 14.04.5 LTS | clang version 3.7.1 (tags/RELEASE_371/final) |
|
| Clang 3.9.1 | Ubuntu 14.04.5 LTS | clang version 3.9.1-4ubuntu3~14.04.2 (tags/RELEASE_391/rc2) |
|
||||||
| Clang 3.8.0 | Ubuntu 14.04.5 LTS | clang version 3.8.0 (tags/RELEASE_380/final) |
|
| Clang 4.0.1 | Ubuntu 14.04.5 LTS | clang version 4.0.1-svn305264-1~exp1 (branches/release_40) |
|
||||||
| Clang 3.8.1 | Ubuntu 14.04.5 LTS | clang version 3.8.1 (tags/RELEASE_381/final) |
|
|
||||||
| Clang Xcode 6.4 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) |
|
| Clang Xcode 6.4 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) |
|
||||||
| Clang Xcode 7.3 | Darwin Kernel Version 15.0.0 (OSX 10.10.5) | Apple LLVM version 7.3.0 (clang-703.0.29) |
|
| Clang Xcode 7.3 | Darwin Kernel Version 15.0.0 (OSX 10.10.5) | Apple LLVM version 7.3.0 (clang-703.0.29) |
|
||||||
| Clang Xcode 8.0 | Darwin Kernel Version 15.6.0 | Apple LLVM version 8.0.0 (clang-800.0.38) |
|
| Clang Xcode 8.0 | Darwin Kernel Version 15.6.0 | Apple LLVM version 8.0.0 (clang-800.0.38) |
|
||||||
|
@ -854,6 +853,11 @@ I deeply appreciate the help of the following people.
|
||||||
- [Oleg Endo](https://github.com/olegendo) reduced the memory consumption by replacing `<iostream>` with `<iosfwd>`.
|
- [Oleg Endo](https://github.com/olegendo) reduced the memory consumption by replacing `<iostream>` with `<iosfwd>`.
|
||||||
- [dan-42](https://github.com/dan-42) cleaned up the CMake files to simplify including/reusing of the library.
|
- [dan-42](https://github.com/dan-42) cleaned up the CMake files to simplify including/reusing of the library.
|
||||||
- [Nikita Ofitserov](https://github.com/himikof) allowed for moving values from initializer lists.
|
- [Nikita Ofitserov](https://github.com/himikof) allowed for moving values from initializer lists.
|
||||||
|
- [Greg Hurrell](https://github.com/wincent) fixed a typo.
|
||||||
|
- [Dmitry Kukovinets](https://github.com/DmitryKuk) fixed a typo.
|
||||||
|
- [kbthomp1](https://github.com/kbthomp1) fixed an issue related to the Intel OSX compiler.
|
||||||
|
- [Markus Werle](https://github.com/daixtrose) fixed a typo.
|
||||||
|
- [WebProdPP](https://github.com/WebProdPP) fixed a subtle error in a precondition check.
|
||||||
|
|
||||||
|
|
||||||
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
|
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
|
||||||
|
|
554
src/json.hpp
554
src/json.hpp
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue