Logo
Explore Help
Register Sign In
lenn/json
1
0
Fork 0
You've already forked json
mirror of https://github.com/nlohmann/json.git synced 2025-11-24 03:44:06 +08:00
Code Issues Packages Projects Releases Wiki Activity
Files
885aa0014e83d8e3aa35e2efe3213cedd72b70f2
json/docs/examples/swap__reference.cpp

19 lines
372 B
C++
Raw Normal View History

:memo: cleanup after #650 As <iostream> is not included in json.hpp any more, all code examples need to include <iostream> now.
2017-07-09 11:51:38 +02:00
#include <iostream>
:bookmark: set version to 3.1.0 - updated documentation wrt. new repository layout - temporarily switched off Homebrew --HEAD building (can only be switched on after release) - set copyright date to 2018
2018-02-01 22:20:26 +01:00
#include <nlohmann/json.hpp>
more documentation In this commit, also the semantics for values skipped via the parser callback has changed. Now, the top-level value is returned as “null” instead of “discarded”.
2015-06-24 12:15:51 +02:00
removed "using namespace" from examples
2016-01-30 20:23:14 +01:00
using json = nlohmann::json;
more documentation In this commit, also the semantics for values skipped via the parser callback has changed. Now, the top-level value is returned as “null” instead of “discarded”.
2015-06-24 12:15:51 +02:00
int main()
{
// create two JSON values
json j1 = {1, 2, 3, 4, 5};
json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}};
// swap the values
j1.swap(j2);
// output the values
std::cout << "j1 = " << j1 << '\n';
std::cout << "j2 = " << j2 << '\n';
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.3 Page: 1460ms Template: 8ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API