From 4eb3e41f64c0c00aa593799217e5c84dedfe79b7 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 13 Jan 2016 19:16:43 +0100 Subject: [PATCH] Update --- Nodes.xml | 2 +- annotated.html | 8 +- classes.html | 10 +- classnlohmann_1_1basic__json-members.html | 8 +- classnlohmann_1_1basic__json.html | 16 +- ...asic__json_1_1const__iterator-members.html | 8 +- ...ann_1_1basic__json_1_1const__iterator.html | 10 +- ...tor_a019087161350d393f3e4ac841cdd3dbd.html | 10 +- ...tor_a17e5f5d3598e6901f3c1c1f7dc60589f.html | 10 +- ...tor_a1cba94e5a67ee52bc66b898a4e08359d.html | 10 +- ...tor_a211523a57024a43965862b497b89ab91.html | 10 +- ...tor_a301749e9779adafd395369ac36df93df.html | 10 +- ...tor_a36086a699b95e06976c11367b7d6ba53.html | 10 +- ...tor_a4632d8307fc315f21e2ecc9ba5aa6346.html | 10 +- ...tor_a4f7ac43b0ab34c387b1ae1a8e9c08467.html | 10 +- ...tor_a5aff013c03c1bdc248346c249bec7b67.html | 10 +- ...tor_a62cad59e006eb7fa594c2c5b65a76610.html | 10 +- ...tor_a67848d4b7bfa576434ad9807147b5870.html | 10 +- ...tor_a6b3e43d2f45fa611825dbdf4e88fffe2.html | 10 +- ...tor_a83454954e4e16be3d5316f9322e91a34.html | 10 +- ...tor_a86a1771e6658d0b14868df6c197d2353.html | 8 +- ...tor_a8d024cbc99db0d8106899f9fd9973735.html | 10 +- ...tor_ab74b39747a9dad60650a57133fca85b3.html | 10 +- ...tor_ab7dacd8e3ee9b3756bfcdb87dd55a515.html | 10 +- ...tor_ab9d31bf0d0b4d7310c858a04ce84a52f.html | 10 +- ...tor_abb1921cbf0ad4036c83bc6303e22171f.html | 10 +- ...tor_abbacd95955c602efc9a58ed1ffdb46c4.html | 10 +- ...tor_ac36b9187de43721a4bf1b052578bb80b.html | 10 +- ...tor_ac634a659837f5aebc97125e031de23b5.html | 10 +- ...tor_acea5b75d1087e2a92833946d9dc547ff.html | 10 +- ...tor_ada3100cdb8700566051828f1355fa745.html | 10 +- ...tor_adb50d6043ace464d9f694869724d7fb2.html | 10 +- ...tor_adda9a4bd7f0edb9cb39dc0dca3d4a286.html | 10 +- ...tor_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html | 10 +- ...tor_ae480d5c86e5e1129d53d1e19782017a6.html | 10 +- ...tor_aebd099d9a70ffe760242ef24046c9002.html | 10 +- ...tor_af34f68f1ce670e7f25ce267b2b1e64ab.html | 10 +- ...tor_af55564e391b23e41abe78bc4bbe4edcb.html | 10 +- ...nn_1_1basic__json_1_1iterator-members.html | 8 +- classnlohmann_1_1basic__json_1_1iterator.html | 10 +- ...tor_a037e5f3de196ff4cea8a95a8a4e35882.html | 10 +- ...tor_a0a43bd93e6e46645ed0b93d3af7bfe22.html | 10 +- ...tor_a0c0acb68cc2a50a0e8782f860184883f.html | 10 +- ...tor_a0eb7ac9b746fb6f931ae728f70f92a8e.html | 10 +- ...tor_a1220b360a07b0605f7d2f4b3cfd16736.html | 10 +- ...tor_a21d32a4547ba4cbadd8b435a6a0d0e1b.html | 10 +- ...tor_a302d810a0685f8d39368eaa65c833acf.html | 10 +- ...tor_a33277dbf06ac5c1e7102e26f6b5e2c00.html | 10 +- ...tor_a4ae612fa9eb59784047b40f0419db65d.html | 10 +- ...tor_a4f6e03ae3bb674ebf0b727f74957c12f.html | 8 +- ...tor_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html | 10 +- ...tor_a7031e759ee52d1283aada0ff81108a5e.html | 10 +- ...tor_a94285e2ade0bfef829b81377bbbca6cf.html | 10 +- ...tor_a9fcfda575b08d0c73b6274cdbbe7f184.html | 10 +- ...tor_aa2bd10afdcfc70acb8eaabbd2f6496f0.html | 10 +- ...tor_ab220a0cc3fe410fbae4524208bd5834f.html | 10 +- ...tor_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html | 10 +- ...tor_abaebf4e21956dd20d9f862fa5647d32d.html | 10 +- ...tor_af64127418c567660d92b1afdfe9676db.html | 10 +- ...tor_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html | 10 +- ...on_1_1json__reverse__iterator-members.html | 8 +- ...asic__json_1_1json__reverse__iterator.html | 10 +- ...tor_a03e542423284327d3801cf078f1c2b44.html | 10 +- ...tor_a0b494ef7570d031216f907d2c85ec323.html | 10 +- ...tor_a15e9cf4c5a43238e82ab69c4a295c491.html | 10 +- ...tor_a1c84e6d1f047ab4105fa665f455158a7.html | 10 +- ...tor_a2a1dc92fbec862883c8b89755c787c99.html | 10 +- ...tor_a5ee9ec91a6ddcd8d72278d681361626f.html | 10 +- ...tor_a61d31531e0dfc5448e7fa15678b05bbe.html | 10 +- ...tor_a6bd38ed124df0332ba3263a9176b0101.html | 10 +- ...tor_a70086e392779ecbbc9e6845b2be126a0.html | 10 +- ...tor_aa82b48aee07baee284f8340b37ec6864.html | 10 +- ...tor_ab6245ab29d8481ef2a2351c02cc31d4d.html | 10 +- ...tor_ac427d8f61858c13b7c16649bfbf75e76.html | 10 +- ...tor_ad3d6837b6f97065625c6c65f62f4b6d4.html | 10 +- ...tor_ae988bd36b7d098b1157871f83b2d6265.html | 10 +- ...tor_af972fce017b24906236ab235857a11a8.html | 10 +- ...son_a01a2643289b69cd71d9b3f3fc209b748.html | 34 +- ...son_a0703ae5cbd2daac5e6c0ae01d3a1b114.html | 40 +- ...son_a07c9c38a1f01675759e05d5d34627343.html | 34 +- ...son_a088460b5d95f384a4f2ec9e52f4f66ba.html | 41 +- ...son_a0afa4512f03406db0d0432657e9c7361.html | 38 +- ...son_a114095c452ca2f4ba976548df3da68be.html | 41 +- ...son_a11c3dd843c21c58daa651e84046a82af.html | 41 +- ...son_a122640e7e2db1814fc7bbb3c122ec76e.html | 37 +- ...son_a13e5642dbfa1602c937d295a085413cc.html | 10 +- ...son_a1683189bd539313b5559f07961166c8b.html | 10 +- ...son_a16a275d0201e9aedc87c933c764b8869.html | 43 +- ...son_a1dc0c521042807e216d11110d2f002ff.html | 29 +- ...son_a231b02148577b69a154b2ce2c87a5522.html | 10 +- ...son_a234f03dce002783748ca401a42bc6472.html | 43 +- ...son_a266c4dd24d11a86e4831523af5d9df4d.html | 44 +- ...son_a26b7e4876af25eae5800ce43f93aaef2.html | 52 +- ...son_a2adfc8d24bea3908398cbf325b5dc1d7.html | 33 +- ...son_a2f07bcf7e75c34396476dd1790f26ce8.html | 40 +- ...son_a3173944e7b1809a333def4078a0b92a3.html | 40 +- ...son_a317b01b0fba3ac458561f1634759ea3b.html | 12 +- ...son_a3287df6546c905fb0a5786deb4b1cf32.html | 45 +- ...son_a33f1632cfdbf460b4913f4e8a43dd9e4.html | 30 +- ...son_a34d6a60dd99e9f33b8273a1c8db5669b.html | 32 +- ...son_a3d4e4bab95b24ccab42ed37e0ede2d98.html | 31 +- ...son_a42f9133f978dde4cce5851b2c2434a0c.html | 41 +- ...son_a4361aa791f3980abb239e4155a3450cb.html | 33 +- ...son_a457fec897d7b6283c60ca236ebb1f5e8.html | 31 +- ...son_a48c8d153bc2fd1af655063a4b984feac.html | 31 +- ...son_a4943b7f16ddc4e0df33c0cae7ef14471.html | 36 +- ...son_a4ad3f27ecece8f644e8dca69a97eb67f.html | 36 +- ...son_a4bf695ddf4a00ea8feea2c725ec847f1.html | 37 +- ...son_a4d688b5ff534d3ab4e284b3191061529.html | 33 +- ...son_a5114ed5eb394a2805da0bd1acba95ae2.html | 40 +- ...son_a53a2abfdd4f72c7df5aba1155bf03e48.html | 41 +- ...son_a57703688bee6b9736ab3a430d8d246f2.html | 38 +- ...son_a57a96ab3ff1ce7b48a754129fb12c982.html | 37 +- ...son_a5a2d4dbcdbc8ea065b87daf52cd786b9.html | 24 +- ...son_a5c8bb5200f5eac10d31e26be46e5b1ac.html | 37 +- ...son_a5d428360d75a52f6af74751d1cc912c6.html | 50 +- ...son_a5e34c5435e557d0bf666bd7311211405.html | 32 +- ...son_a5f0aad50ed7e8aec3128fe018c18b3fe.html | 65 +- ...son_a5fd8b54389698edf0c08e2dd001f610b.html | 10 +- ...son_a60ca396028b8d9714c6e10efbf475af6.html | 37 +- ...son_a63691315292df8e1522b00d37ebb1ffc.html | 18 +- ...son_a652414dd930cb3af3b6f454cc535a23e.html | 49 +- ...son_a656939a3dc9a6047e4afacd9e11b83a6.html | 43 +- ...son_a66f936cfbd252f85bd3dc2598e37a64b.html | 40 +- ...son_a6944904b3b59769b1cf62ac2532cbe33.html | 13 +- ...son_a696ced74d8edc0b63a000a72907ab109.html | 41 +- ...son_a6a7f45095675ac6fd1d018a0e41874be.html | 41 +- ...son_a6b7428e8c1169497f47b81667001cbfb.html | 34 +- ...son_a6bbd3e72a870f1ba81ff6886b063b0fe.html | 10 +- ...son_a6dff6a02a2be250b8f8dc2f47be65544.html | 33 +- ...son_a6e2e21da48f5d9471716cd868a068327.html | 37 +- ...son_a71eba33d906745e66f340952b79fbce3.html | 10 +- ...son_a72442ccbb378b4464a24a2da1e784041.html | 52 +- ...son_a72ba20783ecb3eec98bd6a3b870d565c.html | 36 +- ...son_a74472977b798c7b7989e6e7cb960ecff.html | 37 +- ...son_a74a943800c7f103d0990d7eef82c6453.html | 37 +- ...son_a74ccfa471a0c061876b247f820f3c741.html | 79 +- ...son_a75a1754e0d39f33095d3102a8bdb9881.html | 54 +- ...son_a76cfc5062bf6223396ab82c753cd4634.html | 41 +- ...son_a7c08f966200af98db0313a3b517ce0a9.html | 36 +- ...son_a7c19a5c3be6cc755377ee41eade78baf.html | 37 +- ...son_a7d0db3b728d820d4984df78d97d2b104.html | 10 +- ...son_a7d1b990f2c12fecb57db1504fdadd0bb.html | 33 +- ...son_a7dab69b10b98e7bc694339720e37fb2b.html | 37 +- ...son_a7f97a91ad8f1d5cf0b9213bd24f247c4.html | 35 +- ...son_a80ceaa3bdd346292273b309e08525c1c.html | 10 +- ...son_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html | 44 +- ...son_a87db51b6b936fb2ea293cdbc8702dcb8.html | 37 +- ...son_a8b526709d395142b68d21abfbfff17c3.html | 44 +- ...son_a8c40cd9ead4de7c82f28268bdf0ec98a.html | 49 +- ...son_a8e34088252a3ee6b2377f3a1f26dd1ba.html | 29 +- ...son_a8e4e11999b4e7faa8f31f21164ebd65a.html | 12 +- ...son_a8fa74698f4061e18ec664009f3af1ddf.html | 39 +- ...son_a930e14150ffa067bcf56d35cb00271e1.html | 26 +- ...son_a960962c683909619d1d2fbbe856c022e.html | 40 +- ...son_a9730b9f7bc2150e641fe20198d4477c7.html | 35 +- ...son_a98e05a2c9b8f74bd60442772cddeee52.html | 35 +- ...son_a9993148cb0473365e52998c7315f9ada.html | 41 +- ...son_a9a73d1b71c9e913aa2888d8b40c72ee9.html | 33 +- ...son_a9c26c5d0f4a519c7236149b9aeb3ef9e.html | 41 +- ...son_a9daafb4c15ed5a008cb825bbd8c29d87.html | 29 +- ...son_a9f17a0690155e3a5603246ccec81499e.html | 41 +- ...son_aa0422e861b4cbd7cdcaad7a11a1304a9.html | 79 +- ...son_aa1f3b3f1dca79392d6727b81f9668c6c.html | 44 +- ...son_aa5413178b8041f7ac685dec4b040dd2c.html | 36 +- ...son_aa6a24b176f9599a21d662cc5f8e1ca76.html | 10 +- ...son_aa6c32f669a2e523666072003d0ea46f4.html | 55 +- ...son_aa71e977d31f470689883ac60d16ea4ac.html | 38 +- ...son_aabe4661644ea549089f0886c2551d2ac.html | 10 +- ...son_aac185a137428a7337aa620de07bfbbd7.html | 10 +- ...son_aacd442b66140c764c594ac8ad7dfd5b3.html | 37 +- ...son_aacf6c869f6a9c66ac1bc99e93f310044.html | 15 +- ...son_aaf363408931d76472ded14017e59c9e8.html | 37 +- ...son_aafa839f2a74dc1b5060314b3423143b8.html | 13 +- ...son_ab14e3503305622fb5ab01a7f490916e8.html | 34 +- ...son_ab2162bc76e10d8736cab9b2039956054.html | 36 +- ...son_ab74b2398f29acc6ffbf48f1b8974a848.html | 41 +- ...son_ab7d60fb6cb8e8f5740e588f9dc953819.html | 72 +- ...son_ab9a20bd1d391e9cb968db50c246f728d.html | 44 +- ...son_ab9da2afc6f77295f25252725fde142a6.html | 44 +- ...son_abe8f3224ca4041908ddb466cb9caecf1.html | 40 +- ...son_ac160789f17d206a5404981ca0957e303.html | 29 +- ...son_ac4011bd0781e51afe4994d2b09fd27e9.html | 10 +- ...son_ac8163abe518595f19dbee68db1caaaf7.html | 41 +- ...son_ac82abedf356d252e0589850c3d8b35ba.html | 16 +- ...son_ac943391891fcde0a71a15ce990e0f7f4.html | 30 +- ...son_acd08f9179c8c1e9f2cd7575a724ce27e.html | 32 +- ...son_acdf4445333649ec94198f09a62144884.html | 33 +- ...son_ace8338e57fdb11e1955c2a0c2d782069.html | 13 +- ...son_ad1f617d29e8923dd40c89153f792b1bc.html | 35 +- ...son_ad2c4513cef5d8db760c4b2d871eea42c.html | 10 +- ...son_ad497cbc4f80c8d79662ee6e19bf145dd.html | 54 +- ...son_ad6734c2b91b1b77aa2b43b65c3619c05.html | 35 +- ...son_ad8e0c5d04f016d1b3ac7369e5c73bedf.html | 33 +- ...son_ada8e01109a60088e4db2a670d4903b54.html | 45 +- ...son_adbd4c16c9ac641b2a4736bc2c6787d83.html | 10 +- ...son_ade7bd6e0fe221fec9d3fa9b430f5ce76.html | 38 +- ...son_adeaef2ab021997a11a826c378c2365e1.html | 28 +- ...son_adf5dea6fa9d7075ff89ca0796ab47a7e.html | 31 +- ...son_ae347859ec88176ef76a0cbe5b4514fcf.html | 35 +- ...son_ae50f22a1c646b8627e88f1313cceffd4.html | 41 +- ...son_ae874cfc1746b560c53a03bcf5b7bbeed.html | 41 +- ...son_ae928414b2805cf6ef56b4e4f8d235416.html | 10 +- ...son_ae960d2d6bc7b94fe39cc5e9f106edfa9.html | 28 +- ...son_aea1c863b719b4ca5b77188c171bbfafe.html | 10 +- ...son_af073eec08d2e68924098aef09e9a10ba.html | 33 +- ...son_af0ebd1757acb971a6504b4acabf88584.html | 33 +- ...son_af127fb69c580c17821da5f5be57e3585.html | 26 +- ...son_af1e3f9e079136abca2530c8191c56292.html | 38 +- ...son_af2730bc8ffa6b28916875c13ee7b83f5.html | 69 +- ...son_af661bc209bf22097e2f76607a11b56bf.html | 41 +- ...son_af6b6050ccd906dddf7c9f47fe3ad62a5.html | 38 +- ...son_af709c079de0ac3507143ea2c60699bd0.html | 65 +- ...son_af74581d177dafc38df5a126ccd358999.html | 44 +- ...son_af7d0adc984d04fc70c3d29fcd63e096a.html | 34 +- ...son_afc4223b5ad03b1b76e925374a8fff98e.html | 34 +- dir_68267d1309a1af8e8297ef4c3efbcdba.html | 8 +- doxygen.css | 27 +- functions.html | 10 +- functions_0x7e.html | 133 + functions_b.html | 10 +- functions_c.html | 10 +- functions_d.html | 10 +- functions_e.html | 10 +- functions_enum.html | 8 +- functions_f.html | 10 +- functions_func.html | 12 +- functions_g.html | 10 +- functions_i.html | 10 +- functions_j.html | 10 +- functions_k.html | 10 +- functions_m.html | 10 +- functions_n.html | 10 +- functions_o.html | 10 +- functions_p.html | 10 +- functions_r.html | 10 +- functions_rela.html | 8 +- functions_s.html | 10 +- functions_t.html | 10 +- functions_type.html | 8 +- functions_v.html | 10 +- graph_legend.html | 44 +- hierarchy.html | 8 +- index.html | 8 +- json_8hpp_source.html | 5032 +---------------- namespacemembers.html | 8 +- namespacemembers_type.html | 8 +- namespacenlohmann.html | 8 +- ..._1anonymous__namespace_02json_8hpp_03.html | 8 +- ...ann_a2bfd99e845a2e5cd90aeaf1b1431f474.html | 10 +- search/all_0.html | 2 +- search/all_1.html | 2 +- search/all_10.html | 2 +- search/all_11.html | 2 +- search/all_12.html | 2 +- search/all_13.html | 2 +- search/all_2.html | 2 +- search/all_3.html | 2 +- search/all_4.html | 2 +- search/all_5.html | 2 +- search/all_6.html | 2 +- search/all_7.html | 2 +- search/all_8.html | 2 +- search/all_9.html | 2 +- search/all_a.html | 2 +- search/all_b.html | 2 +- search/all_c.html | 2 +- search/all_d.html | 2 +- search/all_e.html | 2 +- search/all_f.html | 2 +- search/classes_0.html | 2 +- search/classes_1.html | 2 +- search/classes_2.html | 2 +- search/classes_3.html | 2 +- search/classes_4.html | 2 +- search/enums_0.html | 2 +- search/enums_1.html | 2 +- search/enumvalues_0.html | 2 +- search/enumvalues_1.html | 2 +- search/enumvalues_2.html | 2 +- search/enumvalues_3.html | 2 +- search/enumvalues_4.html | 2 +- search/enumvalues_5.html | 2 +- search/enumvalues_6.html | 2 +- search/enumvalues_7.html | 2 +- search/functions_0.html | 2 +- search/functions_1.html | 2 +- search/functions_10.html | 2 +- search/functions_11.html | 2 +- search/functions_2.html | 2 +- search/functions_3.html | 2 +- search/functions_4.html | 2 +- search/functions_5.html | 2 +- search/functions_6.html | 2 +- search/functions_7.html | 2 +- search/functions_8.html | 2 +- search/functions_9.html | 2 +- search/functions_a.html | 2 +- search/functions_b.html | 2 +- search/functions_c.html | 2 +- search/functions_d.html | 2 +- search/functions_e.html | 2 +- search/functions_f.html | 2 +- search/namespaces_0.html | 2 +- search/related_0.html | 2 +- search/related_1.html | 2 +- search/typedefs_0.html | 2 +- search/typedefs_1.html | 2 +- search/typedefs_2.html | 2 +- search/typedefs_3.html | 2 +- search/typedefs_4.html | 2 +- search/typedefs_5.html | 2 +- search/typedefs_6.html | 2 +- search/typedefs_7.html | 2 +- search/typedefs_8.html | 2 +- search/typedefs_9.html | 2 +- search/typedefs_a.html | 2 +- search/typedefs_b.html | 2 +- ...ash_3_01nlohmann_1_1json_01_4-members.html | 8 +- ...std_1_1hash_3_01nlohmann_1_1json_01_4.html | 10 +- ...1_4_afd03f6ad53db22868ca4163a8200b2f9.html | 10 +- 321 files changed, 2042 insertions(+), 9209 deletions(-) create mode 100644 functions_0x7e.html diff --git a/Nodes.xml b/Nodes.xml index 9736ae745..cdc78c50b 100644 --- a/Nodes.xml +++ b/Nodes.xml @@ -1301,7 +1301,7 @@ ~ - functions_~.html + functions_0x7e.html diff --git a/annotated.html b/annotated.html index d0517a133..18306e5ba 100644 --- a/annotated.html +++ b/annotated.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class List @@ -33,7 +33,7 @@ - + @@ -101,9 +101,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classes.html b/classes.html index ec8aa03c3..c8e9b95b9 100644 --- a/classes.html +++ b/classes.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Index @@ -33,7 +33,7 @@ - + @@ -88,7 +88,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
B | C | H | I | J
- +
  b  
  c  
  h  
@@ -103,9 +103,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classnlohmann_1_1basic__json-members.html b/classnlohmann_1_1basic__json-members.html index 7760e500b..c630d6b4d 100644 --- a/classnlohmann_1_1basic__json-members.html +++ b/classnlohmann_1_1basic__json-members.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Member List @@ -33,7 +33,7 @@
- + @@ -236,9 +236,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classnlohmann_1_1basic__json.html b/classnlohmann_1_1basic__json.html index 6e40244ab..587fa10a2 100644 --- a/classnlohmann_1_1basic__json.html +++ b/classnlohmann_1_1basic__json.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json Class Template Reference @@ -33,7 +33,7 @@ - + @@ -126,8 +126,8 @@ Public Types parse_event_t::value
} JSON callback events. More...
-  +  using parser_callback_t = std::function< bool(int depth, parse_event_t event, basic_json &parsed)>  per-element parser callback type More...
  @@ -143,8 +143,8 @@ Public Types value_t::discarded
} the JSON type enumeration More...
-  +  @@ -631,7 +631,7 @@ class nlohmann::basic_json
  • Basic
  • Static Public Member Functions

    - + @@ -128,9 +128,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classnlohmann_1_1basic__json_1_1const__iterator.html b/classnlohmann_1_1basic__json_1_1const__iterator.html index 04ea3550d..ebf2da9c8 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator Class Reference @@ -33,7 +33,7 @@ - + @@ -215,13 +215,13 @@ class nlohmann::basic_json::const_iterator
    Since
    version 1.0.0
    -

    Definition at line 5577 of file json.hpp.

    +

    Definition at line 5686 of file json.hpp.

    diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a019087161350d393f3e4ac841cdd3dbd.html b/classnlohmann_1_1basic__json_1_1const__iterator_a019087161350d393f3e4ac841cdd3dbd.html index 08945de5d..0aeff5824 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a019087161350d393f3e4ac841cdd3dbd.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a019087161350d393f3e4ac841cdd3dbd.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator-- @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5823 of file json.hpp.

    +

    Definition at line 5958 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a17e5f5d3598e6901f3c1c1f7dc60589f.html b/classnlohmann_1_1basic__json_1_1const__iterator_a17e5f5d3598e6901f3c1c1f7dc60589f.html index 5cd1c68f7..f63f9523b 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a17e5f5d3598e6901f3c1c1f7dc60589f.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a17e5f5d3598e6901f3c1c1f7dc60589f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator> @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5926 of file json.hpp.

    +

    Definition at line 6067 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a1cba94e5a67ee52bc66b898a4e08359d.html b/classnlohmann_1_1basic__json_1_1const__iterator_a1cba94e5a67ee52bc66b898a4e08359d.html index 8868117d2..4e0d0ecc4 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a1cba94e5a67ee52bc66b898a4e08359d.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a1cba94e5a67ee52bc66b898a4e08359d.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator[] @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6008 of file json.hpp.

    +

    Definition at line 6153 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a211523a57024a43965862b497b89ab91.html b/classnlohmann_1_1basic__json_1_1const__iterator_a211523a57024a43965862b497b89ab91.html index 5f6b0804c..de6f614b5 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a211523a57024a43965862b497b89ab91.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a211523a57024a43965862b497b89ab91.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator= @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5653 of file json.hpp.

    +

    Definition at line 5766 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a301749e9779adafd395369ac36df93df.html b/classnlohmann_1_1basic__json_1_1const__iterator_a301749e9779adafd395369ac36df93df.html index a777f4a28..1c6f7b59d 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a301749e9779adafd395369ac36df93df.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a301749e9779adafd395369ac36df93df.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator-> @@ -33,7 +33,7 @@ - + @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5759 of file json.hpp.

    +

    Definition at line 5886 of file json.hpp.

    @@ -152,9 +152,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a36086a699b95e06976c11367b7d6ba53.html b/classnlohmann_1_1basic__json_1_1const__iterator_a36086a699b95e06976c11367b7d6ba53.html index 7407d372c..ee62447c9 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a36086a699b95e06976c11367b7d6ba53.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a36086a699b95e06976c11367b7d6ba53.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator== @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5858 of file json.hpp.

    +

    Definition at line 5995 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a4632d8307fc315f21e2ecc9ba5aa6346.html b/classnlohmann_1_1basic__json_1_1const__iterator_a4632d8307fc315f21e2ecc9ba5aa6346.html index 42b3919be..803fbbbeb 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a4632d8307fc315f21e2ecc9ba5aa6346.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a4632d8307fc315f21e2ecc9ba5aa6346.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator* @@ -33,7 +33,7 @@ - + @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5725 of file json.hpp.

    +

    Definition at line 5846 of file json.hpp.

    @@ -152,9 +152,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a4f7ac43b0ab34c387b1ae1a8e9c08467.html b/classnlohmann_1_1basic__json_1_1const__iterator_a4f7ac43b0ab34c387b1ae1a8e9c08467.html index 56c287dc6..4c63f33bb 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a4f7ac43b0ab34c387b1ae1a8e9c08467.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a4f7ac43b0ab34c387b1ae1a8e9c08467.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::pointer @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5588 of file json.hpp.

    +

    Definition at line 5697 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a5aff013c03c1bdc248346c249bec7b67.html b/classnlohmann_1_1basic__json_1_1const__iterator_a5aff013c03c1bdc248346c249bec7b67.html index 7bd8de6f8..7e4ef1720 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a5aff013c03c1bdc248346c249bec7b67.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a5aff013c03c1bdc248346c249bec7b67.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::const_iterator @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5623 of file json.hpp.

    +

    Definition at line 5734 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a62cad59e006eb7fa594c2c5b65a76610.html b/classnlohmann_1_1basic__json_1_1const__iterator_a62cad59e006eb7fa594c2c5b65a76610.html index 56416ee17..7997f7143 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a62cad59e006eb7fa594c2c5b65a76610.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a62cad59e006eb7fa594c2c5b65a76610.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator- @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5978 of file json.hpp.

    +

    Definition at line 6121 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a67848d4b7bfa576434ad9807147b5870.html b/classnlohmann_1_1basic__json_1_1const__iterator_a67848d4b7bfa576434ad9807147b5870.html index ba16b47af..e048dd2b2 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a67848d4b7bfa576434ad9807147b5870.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a67848d4b7bfa576434ad9807147b5870.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::value_type @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5584 of file json.hpp.

    +

    Definition at line 5693 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a6b3e43d2f45fa611825dbdf4e88fffe2.html b/classnlohmann_1_1basic__json_1_1const__iterator_a6b3e43d2f45fa611825dbdf4e88fffe2.html index 021777b86..6985b163b 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a6b3e43d2f45fa611825dbdf4e88fffe2.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a6b3e43d2f45fa611825dbdf4e88fffe2.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator>= @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5932 of file json.hpp.

    +

    Definition at line 6073 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a83454954e4e16be3d5316f9322e91a34.html b/classnlohmann_1_1basic__json_1_1const__iterator_a83454954e4e16be3d5316f9322e91a34.html index 84e8e39ac..aebaa3ad2 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a83454954e4e16be3d5316f9322e91a34.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a83454954e4e16be3d5316f9322e91a34.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::const_iterator @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5598 of file json.hpp.

    +

    Definition at line 5707 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a86a1771e6658d0b14868df6c197d2353.html b/classnlohmann_1_1basic__json_1_1const__iterator_a86a1771e6658d0b14868df6c197d2353.html index 9e3cd1c1c..e1002ac1b 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a86a1771e6658d0b14868df6c197d2353.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a86a1771e6658d0b14868df6c197d2353.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::const_iterator @@ -33,7 +33,7 @@ - + @@ -150,9 +150,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_a8d024cbc99db0d8106899f9fd9973735.html b/classnlohmann_1_1basic__json_1_1const__iterator_a8d024cbc99db0d8106899f9fd9973735.html index ad0937223..d4fbbd599 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a8d024cbc99db0d8106899f9fd9973735.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a8d024cbc99db0d8106899f9fd9973735.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::key @@ -33,7 +33,7 @@ - + @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6042 of file json.hpp.

    +

    Definition at line 6189 of file json.hpp.

    @@ -152,9 +152,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_ab74b39747a9dad60650a57133fca85b3.html b/classnlohmann_1_1basic__json_1_1const__iterator_ab74b39747a9dad60650a57133fca85b3.html index 627351246..d4f11fce7 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ab74b39747a9dad60650a57133fca85b3.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ab74b39747a9dad60650a57133fca85b3.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator+= @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5938 of file json.hpp.

    +

    Definition at line 6079 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_ab7dacd8e3ee9b3756bfcdb87dd55a515.html b/classnlohmann_1_1basic__json_1_1const__iterator_ab7dacd8e3ee9b3756bfcdb87dd55a515.html index 64320571f..3aca44af8 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ab7dacd8e3ee9b3756bfcdb87dd55a515.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ab7dacd8e3ee9b3756bfcdb87dd55a515.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::value @@ -33,7 +33,7 @@ - + @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6055 of file json.hpp.

    +

    Definition at line 6204 of file json.hpp.

    @@ -152,9 +152,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_ab9d31bf0d0b4d7310c858a04ce84a52f.html b/classnlohmann_1_1basic__json_1_1const__iterator_ab9d31bf0d0b4d7310c858a04ce84a52f.html index cae7f718f..cd2e49080 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ab9d31bf0d0b4d7310c858a04ce84a52f.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ab9d31bf0d0b4d7310c858a04ce84a52f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator!= @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5886 of file json.hpp.

    +

    Definition at line 6025 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_abb1921cbf0ad4036c83bc6303e22171f.html b/classnlohmann_1_1basic__json_1_1const__iterator_abb1921cbf0ad4036c83bc6303e22171f.html index e81eebd9e..3b7861d81 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_abb1921cbf0ad4036c83bc6303e22171f.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_abb1921cbf0ad4036c83bc6303e22171f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator-- @@ -33,7 +33,7 @@ - + @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5831 of file json.hpp.

    +

    Definition at line 5966 of file json.hpp.

    @@ -152,9 +152,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_abbacd95955c602efc9a58ed1ffdb46c4.html b/classnlohmann_1_1basic__json_1_1const__iterator_abbacd95955c602efc9a58ed1ffdb46c4.html index f650d6c79..4c873a30b 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_abbacd95955c602efc9a58ed1ffdb46c4.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_abbacd95955c602efc9a58ed1ffdb46c4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator++ @@ -33,7 +33,7 @@ - + @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5796 of file json.hpp.

    +

    Definition at line 5929 of file json.hpp.

    @@ -152,9 +152,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_ac36b9187de43721a4bf1b052578bb80b.html b/classnlohmann_1_1basic__json_1_1const__iterator_ac36b9187de43721a4bf1b052578bb80b.html index 599b24177..7e19e764a 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ac36b9187de43721a4bf1b052578bb80b.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ac36b9187de43721a4bf1b052578bb80b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::difference_type @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5586 of file json.hpp.

    +

    Definition at line 5695 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_ac634a659837f5aebc97125e031de23b5.html b/classnlohmann_1_1basic__json_1_1const__iterator_ac634a659837f5aebc97125e031de23b5.html index f28d03efe..7e338e3d3 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ac634a659837f5aebc97125e031de23b5.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ac634a659837f5aebc97125e031de23b5.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator+ @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5970 of file json.hpp.

    +

    Definition at line 6113 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_acea5b75d1087e2a92833946d9dc547ff.html b/classnlohmann_1_1basic__json_1_1const__iterator_acea5b75d1087e2a92833946d9dc547ff.html index 146df1b11..17de1b9f4 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_acea5b75d1087e2a92833946d9dc547ff.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_acea5b75d1087e2a92833946d9dc547ff.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator< @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5892 of file json.hpp.

    +

    Definition at line 6031 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_ada3100cdb8700566051828f1355fa745.html b/classnlohmann_1_1basic__json_1_1const__iterator_ada3100cdb8700566051828f1355fa745.html index b52e8ef22..a27fdcc5d 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ada3100cdb8700566051828f1355fa745.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ada3100cdb8700566051828f1355fa745.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::basic_json @@ -33,7 +33,7 @@ - + @@ -139,7 +139,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5580 of file json.hpp.

    +

    Definition at line 5689 of file json.hpp.

    @@ -149,9 +149,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_adb50d6043ace464d9f694869724d7fb2.html b/classnlohmann_1_1basic__json_1_1const__iterator_adb50d6043ace464d9f694869724d7fb2.html index 7ad956ee2..b10196ab6 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_adb50d6043ace464d9f694869724d7fb2.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_adb50d6043ace464d9f694869724d7fb2.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::reference @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5590 of file json.hpp.

    +

    Definition at line 5699 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_adda9a4bd7f0edb9cb39dc0dca3d4a286.html b/classnlohmann_1_1basic__json_1_1const__iterator_adda9a4bd7f0edb9cb39dc0dca3d4a286.html index 3b2164a14..938b805ba 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_adda9a4bd7f0edb9cb39dc0dca3d4a286.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_adda9a4bd7f0edb9cb39dc0dca3d4a286.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator- @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5986 of file json.hpp.

    +

    Definition at line 6129 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html b/classnlohmann_1_1basic__json_1_1const__iterator_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html index b6ec7309c..1d3fcec7f 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator++ @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5788 of file json.hpp.

    +

    Definition at line 5921 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_ae480d5c86e5e1129d53d1e19782017a6.html b/classnlohmann_1_1basic__json_1_1const__iterator_ae480d5c86e5e1129d53d1e19782017a6.html index 24c457165..82f91b7d0 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ae480d5c86e5e1129d53d1e19782017a6.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ae480d5c86e5e1129d53d1e19782017a6.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::iterator_category @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5592 of file json.hpp.

    +

    Definition at line 5701 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_aebd099d9a70ffe760242ef24046c9002.html b/classnlohmann_1_1basic__json_1_1const__iterator_aebd099d9a70ffe760242ef24046c9002.html index 6f94555bf..43753fe63 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_aebd099d9a70ffe760242ef24046c9002.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_aebd099d9a70ffe760242ef24046c9002.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator<= @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5920 of file json.hpp.

    +

    Definition at line 6061 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_af34f68f1ce670e7f25ce267b2b1e64ab.html b/classnlohmann_1_1basic__json_1_1const__iterator_af34f68f1ce670e7f25ce267b2b1e64ab.html index 88ee19cbf..8e6e08723 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_af34f68f1ce670e7f25ce267b2b1e64ab.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_af34f68f1ce670e7f25ce267b2b1e64ab.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::operator-= @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5964 of file json.hpp.

    +

    Definition at line 6107 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1const__iterator_af55564e391b23e41abe78bc4bbe4edcb.html b/classnlohmann_1_1basic__json_1_1const__iterator_af55564e391b23e41abe78bc4bbe4edcb.html index 8d1a4bd59..acda5da29 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_af55564e391b23e41abe78bc4bbe4edcb.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_af55564e391b23e41abe78bc4bbe4edcb.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_iterator::const_iterator @@ -33,7 +33,7 @@ - + @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 5648 of file json.hpp.

    +

    Definition at line 5761 of file json.hpp.

    @@ -153,9 +153,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator-members.html b/classnlohmann_1_1basic__json_1_1iterator-members.html index 2a2f1d828..76162aba3 100644 --- a/classnlohmann_1_1basic__json_1_1iterator-members.html +++ b/classnlohmann_1_1basic__json_1_1iterator-members.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Member List @@ -33,7 +33,7 @@ - + @@ -135,9 +135,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classnlohmann_1_1basic__json_1_1iterator.html b/classnlohmann_1_1basic__json_1_1iterator.html index 91096cf8f..21db6cdff 100644 --- a/classnlohmann_1_1basic__json_1_1iterator.html +++ b/classnlohmann_1_1basic__json_1_1iterator.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator Class Reference @@ -33,7 +33,7 @@ - + @@ -266,13 +266,13 @@ class nlohmann::basic_json::iterator
    Since
    version 1.0.0
    -

    Definition at line 6079 of file json.hpp.

    +

    Definition at line 6228 of file json.hpp.

    diff --git a/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html b/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html index 521ca8f04..e51c2bce4 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator++ @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6132 of file json.hpp.

    +

    Definition at line 6281 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a0a43bd93e6e46645ed0b93d3af7bfe22.html b/classnlohmann_1_1basic__json_1_1iterator_a0a43bd93e6e46645ed0b93d3af7bfe22.html index 8dc6f8750..eea861c10 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a0a43bd93e6e46645ed0b93d3af7bfe22.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a0a43bd93e6e46645ed0b93d3af7bfe22.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator-= @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6161 of file json.hpp.

    +

    Definition at line 6310 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a0c0acb68cc2a50a0e8782f860184883f.html b/classnlohmann_1_1basic__json_1_1iterator_a0c0acb68cc2a50a0e8782f860184883f.html index a4b28b2c2..c90937417 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a0c0acb68cc2a50a0e8782f860184883f.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a0c0acb68cc2a50a0e8782f860184883f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator- @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6176 of file json.hpp.

    +

    Definition at line 6325 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a0eb7ac9b746fb6f931ae728f70f92a8e.html b/classnlohmann_1_1basic__json_1_1iterator_a0eb7ac9b746fb6f931ae728f70f92a8e.html index 05d0834ff..716fced49 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a0eb7ac9b746fb6f931ae728f70f92a8e.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a0eb7ac9b746fb6f931ae728f70f92a8e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator[] @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6189 of file json.hpp.

    +

    Definition at line 6338 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a1220b360a07b0605f7d2f4b3cfd16736.html b/classnlohmann_1_1basic__json_1_1iterator_a1220b360a07b0605f7d2f4b3cfd16736.html index 02071ec29..8e65cb361 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a1220b360a07b0605f7d2f4b3cfd16736.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a1220b360a07b0605f7d2f4b3cfd16736.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator-> @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6118 of file json.hpp.

    +

    Definition at line 6267 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a21d32a4547ba4cbadd8b435a6a0d0e1b.html b/classnlohmann_1_1basic__json_1_1iterator_a21d32a4547ba4cbadd8b435a6a0d0e1b.html index 456c7cfee..8103f363a 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a21d32a4547ba4cbadd8b435a6a0d0e1b.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a21d32a4547ba4cbadd8b435a6a0d0e1b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator-- @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6147 of file json.hpp.

    +

    Definition at line 6296 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a302d810a0685f8d39368eaa65c833acf.html b/classnlohmann_1_1basic__json_1_1iterator_a302d810a0685f8d39368eaa65c833acf.html index 15f4ec5a5..0195c4b4b 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a302d810a0685f8d39368eaa65c833acf.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a302d810a0685f8d39368eaa65c833acf.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator- @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6183 of file json.hpp.

    +

    Definition at line 6332 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a33277dbf06ac5c1e7102e26f6b5e2c00.html b/classnlohmann_1_1basic__json_1_1iterator_a33277dbf06ac5c1e7102e26f6b5e2c00.html index a790c01fb..5391b4156 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a33277dbf06ac5c1e7102e26f6b5e2c00.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a33277dbf06ac5c1e7102e26f6b5e2c00.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator* @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6112 of file json.hpp.

    +

    Definition at line 6261 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a4ae612fa9eb59784047b40f0419db65d.html b/classnlohmann_1_1basic__json_1_1iterator_a4ae612fa9eb59784047b40f0419db65d.html index ff5d7d42f..0d49f7518 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a4ae612fa9eb59784047b40f0419db65d.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a4ae612fa9eb59784047b40f0419db65d.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator-- @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6139 of file json.hpp.

    +

    Definition at line 6288 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a4f6e03ae3bb674ebf0b727f74957c12f.html b/classnlohmann_1_1basic__json_1_1iterator_a4f6e03ae3bb674ebf0b727f74957c12f.html index 8aada2c75..3fe6e82d9 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a4f6e03ae3bb674ebf0b727f74957c12f.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a4f6e03ae3bb674ebf0b727f74957c12f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::iterator @@ -33,7 +33,7 @@ - + @@ -139,9 +139,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html b/classnlohmann_1_1basic__json_1_1iterator_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html index e48269329..3ef5e5b84 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator= @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6100 of file json.hpp.

    +

    Definition at line 6249 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a7031e759ee52d1283aada0ff81108a5e.html b/classnlohmann_1_1basic__json_1_1iterator_a7031e759ee52d1283aada0ff81108a5e.html index 907cef2c0..d48abd08b 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a7031e759ee52d1283aada0ff81108a5e.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a7031e759ee52d1283aada0ff81108a5e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator+= @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6154 of file json.hpp.

    +

    Definition at line 6303 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a94285e2ade0bfef829b81377bbbca6cf.html b/classnlohmann_1_1basic__json_1_1iterator_a94285e2ade0bfef829b81377bbbca6cf.html index 14dd945cb..5677687b8 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a94285e2ade0bfef829b81377bbbca6cf.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a94285e2ade0bfef829b81377bbbca6cf.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::iterator @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6095 of file json.hpp.

    +

    Definition at line 6244 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a9fcfda575b08d0c73b6274cdbbe7f184.html b/classnlohmann_1_1basic__json_1_1iterator_a9fcfda575b08d0c73b6274cdbbe7f184.html index 55f42c350..904144218 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a9fcfda575b08d0c73b6274cdbbe7f184.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a9fcfda575b08d0c73b6274cdbbe7f184.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator++ @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6124 of file json.hpp.

    +

    Definition at line 6273 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_aa2bd10afdcfc70acb8eaabbd2f6496f0.html b/classnlohmann_1_1basic__json_1_1iterator_aa2bd10afdcfc70acb8eaabbd2f6496f0.html index a0768cf6b..67febffd8 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_aa2bd10afdcfc70acb8eaabbd2f6496f0.html +++ b/classnlohmann_1_1basic__json_1_1iterator_aa2bd10afdcfc70acb8eaabbd2f6496f0.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::reference @@ -33,7 +33,7 @@ - + @@ -120,7 +120,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6084 of file json.hpp.

    +

    Definition at line 6233 of file json.hpp.

    @@ -130,9 +130,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_ab220a0cc3fe410fbae4524208bd5834f.html b/classnlohmann_1_1basic__json_1_1iterator_ab220a0cc3fe410fbae4524208bd5834f.html index d6e79116b..ec1844e2f 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_ab220a0cc3fe410fbae4524208bd5834f.html +++ b/classnlohmann_1_1basic__json_1_1iterator_ab220a0cc3fe410fbae4524208bd5834f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::iterator @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6090 of file json.hpp.

    +

    Definition at line 6239 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html b/classnlohmann_1_1basic__json_1_1iterator_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html index 37c0f68a4..8b2d8a0fa 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html +++ b/classnlohmann_1_1basic__json_1_1iterator_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::operator+ @@ -33,7 +33,7 @@ - + @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6168 of file json.hpp.

    +

    Definition at line 6317 of file json.hpp.

    @@ -142,9 +142,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_abaebf4e21956dd20d9f862fa5647d32d.html b/classnlohmann_1_1basic__json_1_1iterator_abaebf4e21956dd20d9f862fa5647d32d.html index 32c712ab1..d037c71f4 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_abaebf4e21956dd20d9f862fa5647d32d.html +++ b/classnlohmann_1_1basic__json_1_1iterator_abaebf4e21956dd20d9f862fa5647d32d.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::base_iterator @@ -33,7 +33,7 @@ - + @@ -120,7 +120,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6082 of file json.hpp.

    +

    Definition at line 6231 of file json.hpp.

    @@ -130,9 +130,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_af64127418c567660d92b1afdfe9676db.html b/classnlohmann_1_1basic__json_1_1iterator_af64127418c567660d92b1afdfe9676db.html index 7a25796c3..3e53bad8f 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_af64127418c567660d92b1afdfe9676db.html +++ b/classnlohmann_1_1basic__json_1_1iterator_af64127418c567660d92b1afdfe9676db.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::value @@ -33,7 +33,7 @@ - + @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6195 of file json.hpp.

    +

    Definition at line 6344 of file json.hpp.

    @@ -141,9 +141,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html b/classnlohmann_1_1basic__json_1_1iterator_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html index 73712a6bd..08a63fd59 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html +++ b/classnlohmann_1_1basic__json_1_1iterator_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator::pointer @@ -33,7 +33,7 @@ - + @@ -120,7 +120,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 6083 of file json.hpp.

    +

    Definition at line 6232 of file json.hpp.

    @@ -130,9 +130,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator-members.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator-members.html index 5a9dbf392..3c8eddadb 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator-members.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator-members.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Member List @@ -33,7 +33,7 @@ - + @@ -112,9 +112,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator.html index d381069cd..0204464ef 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator< Base > Class Template Reference @@ -33,7 +33,7 @@ - + @@ -170,13 +170,13 @@ class nlohmann::basic_json::json_reverse_iterator< Base >
    Since
    version 1.0.0
    -

    Definition at line 232 of file json.hpp.

    +

    Definition at line 233 of file json.hpp.

    diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a03e542423284327d3801cf078f1c2b44.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a03e542423284327d3801cf078f1c2b44.html index 4bda7d4d8..29c7910d9 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a03e542423284327d3801cf078f1c2b44.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a03e542423284327d3801cf078f1c2b44.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator- @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6279 of file json.hpp.

    +

    Definition at line 6428 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a0b494ef7570d031216f907d2c85ec323.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a0b494ef7570d031216f907d2c85ec323.html index 61f555254..80af8dc0a 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a0b494ef7570d031216f907d2c85ec323.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a0b494ef7570d031216f907d2c85ec323.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::json_reverse_iterator @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6228 of file json.hpp.

    +

    Definition at line 6377 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a15e9cf4c5a43238e82ab69c4a295c491.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a15e9cf4c5a43238e82ab69c4a295c491.html index 107f556b0..43e6ba6f4 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a15e9cf4c5a43238e82ab69c4a295c491.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a15e9cf4c5a43238e82ab69c4a295c491.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator++ @@ -33,7 +33,7 @@ - + @@ -128,7 +128,7 @@ template<typename Base >
    -

    Definition at line 6244 of file json.hpp.

    +

    Definition at line 6393 of file json.hpp.

    @@ -138,9 +138,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a1c84e6d1f047ab4105fa665f455158a7.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a1c84e6d1f047ab4105fa665f455158a7.html index 827357eca..27112ebe0 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a1c84e6d1f047ab4105fa665f455158a7.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a1c84e6d1f047ab4105fa665f455158a7.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator+ @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6271 of file json.hpp.

    +

    Definition at line 6420 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a2a1dc92fbec862883c8b89755c787c99.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a2a1dc92fbec862883c8b89755c787c99.html index 3ca8e9d33..aa39892e2 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a2a1dc92fbec862883c8b89755c787c99.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a2a1dc92fbec862883c8b89755c787c99.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator+= @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6264 of file json.hpp.

    +

    Definition at line 6413 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a5ee9ec91a6ddcd8d72278d681361626f.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a5ee9ec91a6ddcd8d72278d681361626f.html index f507bbc9e..e7aa2d2fb 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a5ee9ec91a6ddcd8d72278d681361626f.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a5ee9ec91a6ddcd8d72278d681361626f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::reference @@ -33,7 +33,7 @@ - + @@ -117,7 +117,7 @@ template<typename Base >
    -

    Definition at line 6225 of file json.hpp.

    +

    Definition at line 6374 of file json.hpp.

    @@ -127,9 +127,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a61d31531e0dfc5448e7fa15678b05bbe.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a61d31531e0dfc5448e7fa15678b05bbe.html index a0cfb3cfa..433e6c6f1 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a61d31531e0dfc5448e7fa15678b05bbe.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a61d31531e0dfc5448e7fa15678b05bbe.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::value @@ -33,7 +33,7 @@ - + @@ -128,7 +128,7 @@ template<typename Base >
    -

    Definition at line 6306 of file json.hpp.

    +

    Definition at line 6455 of file json.hpp.

    @@ -138,9 +138,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a6bd38ed124df0332ba3263a9176b0101.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a6bd38ed124df0332ba3263a9176b0101.html index c6228d1c2..82d6f0287 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a6bd38ed124df0332ba3263a9176b0101.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a6bd38ed124df0332ba3263a9176b0101.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator-- @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6251 of file json.hpp.

    +

    Definition at line 6400 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a70086e392779ecbbc9e6845b2be126a0.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a70086e392779ecbbc9e6845b2be126a0.html index bdb0eb384..d76a50836 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a70086e392779ecbbc9e6845b2be126a0.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a70086e392779ecbbc9e6845b2be126a0.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::json_reverse_iterator @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6233 of file json.hpp.

    +

    Definition at line 6382 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_aa82b48aee07baee284f8340b37ec6864.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_aa82b48aee07baee284f8340b37ec6864.html index 25e6b9932..daa6fb261 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_aa82b48aee07baee284f8340b37ec6864.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_aa82b48aee07baee284f8340b37ec6864.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator++ @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6238 of file json.hpp.

    +

    Definition at line 6387 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ab6245ab29d8481ef2a2351c02cc31d4d.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ab6245ab29d8481ef2a2351c02cc31d4d.html index 7a6d7807e..fe3958cef 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ab6245ab29d8481ef2a2351c02cc31d4d.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ab6245ab29d8481ef2a2351c02cc31d4d.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::base_iterator @@ -33,7 +33,7 @@ - + @@ -117,7 +117,7 @@ template<typename Base >
    -

    Definition at line 6223 of file json.hpp.

    +

    Definition at line 6372 of file json.hpp.

    @@ -127,9 +127,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ac427d8f61858c13b7c16649bfbf75e76.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ac427d8f61858c13b7c16649bfbf75e76.html index 5bfc3f276..8a33e88f7 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ac427d8f61858c13b7c16649bfbf75e76.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ac427d8f61858c13b7c16649bfbf75e76.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator- @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6287 of file json.hpp.

    +

    Definition at line 6436 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ad3d6837b6f97065625c6c65f62f4b6d4.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ad3d6837b6f97065625c6c65f62f4b6d4.html index fd8f5d3f4..c63846f50 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ad3d6837b6f97065625c6c65f62f4b6d4.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ad3d6837b6f97065625c6c65f62f4b6d4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator-- @@ -33,7 +33,7 @@ - + @@ -128,7 +128,7 @@ template<typename Base >
    -

    Definition at line 6257 of file json.hpp.

    +

    Definition at line 6406 of file json.hpp.

    @@ -138,9 +138,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ae988bd36b7d098b1157871f83b2d6265.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ae988bd36b7d098b1157871f83b2d6265.html index 5d00cd661..c34228060 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ae988bd36b7d098b1157871f83b2d6265.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ae988bd36b7d098b1157871f83b2d6265.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::operator[] @@ -33,7 +33,7 @@ - + @@ -129,7 +129,7 @@ template<typename Base >
    -

    Definition at line 6293 of file json.hpp.

    +

    Definition at line 6442 of file json.hpp.

    @@ -139,9 +139,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_af972fce017b24906236ab235857a11a8.html b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_af972fce017b24906236ab235857a11a8.html index 10ba303f1..7a22c5d40 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_af972fce017b24906236ab235857a11a8.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_af972fce017b24906236ab235857a11a8.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::json_reverse_iterator::key @@ -33,7 +33,7 @@ - + @@ -128,7 +128,7 @@ template<typename Base >
    -

    Definition at line 6299 of file json.hpp.

    +

    Definition at line 6448 of file json.hpp.

    @@ -138,9 +138,9 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html b/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html index 52e0608a7..298b3b7d6 100644 --- a/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html +++ b/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::count @@ -33,7 +33,7 @@ - + @@ -259,33 +259,15 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    Number of elements with key key. If the JSON value is not an object, the return value will be 0.
    Complexity
    Logarithmic in the size of the JSON object.
    -
    Example
    The example shows how count is used.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  json j_object = {{"one", 1}, {"two", 2}};
    -
    9 
    -
    10  // call find
    -
    11  auto count_two = j_object.count("two");
    -
    12  auto count_three = j_object.count("three");
    -
    13 
    -
    14  // print values
    -
    15  std::cout << std::boolalpha;
    -
    16  std::cout << "number of elements with key \"two\": " << count_two << '\n';
    -
    17  std::cout << "number of elements with key \"three\": " << count_three << '\n';
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    size_type count(typename object_t::key_type key) const
    returns the number of occurrences of a key in a JSON object
    Definition: json.hpp:3546
    +
    Example
    The example shows how count is used.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  json j_object = {{"one", 1}, {"two", 2}};
    9 
    10  // call find
    11  auto count_two = j_object.count("two");
    12  auto count_three = j_object.count("three");
    13 
    14  // print values
    15  std::cout << std::boolalpha;
    16  std::cout << "number of elements with key \"two\": " << count_two << '\n';
    17  std::cout << "number of elements with key \"three\": " << count_three << '\n';
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    size_type count(typename object_t::key_type key) const
    returns the number of occurrences of a key in a JSON object
    Definition: json.hpp:3584
    Output (play with this example online):
    number of elements with key "two": 1
     number of elements with key "three": 0
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/count.cpp -o count 
    Since
    version 1.0.0
    -

    Definition at line 3546 of file json.hpp.

    +

    Definition at line 3584 of file json.hpp.

    @@ -295,9 +277,9 @@ number of elements with key "three": 0 diff --git a/classnlohmann_1_1basic__json_a0703ae5cbd2daac5e6c0ae01d3a1b114.html b/classnlohmann_1_1basic__json_a0703ae5cbd2daac5e6c0ae01d3a1b114.html index 3b081126a..814cf521b 100644 --- a/classnlohmann_1_1basic__json_a0703ae5cbd2daac5e6c0ae01d3a1b114.html +++ b/classnlohmann_1_1basic__json_a0703ae5cbd2daac5e6c0ae01d3a1b114.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator+= @@ -33,7 +33,7 @@ - + @@ -264,33 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Logarithmic in the size of the container, O(log(size())).
    -
    Example
    The example shows how push_back and += can be used to add elements to a JSON object. Note how the null value was silently converted to a JSON object.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json object = {{"one", 1}, {"two", 2}};
    -
    9  json null;
    -
    10 
    -
    11  // print values
    -
    12  std::cout << object << '\n';
    -
    13  std::cout << null << '\n';
    -
    14 
    -
    15  // add values
    -
    16  object.push_back(json::object_t::value_type("three", 3));
    -
    17  object += json::object_t::value_type("four", 4);
    -
    18  null += json::object_t::value_type("A", "a");
    -
    19  null += json::object_t::value_type("B", "b");
    -
    20 
    -
    21  // print values
    -
    22  std::cout << object << '\n';
    -
    23  std::cout << null << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4095
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how push_back and += can be used to add elements to a JSON object. Note how the null value was silently converted to a JSON object.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json object = {{"one", 1}, {"two", 2}};
    9  json null;
    10 
    11  // print values
    12  std::cout << object << '\n';
    13  std::cout << null << '\n';
    14 
    15  // add values
    16  object.push_back(json::object_t::value_type("three", 3));
    17  object += json::object_t::value_type("four", 4);
    18  null += json::object_t::value_type("A", "a");
    19  null += json::object_t::value_type("B", "b");
    20 
    21  // print values
    22  std::cout << object << '\n';
    23  std::cout << null << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4143
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {"one":1,"two":2}
     null
     {"four":4,"one":1,"three":3,"two":2}
    @@ -298,7 +274,7 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/push_back__object_t__value.cpp -o push_back__object_t__value 
    Since
    version 1.0.0
    -

    Definition at line 4202 of file json.hpp.

    +

    Definition at line 4253 of file json.hpp.

    @@ -308,9 +284,9 @@ null diff --git a/classnlohmann_1_1basic__json_a07c9c38a1f01675759e05d5d34627343.html b/classnlohmann_1_1basic__json_a07c9c38a1f01675759e05d5d34627343.html index 0d09e8837..71996a71c 100644 --- a/classnlohmann_1_1basic__json_a07c9c38a1f01675759e05d5d34627343.html +++ b/classnlohmann_1_1basic__json_a07c9c38a1f01675759e05d5d34627343.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::insert @@ -33,7 +33,7 @@ - + @@ -277,32 +277,16 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Constant plus linear in the distance between pos and end of the container.
    -
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON array
    -
    8  json v = {1, 2, 3, 4};
    -
    9 
    -
    10  // insert number 10 before number 3
    -
    11  auto new_pos = v.insert(v.begin() + 2, 10);
    -
    12 
    -
    13  // output new array and result of insert call
    -
    14  std::cout << *new_pos << '\n';
    -
    15  std::cout << v << '\n';
    -
    16 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3580
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4230
    +
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON array
    8  json v = {1, 2, 3, 4};
    9 
    10  // insert number 10 before number 3
    11  auto new_pos = v.insert(v.begin() + 2, 10);
    12 
    13  // output new array and result of insert call
    14  std::cout << *new_pos << '\n';
    15  std::cout << v << '\n';
    16 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3619
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4281
    Output (play with this example online):
    10
     [1,2,10,3,4]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/insert.cpp -o insert 
    Since
    version 1.0.0
    -

    Definition at line 4256 of file json.hpp.

    +

    Definition at line 4308 of file json.hpp.

    @@ -312,9 +296,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html b/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html index e7981cba8..d3dc55ec2 100644 --- a/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html +++ b/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_string @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON value is a string.

    Returns
    true if type is string, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_string for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_string()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_string() << '\n';
    -
    19  std::cout << j_boolean.is_string() << '\n';
    -
    20  std::cout << j_number_integer.is_string() << '\n';
    -
    21  std::cout << j_number_float.is_string() << '\n';
    -
    22  std::cout << j_object.is_string() << '\n';
    -
    23  std::cout << j_array.is_string() << '\n';
    -
    24  std::cout << j_string.is_string() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    bool is_string() const noexcept
    return whether value is a string
    Definition: json.hpp:2103
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code exemplifies is_string for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_string()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_string() << '\n';
    19  std::cout << j_boolean.is_string() << '\n';
    20  std::cout << j_number_integer.is_string() << '\n';
    21  std::cout << j_number_float.is_string() << '\n';
    22  std::cout << j_object.is_string() << '\n';
    23  std::cout << j_array.is_string() << '\n';
    24  std::cout << j_string.is_string() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    bool is_string() const noexcept
    return whether value is a string
    Definition: json.hpp:2114
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    false
     false
     false
    @@ -290,7 +265,7 @@ true
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_string.cpp -o is_string 
    Since
    version 1.0.0
    -

    Definition at line 2103 of file json.hpp.

    +

    Definition at line 2114 of file json.hpp.

    @@ -300,9 +275,9 @@ true diff --git a/classnlohmann_1_1basic__json_a0afa4512f03406db0d0432657e9c7361.html b/classnlohmann_1_1basic__json_a0afa4512f03406db0d0432657e9c7361.html index 3677507ef..b335dd63d 100644 --- a/classnlohmann_1_1basic__json_a0afa4512f03406db0d0432657e9c7361.html +++ b/classnlohmann_1_1basic__json_a0afa4512f03406db0d0432657e9c7361.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -280,33 +280,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows the constructor for different value_t values
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create the different JSON values with default values
    - -
    9  json j_boolean(json::value_t::boolean);
    -
    10  json j_number_integer(json::value_t::number_integer);
    -
    11  json j_number_float(json::value_t::number_float);
    -
    12  json j_object(json::value_t::object);
    -
    13  json j_array(json::value_t::array);
    -
    14  json j_string(json::value_t::string);
    -
    15 
    -
    16  // serialize the JSON values
    -
    17  std::cout << j_null << '\n';
    -
    18  std::cout << j_boolean << '\n';
    -
    19  std::cout << j_number_integer << '\n';
    -
    20  std::cout << j_number_float << '\n';
    -
    21  std::cout << j_object << '\n';
    -
    22  std::cout << j_array << '\n';
    -
    23  std::cout << j_string << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code shows the constructor for different value_t values
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create the different JSON values with default values
    9  json j_boolean(json::value_t::boolean);
    10  json j_number_integer(json::value_t::number_integer);
    11  json j_number_float(json::value_t::number_float);
    12  json j_object(json::value_t::object);
    13  json j_array(json::value_t::array);
    14  json j_string(json::value_t::string);
    15 
    16  // serialize the JSON values
    17  std::cout << j_null << '\n';
    18  std::cout << j_boolean << '\n';
    19  std::cout << j_number_integer << '\n';
    20  std::cout << j_number_float << '\n';
    21  std::cout << j_object << '\n';
    22  std::cout << j_array << '\n';
    23  std::cout << j_string << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    @@ -336,7 +312,7 @@ false basic_json(const number_integer_t) – create a number (integer) value
    Since
    version 1.0.0
    -

    Definition at line 866 of file json.hpp.

    +

    Definition at line 867 of file json.hpp.

    @@ -346,9 +322,9 @@ false diff --git a/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html b/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html index d25b1016d..8400c2234 100644 --- a/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html +++ b/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_null @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON value is null.

    Returns
    true if type is null, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_null for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_null()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_null() << '\n';
    -
    19  std::cout << j_boolean.is_null() << '\n';
    -
    20  std::cout << j_number_integer.is_null() << '\n';
    -
    21  std::cout << j_number_float.is_null() << '\n';
    -
    22  std::cout << j_object.is_null() << '\n';
    -
    23  std::cout << j_array.is_null() << '\n';
    -
    24  std::cout << j_string.is_null() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    bool is_null() const noexcept
    return whether value is null
    Definition: json.hpp:1957
    +
    Example
    The following code exemplifies is_null for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_null()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_null() << '\n';
    19  std::cout << j_boolean.is_null() << '\n';
    20  std::cout << j_number_integer.is_null() << '\n';
    21  std::cout << j_number_float.is_null() << '\n';
    22  std::cout << j_object.is_null() << '\n';
    23  std::cout << j_array.is_null() << '\n';
    24  std::cout << j_string.is_null() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    bool is_null() const noexcept
    return whether value is null
    Definition: json.hpp:1968
    Output (play with this example online):
    true
     false
     false
    @@ -290,7 +265,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_null.cpp -o is_null 
    Since
    version 1.0.0
    -

    Definition at line 1957 of file json.hpp.

    +

    Definition at line 1968 of file json.hpp.

    @@ -300,9 +275,9 @@ false diff --git a/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html b/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html index 58a8953ad..962207691 100644 --- a/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html +++ b/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_array @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON value is an array.

    Returns
    true if type is array, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_array for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_array()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_array() << '\n';
    -
    19  std::cout << j_boolean.is_array() << '\n';
    -
    20  std::cout << j_number_integer.is_array() << '\n';
    -
    21  std::cout << j_number_float.is_array() << '\n';
    -
    22  std::cout << j_object.is_array() << '\n';
    -
    23  std::cout << j_array.is_array() << '\n';
    -
    24  std::cout << j_string.is_array() << '\n';
    -
    25 }
    -
    bool is_array() const noexcept
    return whether value is an array
    Definition: json.hpp:2084
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code exemplifies is_array for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_array()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_array() << '\n';
    19  std::cout << j_boolean.is_array() << '\n';
    20  std::cout << j_number_integer.is_array() << '\n';
    21  std::cout << j_number_float.is_array() << '\n';
    22  std::cout << j_object.is_array() << '\n';
    23  std::cout << j_array.is_array() << '\n';
    24  std::cout << j_string.is_array() << '\n';
    25 }
    bool is_array() const noexcept
    return whether value is an array
    Definition: json.hpp:2095
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    false
     false
     false
    @@ -290,7 +265,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_array.cpp -o is_array 
    Since
    version 1.0.0
    -

    Definition at line 2084 of file json.hpp.

    +

    Definition at line 2095 of file json.hpp.

    @@ -300,9 +275,9 @@ false diff --git a/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html b/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html index dc8185ad8..aad8713c3 100644 --- a/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html +++ b/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator== @@ -33,7 +33,7 @@ - + @@ -274,31 +274,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether the values lhs and rhs are equal
    Complexity
    Linear.
    -
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array_1 = {1, 2, 3};
    -
    9  json array_2 = {1, 2, 4};
    -
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    -
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    -
    12  json number_1 = 17;
    -
    13  json number_2 = 17.000000000000001L;
    -
    14  json string_1 = "foo";
    -
    15  json string_2 = "bar";
    -
    16 
    -
    17  // output values and comparisons
    -
    18  std::cout << std::boolalpha;
    -
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 == array_2) << '\n';
    -
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 == object_2) << '\n';
    -
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 == number_2) << '\n';
    -
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 == string_2) << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array_1 = {1, 2, 3};
    9  json array_2 = {1, 2, 4};
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    12  json number_1 = 17;
    13  json number_2 = 17.000000000000001L;
    14  json string_1 = "foo";
    15  json string_2 = "bar";
    16 
    17  // output values and comparisons
    18  std::cout << std::boolalpha;
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 == array_2) << '\n';
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 == object_2) << '\n';
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 == number_2) << '\n';
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 == string_2) << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3] == [1,2,4] false
     {"A":"a","B":"b"} == {"A":"a","B":"b"} true
     17 == 17 true
    @@ -306,7 +283,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__equal.cpp -o operator__equal 
    Since
    version 1.0.0
    -

    Definition at line 4607 of file json.hpp.

    +

    Definition at line 4665 of file json.hpp.

    @@ -316,9 +293,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a13e5642dbfa1602c937d295a085413cc.html b/classnlohmann_1_1basic__json_a13e5642dbfa1602c937d295a085413cc.html index 6c6ed8a72..bc11d5c8c 100644 --- a/classnlohmann_1_1basic__json_a13e5642dbfa1602c937d295a085413cc.html +++ b/classnlohmann_1_1basic__json_a13e5642dbfa1602c937d295a085413cc.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_pointer @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 229 of file json.hpp.

    +

    Definition at line 230 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a1683189bd539313b5559f07961166c8b.html b/classnlohmann_1_1basic__json_a1683189bd539313b5559f07961166c8b.html index d0854fcf6..3dd13dcfa 100644 --- a/classnlohmann_1_1basic__json_a1683189bd539313b5559f07961166c8b.html +++ b/classnlohmann_1_1basic__json_a1683189bd539313b5559f07961166c8b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::reverse_iterator @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 239 of file json.hpp.

    +

    Definition at line 240 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a16a275d0201e9aedc87c933c764b8869.html b/classnlohmann_1_1basic__json_a16a275d0201e9aedc87c933c764b8869.html index a667bca57..c18456d61 100644 --- a/classnlohmann_1_1basic__json_a16a275d0201e9aedc87c933c764b8869.html +++ b/classnlohmann_1_1basic__json_a16a275d0201e9aedc87c933c764b8869.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::at @@ -33,7 +33,7 @@ - + @@ -266,36 +266,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be read using at.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON object
    -
    8  json object =
    -
    9  {
    -
    10  {"the good", "il buono"},
    -
    11  {"the bad", "il cativo"},
    -
    12  {"the ugly", "il brutto"}
    -
    13  };
    -
    14 
    -
    15  // output element with key "the ugly"
    -
    16  std::cout << object.at("the ugly") << '\n';
    -
    17 
    -
    18  // try to read from a nonexisting key
    -
    19  try
    -
    20  {
    -
    21  std::cout << object.at("the fast") << '\n';
    -
    22  }
    -
    23  catch (std::out_of_range)
    -
    24  {
    -
    25  std::cout << "out of range" << '\n';
    -
    26  }
    -
    27 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2620
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be read using at.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON object
    8  json object =
    9  {
    10  {"the good", "il buono"},
    11  {"the bad", "il cativo"},
    12  {"the ugly", "il brutto"}
    13  };
    14 
    15  // output element with key "the ugly"
    16  std::cout << object.at("the ugly") << '\n';
    17 
    18  // try to read from a nonexisting key
    19  try
    20  {
    21  std::cout << object.at("the fast") << '\n';
    22  }
    23  catch (std::out_of_range)
    24  {
    25  std::cout << "out of range" << '\n';
    26  }
    27 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2638
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "il brutto"
     out of range
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/at__object_t_key_type_const.cpp -o at__object_t_key_type_const 
    @@ -304,7 +277,7 @@ out of range value() for access by value with a default value
    Since
    version 1.0.0
    -

    Definition at line 2757 of file json.hpp.

    +

    Definition at line 2778 of file json.hpp.

    @@ -314,9 +287,9 @@ out of range diff --git a/classnlohmann_1_1basic__json_a1dc0c521042807e216d11110d2f002ff.html b/classnlohmann_1_1basic__json_a1dc0c521042807e216d11110d2f002ff.html index 3f5b0aff8..dd705c1b1 100644 --- a/classnlohmann_1_1basic__json_a1dc0c521042807e216d11110d2f002ff.html +++ b/classnlohmann_1_1basic__json_a1dc0c521042807e216d11110d2f002ff.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -272,23 +272,8 @@ template<class CompatibleStringType , typename std::enable_if<
    -
    Example
    The following code shows the construction of a string value from a compatible type.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a string value
    -
    8  std::string s = "The quick brown fox jumps over the lazy dog.";
    -
    9 
    -
    10  // create a JSON string value
    -
    11  json j = s;
    -
    12 
    -
    13  // serialize the JSON string
    -
    14  std::cout << j << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the construction of a string value from a compatible type.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a string value
    8  std::string s = "The quick brown fox jumps over the lazy dog.";
    9 
    10  // create a JSON string value
    11  json j = s;
    12 
    13  // serialize the JSON string
    14  std::cout << j << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "The quick brown fox jumps over the lazy dog."
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__CompatibleStringType.cpp -o basic_json__CompatibleStringType 
    See also
    basic_json(const string_t&) – create a string value
    @@ -296,7 +281,7 @@ template<class CompatibleStringType , typename std::enable_if< basic_json(const typename string_t::value_type*) – create a string value from a character pointer
    Since
    version 1.0.0
    -

    Definition at line 1113 of file json.hpp.

    +

    Definition at line 1114 of file json.hpp.

    @@ -306,9 +291,9 @@ template<class CompatibleStringType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html b/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html index 1449059a3..05677b96f 100644 --- a/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html +++ b/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::value_t @@ -33,7 +33,7 @@ - + @@ -275,7 +275,7 @@ template<template< typename U, typename V, typename...Args > class Obje -

    Definition at line 611 of file json.hpp.

    +

    Definition at line 612 of file json.hpp.

    @@ -285,9 +285,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a234f03dce002783748ca401a42bc6472.html b/classnlohmann_1_1basic__json_a234f03dce002783748ca401a42bc6472.html index 227140824..8d963496b 100644 --- a/classnlohmann_1_1basic__json_a234f03dce002783748ca401a42bc6472.html +++ b/classnlohmann_1_1basic__json_a234f03dce002783748ca401a42bc6472.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::get_ptr @@ -33,7 +33,7 @@ - + @@ -251,7 +251,7 @@ template<typename PointerType , typename std::enable_if<
    -

    get a pointer value (implicit) Implict pointer access to the internally stored JSON value. No copies are made.

    +

    get a pointer value (implicit) Implicit pointer access to the internally stored JSON value. No copies are made.

    Warning
    Writing data to the pointee of the result yields an undefined state.
    Template Parameters
    @@ -261,38 +261,17 @@ template<typename PointerType , typename std::enable_if<
    Returns
    pointer to the internally stored JSON value if the requested pointer type PointerType fits to the JSON value; nullptr otherwise
    Complexity
    Constant.
    -
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON number
    -
    8  json value = 17;
    -
    9 
    -
    10  // explicitly getting pointers
    -
    11  auto p1 = value.get_ptr<const json::number_integer_t*>();
    -
    12  auto p2 = value.get_ptr<json::number_integer_t*>();
    -
    13  auto p3 = value.get_ptr<json::number_integer_t* const>();
    -
    14  auto p4 = value.get_ptr<const json::number_integer_t* const>();
    -
    15  auto p5 = value.get_ptr<json::number_float_t*>();
    -
    16 
    -
    17  // print the pointees
    -
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    -
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    -
    20 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    PointerType get_ptr() noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2527
    -
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:527
    -
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:592
    +
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON number
    8  json value = 17;
    9 
    10  // explicitly getting pointers
    11  auto p1 = value.get_ptr<const json::number_integer_t*>();
    12  auto p2 = value.get_ptr<json::number_integer_t*>();
    13  auto p3 = value.get_ptr<json::number_integer_t* const>();
    14  auto p4 = value.get_ptr<const json::number_integer_t* const>();
    15  auto p5 = value.get_ptr<json::number_float_t*>();
    16 
    17  // print the pointees
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    20 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    PointerType get_ptr() noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2545
    +
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:528
    +
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:593
    Output (play with this example online):
    17 17 17 17
     true
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/get_ptr.cpp -o get_ptr 
    Since
    version 1.0.0
    -

    Definition at line 2542 of file json.hpp.

    +

    Definition at line 2560 of file json.hpp.

    @@ -302,9 +281,9 @@ true diff --git a/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html b/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html index 98e7df2b1..eb54290f8 100644 --- a/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html +++ b/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator[] @@ -33,7 +33,7 @@
    - + @@ -270,38 +270,8 @@ This function is required for compatibility reasons with Clang.
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be read and written using the [] operator.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  json object =
    -
    9  {
    -
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    -
    11  };
    -
    12 
    -
    13  // output element with key "two"
    -
    14  std::cout << object["two"] << "\n\n";
    -
    15 
    -
    16  // change element with key "three"
    -
    17  object["three"] = 3;
    -
    18 
    -
    19  // output changed array
    -
    20  std::cout << std::setw(4) << object << "\n\n";
    -
    21 
    -
    22  // mention nonexisting key
    -
    23  object["four"];
    -
    24 
    -
    25  // write to nonexisting key
    -
    26  object["five"]["really"]["nested"] = true;
    -
    27 
    -
    28  // output changed object
    -
    29  std::cout << std::setw(4) << object << '\n';
    -
    30 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be read and written using the [] operator.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  json object =
    9  {
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    11  };
    12 
    13  // output element with key "two"
    14  std::cout << object["two"] << "\n\n";
    15 
    16  // change element with key "three"
    17  object["three"] = 3;
    18 
    19  // output changed array
    20  std::cout << std::setw(4) << object << "\n\n";
    21 
    22  // mention nonexisting key
    23  object["four"];
    24 
    25  // write to nonexisting key
    26  object["five"]["really"]["nested"] = true;
    27 
    28  // output changed object
    29  std::cout << std::setw(4) << object << '\n';
    30 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    2
     
     {
    @@ -327,7 +297,7 @@ This function is required for compatibility reasons with Clang.
    value() for access by value with a default value
    Since
    version 1.0.0
    -

    Definition at line 2977 of file json.hpp.

    +

    Definition at line 3004 of file json.hpp.

    @@ -337,9 +307,9 @@ This function is required for compatibility reasons with Clang. diff --git a/classnlohmann_1_1basic__json_a26b7e4876af25eae5800ce43f93aaef2.html b/classnlohmann_1_1basic__json_a26b7e4876af25eae5800ce43f93aaef2.html index 2f5ce7d95..9e45fc1a8 100644 --- a/classnlohmann_1_1basic__json_a26b7e4876af25eae5800ce43f93aaef2.html +++ b/classnlohmann_1_1basic__json_a26b7e4876af25eae5800ce43f93aaef2.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::value @@ -33,7 +33,7 @@ - + @@ -263,12 +263,7 @@ template<class ValueType , typename std::enable_if<

    Returns either a copy of an object's element at the specified key key or a given default value if no element with key key exists.

    -

    The function is basically equivalent to executing

    try {
    -
    return at(key);
    -
    } catch(std::out_of_range) {
    -
    return default_value;
    -
    }
    -
    Note
    Unlike at(const typename object_t::key_type&), this function does not throw if the given key key was not found.
    +

    The function is basically equivalent to executing

    try {
    return at(key);
    } catch(std::out_of_range) {
    return default_value;
    }
    Note
    Unlike at(const typename object_t::key_type&), this function does not throw if the given key key was not found.
    Unlike operator[](const typename object_t::key_type& key), this function does not implicitly add an element to the position defined by key. This function is furthermore also applicable to const objects.
    Parameters
    @@ -293,38 +288,9 @@ value() with null"
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be queried with a default value.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object with different entry types
    -
    8  json j =
    -
    9  {
    -
    10  {"integer", 1},
    -
    11  {"floating", 42.23},
    -
    12  {"string", "hello world"},
    -
    13  {"boolean", true},
    -
    14  {"object", {{"key1", 1}, {"key2", 2}}},
    -
    15  {"array", {1, 2, 3}}
    -
    16  };
    -
    17 
    -
    18  // access existing values
    -
    19  int v_integer = j.value("integer", 0);
    -
    20  double v_floating = j.value("floating", 47.11);
    -
    21 
    -
    22  // access nonexisting values and rely on default value
    -
    23  std::string v_string = j.value("nonexisting", "oops");
    -
    24  bool v_boolean = j.value("nonexisting", false);
    -
    25 
    -
    26  // output values
    -
    27  std::cout << std::boolalpha << v_integer << " " << v_floating
    -
    28  << " " << v_string << " " << v_boolean << "\n";
    -
    29 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be queried with a default value.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object with different entry types
    8  json j =
    9  {
    10  {"integer", 1},
    11  {"floating", 42.23},
    12  {"string", "hello world"},
    13  {"boolean", true},
    14  {"object", {{"key1", 1}, {"key2", 2}}},
    15  {"array", {1, 2, 3}}
    16  };
    17 
    18  // access existing values
    19  int v_integer = j.value("integer", 0);
    20  double v_floating = j.value("floating", 47.11);
    21 
    22  // access nonexisting values and rely on default value
    23  std::string v_string = j.value("nonexisting", "oops");
    24  bool v_boolean = j.value("nonexisting", false);
    25 
    26  // output values
    27  std::cout << std::boolalpha << v_integer << " " << v_floating
    28  << " " << v_string << " " << v_boolean << "\n";
    29 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3122
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    1 42.23 oops false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__value.cpp -o basic_json__value 
    See also
    at(const typename object_t::key_type&) for access by reference with range checking
    @@ -332,7 +298,7 @@ value() with null" operator[](const typename object_t::key_type&) for unchecked access by reference
    Since
    version 1.0.0
    -

    Definition at line 3092 of file json.hpp.

    +

    Definition at line 3122 of file json.hpp.

    @@ -342,9 +308,9 @@ value() with null" diff --git a/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html b/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html index d6e73f34e..f9af39239 100644 --- a/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html +++ b/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::rbegin @@ -33,7 +33,7 @@ - + @@ -260,30 +260,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).rbegin().
  • -
    Example
    The following code shows an example for crbegin.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get an iterator to the reverse-beginning
    - -
    12 
    -
    13  // serialize the element that the iterator points to
    -
    14  std::cout << *it << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    const_reverse_iterator crbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3759
    -
    a template for a reverse iterator class
    Definition: json.hpp:232
    +
    Example
    The following code shows an example for crbegin.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get an iterator to the reverse-beginning
    12 
    13  // serialize the element that the iterator points to
    14  std::cout << *it << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    const_reverse_iterator crbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3798
    +
    a template for a reverse iterator class
    Definition: json.hpp:233
    Output (play with this example online):
    5
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/crbegin.cpp -o crbegin 
    Since
    version 1.0.0
    -

    Definition at line 3705 of file json.hpp.

    +

    Definition at line 3744 of file json.hpp.

    @@ -293,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a2f07bcf7e75c34396476dd1790f26ce8.html b/classnlohmann_1_1basic__json_a2f07bcf7e75c34396476dd1790f26ce8.html index a4565759e..a1480ba69 100644 --- a/classnlohmann_1_1basic__json_a2f07bcf7e75c34396476dd1790f26ce8.html +++ b/classnlohmann_1_1basic__json_a2f07bcf7e75c34396476dd1790f26ce8.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::push_back @@ -33,7 +33,7 @@ - + @@ -264,33 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Logarithmic in the size of the container, O(log(size())).
    -
    Example
    The example shows how push_back and += can be used to add elements to a JSON object. Note how the null value was silently converted to a JSON object.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json object = {{"one", 1}, {"two", 2}};
    -
    9  json null;
    -
    10 
    -
    11  // print values
    -
    12  std::cout << object << '\n';
    -
    13  std::cout << null << '\n';
    -
    14 
    -
    15  // add values
    -
    16  object.push_back(json::object_t::value_type("three", 3));
    -
    17  object += json::object_t::value_type("four", 4);
    -
    18  null += json::object_t::value_type("A", "a");
    -
    19  null += json::object_t::value_type("B", "b");
    -
    20 
    -
    21  // print values
    -
    22  std::cout << object << '\n';
    -
    23  std::cout << null << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4095
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how push_back and += can be used to add elements to a JSON object. Note how the null value was silently converted to a JSON object.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json object = {{"one", 1}, {"two", 2}};
    9  json null;
    10 
    11  // print values
    12  std::cout << object << '\n';
    13  std::cout << null << '\n';
    14 
    15  // add values
    16  object.push_back(json::object_t::value_type("three", 3));
    17  object += json::object_t::value_type("four", 4);
    18  null += json::object_t::value_type("A", "a");
    19  null += json::object_t::value_type("B", "b");
    20 
    21  // print values
    22  std::cout << object << '\n';
    23  std::cout << null << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4143
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {"one":1,"two":2}
     null
     {"four":4,"one":1,"three":3,"two":2}
    @@ -298,7 +274,7 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/push_back__object_t__value.cpp -o push_back__object_t__value 
    Since
    version 1.0.0
    -

    Definition at line 4179 of file json.hpp.

    +

    Definition at line 4229 of file json.hpp.

    @@ -308,9 +284,9 @@ null diff --git a/classnlohmann_1_1basic__json_a3173944e7b1809a333def4078a0b92a3.html b/classnlohmann_1_1basic__json_a3173944e7b1809a333def4078a0b92a3.html index 8802647ac..0f367b3aa 100644 --- a/classnlohmann_1_1basic__json_a3173944e7b1809a333def4078a0b92a3.html +++ b/classnlohmann_1_1basic__json_a3173944e7b1809a333def4078a0b92a3.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator+= @@ -33,7 +33,7 @@ - + @@ -264,33 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Amortized constant.
    -
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9  json null;
    -
    10 
    -
    11  // print values
    -
    12  std::cout << array << '\n';
    -
    13  std::cout << null << '\n';
    -
    14 
    -
    15  // add values
    -
    16  array.push_back(6);
    -
    17  array += 7;
    -
    18  null += "first";
    -
    19  null += "second";
    -
    20 
    -
    21  // print values
    -
    22  std::cout << array << '\n';
    -
    23  std::cout << null << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4095
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json array = {1, 2, 3, 4, 5};
    9  json null;
    10 
    11  // print values
    12  std::cout << array << '\n';
    13  std::cout << null << '\n';
    14 
    15  // add values
    16  array.push_back(6);
    17  array += 7;
    18  null += "first";
    19  null += "second";
    20 
    21  // print values
    22  std::cout << array << '\n';
    23  std::cout << null << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4143
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3,4,5]
     null
     [1,2,3,4,5,6,7]
    @@ -298,7 +274,7 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
    Since
    version 1.0.0
    -

    Definition at line 4120 of file json.hpp.

    +

    Definition at line 4169 of file json.hpp.

    @@ -308,9 +284,9 @@ null diff --git a/classnlohmann_1_1basic__json_a317b01b0fba3ac458561f1634759ea3b.html b/classnlohmann_1_1basic__json_a317b01b0fba3ac458561f1634759ea3b.html index 2b9c78412..cee177c90 100644 --- a/classnlohmann_1_1basic__json_a317b01b0fba3ac458561f1634759ea3b.html +++ b/classnlohmann_1_1basic__json_a317b01b0fba3ac458561f1634759ea3b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator_wrapper @@ -33,7 +33,7 @@ - + @@ -250,10 +250,10 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    This functuion allows to access iterator::key() and iterator::value() during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator.

    +

    This function allows to access iterator::key() and iterator::value() during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator.

    Note
    The name of this function is not yet final and may change in the future.
    -

    Definition at line 3803 of file json.hpp.

    +

    Definition at line 3842 of file json.hpp.

    @@ -263,9 +263,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html b/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html index 6f8410de1..8b720df53 100644 --- a/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html +++ b/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::empty @@ -33,7 +33,7 @@ - + @@ -273,40 +273,11 @@ template<template< typename U, typename V, typename...Args > class Obje
  • Has the semantics of begin() == end().
  • -
    Example
    The following code uses empty to check if a json object contains any elements.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_object_empty(json::value_t::object);
    -
    14  json j_array = {1, 2, 4, 8, 16};
    -
    15  json j_array_empty(json::value_t::array);
    -
    16  json j_string = "Hello, world";
    -
    17 
    -
    18  // call empty()
    -
    19  std::cout << std::boolalpha;
    -
    20  std::cout << j_null.empty() << '\n';
    -
    21  std::cout << j_boolean.empty() << '\n';
    -
    22  std::cout << j_number_integer.empty() << '\n';
    -
    23  std::cout << j_number_float.empty() << '\n';
    -
    24  std::cout << j_object.empty() << '\n';
    -
    25  std::cout << j_object_empty.empty() << '\n';
    -
    26  std::cout << j_array.empty() << '\n';
    -
    27  std::cout << j_array_empty.empty() << '\n';
    -
    28  std::cout << j_string.empty() << '\n';
    -
    29 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code uses empty to check if a json object contains any elements.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_object_empty(json::value_t::object);
    14  json j_array = {1, 2, 4, 8, 16};
    15  json j_array_empty(json::value_t::array);
    16  json j_string = "Hello, world";
    17 
    18  // call empty()
    19  std::cout << std::boolalpha;
    20  std::cout << j_null.empty() << '\n';
    21  std::cout << j_boolean.empty() << '\n';
    22  std::cout << j_number_integer.empty() << '\n';
    23  std::cout << j_number_float.empty() << '\n';
    24  std::cout << j_object.empty() << '\n';
    25  std::cout << j_object_empty.empty() << '\n';
    26  std::cout << j_array.empty() << '\n';
    27  std::cout << j_array_empty.empty() << '\n';
    28  std::cout << j_string.empty() << '\n';
    29 }
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    -
    bool empty() const noexcept
    checks whether the container is empty
    Definition: json.hpp:3855
    +
    bool empty() const noexcept
    checks whether the container is empty
    Definition: json.hpp:3894
    Output (play with this example online):
    true
     false
     false
    @@ -319,7 +290,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/empty.cpp -o empty 
    Since
    version 1.0.0
    -

    Definition at line 3855 of file json.hpp.

    +

    Definition at line 3894 of file json.hpp.

    @@ -329,9 +300,9 @@ false diff --git a/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html b/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html index 85161e4fc..476697f09 100644 --- a/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html +++ b/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -259,30 +259,14 @@ template<template< typename U, typename V, typename...Args > class Obje
    Postcondition
    other is a JSON null value
    Complexity
    Constant.
    -
    Example
    The code below shows the move constructor explicitly called via std::move.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON value
    -
    8  json a = 23;
    -
    9 
    -
    10  // move contents of a to b
    -
    11  json b(std::move(a));
    -
    12 
    -
    13  // serialize the JSON arrays
    -
    14  std::cout << a << '\n';
    -
    15  std::cout << b << '\n';
    -
    16 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The code below shows the move constructor explicitly called via std::move.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON value
    8  json a = 23;
    9 
    10  // move contents of a to b
    11  json b(std::move(a));
    12 
    13  // serialize the JSON arrays
    14  std::cout << a << '\n';
    15  std::cout << b << '\n';
    16 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    null
     23
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__moveconstructor.cpp -o basic_json__moveconstructor 
    Since
    version 1.0.0
    -

    Definition at line 1741 of file json.hpp.

    +

    Definition at line 1752 of file json.hpp.

    @@ -292,9 +276,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html b/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html index bb33276a8..780bbfbdc 100644 --- a/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html +++ b/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator>> @@ -33,7 +33,7 @@ - + @@ -270,26 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    the stream o
    Complexity
    Linear.
    -
    Example
    The example below shows the serialization with different parameters to width to adjust the indentation level.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_object = {{"one", 1}, {"two", 2}};
    -
    9  json j_array = {1, 2, 4, 8, 16};
    -
    10 
    -
    11  // serialize without indentation
    -
    12  std::cout << j_object << "\n\n";
    -
    13  std::cout << j_array << "\n\n";
    -
    14 
    -
    15  // serialize with indentation
    -
    16  std::cout << std::setw(4) << j_object << "\n\n";
    -
    17  std::cout << std::setw(2) << j_array << "\n\n";
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows the serialization with different parameters to width to adjust the indentation level.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_object = {{"one", 1}, {"two", 2}};
    9  json j_array = {1, 2, 4, 8, 16};
    10 
    11  // serialize without indentation
    12  std::cout << j_object << "\n\n";
    13  std::cout << j_array << "\n\n";
    14 
    15  // serialize with indentation
    16  std::cout << std::setw(4) << j_object << "\n\n";
    17  std::cout << std::setw(2) << j_array << "\n\n";
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {"one":1,"two":2}
     
     [1,2,4,8,16]
    @@ -310,7 +292,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator_serialize.cpp -o operator_serialize 
    Since
    version 1.0.0
    -

    Definition at line 4916 of file json.hpp.

    +

    Definition at line 5018 of file json.hpp.

    @@ -320,9 +302,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a3d4e4bab95b24ccab42ed37e0ede2d98.html b/classnlohmann_1_1basic__json_a3d4e4bab95b24ccab42ed37e0ede2d98.html index 411cac6ea..5689954e3 100644 --- a/classnlohmann_1_1basic__json_a3d4e4bab95b24ccab42ed37e0ede2d98.html +++ b/classnlohmann_1_1basic__json_a3d4e4bab95b24ccab42ed37e0ede2d98.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -264,30 +264,15 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows the constructor with an object_t parameter.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an object_t value
    -
    8  json::object_t value = { {"one", 1}, {"two", 2} };
    -
    9 
    -
    10  // create a JSON object from the value
    -
    11  json j(value);
    -
    12 
    -
    13  // serialize the JSON object
    -
    14  std::cout << j << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
    a type for an object
    Definition: json.hpp:340
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor with an object_t parameter.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an object_t value
    8  json::object_t value = { {"one", 1}, {"two", 2} };
    9 
    10  // create a JSON object from the value
    11  json j(value);
    12 
    13  // serialize the JSON object
    14  std::cout << j << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
    a type for an object
    Definition: json.hpp:341
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {"one":1,"two":2}
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__object_t.cpp -o basic_json__object_t 
    See also
    basic_json(const CompatibleObjectType&) – create an object value from a compatible STL container
    Since
    version 1.0.0
    -

    Definition at line 933 of file json.hpp.

    +

    Definition at line 934 of file json.hpp.

    @@ -297,9 +282,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html b/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html index 61c546f28..9bdda0f0b 100644 --- a/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html +++ b/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::type @@ -33,7 +33,7 @@ - + @@ -252,35 +252,10 @@ template<template< typename U, typename V, typename...Args > class Obje

    Return the type of the JSON value as a value from the value_t enumeration.

    Returns
    the type of the JSON value
    Complexity
    Constant.
    -
    Example
    The following code exemplifies type() for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call type()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << (j_null.type() == json::value_t::null) << '\n';
    -
    19  std::cout << (j_boolean.type() == json::value_t::boolean) << '\n';
    -
    20  std::cout << (j_number_integer.type() == json::value_t::number_integer) << '\n';
    -
    21  std::cout << (j_number_float.type() == json::value_t::number_float) << '\n';
    -
    22  std::cout << (j_object.type() == json::value_t::object) << '\n';
    -
    23  std::cout << (j_array.type() == json::value_t::array) << '\n';
    -
    24  std::cout << (j_string.type() == json::value_t::string) << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code exemplifies type() for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call type()
    17  std::cout << std::boolalpha;
    18  std::cout << (j_null.type() == json::value_t::null) << '\n';
    19  std::cout << (j_boolean.type() == json::value_t::boolean) << '\n';
    20  std::cout << (j_number_integer.type() == json::value_t::number_integer) << '\n';
    21  std::cout << (j_number_float.type() == json::value_t::number_float) << '\n';
    22  std::cout << (j_object.type() == json::value_t::object) << '\n';
    23  std::cout << (j_array.type() == json::value_t::array) << '\n';
    24  std::cout << (j_string.type() == json::value_t::string) << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    value_t type() const noexcept
    return the type of the JSON value (explicit)
    Definition: json.hpp:1897
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    value_t type() const noexcept
    return the type of the JSON value (explicit)
    Definition: json.hpp:1908
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    @@ -297,7 +272,7 @@ true The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/type.cpp -o type 
    Since
    version 1.0.0
    -

    Definition at line 1897 of file json.hpp.

    +

    Definition at line 1908 of file json.hpp.

    @@ -307,9 +282,9 @@ true diff --git a/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html b/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html index dbba9ecda..d18f655d5 100644 --- a/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html +++ b/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::begin @@ -33,7 +33,7 @@ - + @@ -261,30 +261,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).begin().
  • -
    Example
    The following code shows an example for cbegin.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  const json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get am iterator to the first element
    -
    11  json::const_iterator it = array.cbegin();
    -
    12 
    -
    13  // serialize the element that the iterator points to
    -
    14  std::cout << *it << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    const_iterator cbegin() const
    returns a const iterator to the first element
    Definition: json.hpp:3614
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    a const random access iterator for the basic_json class
    Definition: json.hpp:5577
    +
    Example
    The following code shows an example for cbegin.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  const json array = {1, 2, 3, 4, 5};
    9 
    10  // get am iterator to the first element
    11  json::const_iterator it = array.cbegin();
    12 
    13  // serialize the element that the iterator points to
    14  std::cout << *it << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    const_iterator cbegin() const
    returns a const iterator to the first element
    Definition: json.hpp:3653
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    a const random access iterator for the basic_json class
    Definition: json.hpp:5686
    Output (play with this example online):
    1
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/cbegin.cpp -o cbegin 
    Since
    version 1.0.0
    -

    Definition at line 3590 of file json.hpp.

    +

    Definition at line 3629 of file json.hpp.

    @@ -294,9 +279,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a457fec897d7b6283c60ca236ebb1f5e8.html b/classnlohmann_1_1basic__json_a457fec897d7b6283c60ca236ebb1f5e8.html index 251e832b2..0cd932c3c 100644 --- a/classnlohmann_1_1basic__json_a457fec897d7b6283c60ca236ebb1f5e8.html +++ b/classnlohmann_1_1basic__json_a457fec897d7b6283c60ca236ebb1f5e8.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -264,30 +264,15 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows the constructor with an array_t parameter.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array_t value
    -
    8  json::array_t value = {"one", "two", 3, 4.5, false};
    -
    9 
    -
    10  // create a JSON array from the value
    -
    11  json j(value);
    -
    12 
    -
    13  // serialize the JSON array
    -
    14  std::cout << j << '\n';
    -
    15 }
    -
    ArrayType< basic_json, AllocatorType< basic_json >> array_t
    a type for an array
    Definition: json.hpp:386
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor with an array_t parameter.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array_t value
    8  json::array_t value = {"one", "two", 3, 4.5, false};
    9 
    10  // create a JSON array from the value
    11  json j(value);
    12 
    13  // serialize the JSON array
    14  std::cout << j << '\n';
    15 }
    ArrayType< basic_json, AllocatorType< basic_json >> array_t
    a type for an array
    Definition: json.hpp:387
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    ["one","two",3,4.5,false]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__array_t.cpp -o basic_json__array_t 
    See also
    basic_json(const CompatibleArrayType&) – create an array value from a compatible STL containers
    Since
    version 1.0.0
    -

    Definition at line 992 of file json.hpp.

    +

    Definition at line 993 of file json.hpp.

    @@ -297,9 +282,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a48c8d153bc2fd1af655063a4b984feac.html b/classnlohmann_1_1basic__json_a48c8d153bc2fd1af655063a4b984feac.html index 15081eb72..e30eb986a 100644 --- a/classnlohmann_1_1basic__json_a48c8d153bc2fd1af655063a4b984feac.html +++ b/classnlohmann_1_1basic__json_a48c8d153bc2fd1af655063a4b984feac.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -264,24 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows the constructor with an string_t parameter.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an string_t value
    -
    8  json::string_t value = "The quick brown fox jumps over the lazy doc";
    -
    9 
    -
    10  // create a JSON string from the value
    -
    11  json j(value);
    -
    12 
    -
    13  // serialize the JSON array
    -
    14  std::cout << j << '\n';
    -
    15 }
    -
    StringType string_t
    a type for a string
    Definition: json.hpp:433
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor with an string_t parameter.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an string_t value
    8  json::string_t value = "The quick brown fox jumps over the lazy doc";
    9 
    10  // create a JSON string from the value
    11  json j(value);
    12 
    13  // serialize the JSON array
    14  std::cout << j << '\n';
    15 }
    StringType string_t
    a type for a string
    Definition: json.hpp:434
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "The quick brown fox jumps over the lazy doc"
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__string_t.cpp -o basic_json__string_t 
    See also
    basic_json(const typename string_t::value_type*) – create a string value from a character pointer
    @@ -289,7 +274,7 @@ template<template< typename U, typename V, typename...Args > class Obje basic_json(const CompatibleStringType&) – create a string value from a compatible string container
    Since
    version 1.0.0
    -

    Definition at line 1058 of file json.hpp.

    +

    Definition at line 1059 of file json.hpp.

    @@ -299,9 +284,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html b/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html index f7414f8e9..a7ca2e37e 100644 --- a/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html +++ b/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::crend @@ -33,7 +33,7 @@ - + @@ -260,33 +260,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).rend().
  • -
    Example
    The following code shows an example for crend.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get an iterator to the reverse-end
    - -
    12 
    -
    13  // increment the iterator to point to the first element
    -
    14  --it;
    -
    15 
    -
    16  // serialize the element that the iterator points to
    -
    17  std::cout << *it << '\n';
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    const_reverse_iterator crend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3782
    -
    a template for a reverse iterator class
    Definition: json.hpp:232
    +
    Example
    The following code shows an example for crend.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get an iterator to the reverse-end
    12 
    13  // increment the iterator to point to the first element
    14  --it;
    15 
    16  // serialize the element that the iterator points to
    17  std::cout << *it << '\n';
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    const_reverse_iterator crend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3821
    +
    a template for a reverse iterator class
    Definition: json.hpp:233
    Output (play with this example online):
    1
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/crend.cpp -o crend 
    Since
    version 1.0.0
    -

    Definition at line 3782 of file json.hpp.

    +

    Definition at line 3821 of file json.hpp.

    @@ -296,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html b/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html index 87274c960..2d3c72d09 100644 --- a/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html +++ b/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::rend @@ -33,7 +33,7 @@ - + @@ -260,33 +260,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).rend().
  • -
    Example
    The following code shows an example for crend.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get an iterator to the reverse-end
    - -
    12 
    -
    13  // increment the iterator to point to the first element
    -
    14  --it;
    -
    15 
    -
    16  // serialize the element that the iterator points to
    -
    17  std::cout << *it << '\n';
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    const_reverse_iterator crend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3782
    -
    a template for a reverse iterator class
    Definition: json.hpp:232
    +
    Example
    The following code shows an example for crend.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get an iterator to the reverse-end
    12 
    13  // increment the iterator to point to the first element
    14  --it;
    15 
    16  // serialize the element that the iterator points to
    17  std::cout << *it << '\n';
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    const_reverse_iterator crend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3821
    +
    a template for a reverse iterator class
    Definition: json.hpp:233
    Output (play with this example online):
    1
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/crend.cpp -o crend 
    Since
    version 1.0.0
    -

    Definition at line 3736 of file json.hpp.

    +

    Definition at line 3775 of file json.hpp.

    @@ -296,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html b/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html index 4e28fbd26..f7a6afc36 100644 --- a/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html +++ b/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::swap @@ -33,7 +33,7 @@ - + @@ -264,35 +264,16 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Constant.
    -
    Example
    The example below shows how JSON values can be swapped.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON value
    -
    8  json value = { {"translation", {{"one", "eins"}, {"two", "zwei"}}} };
    -
    9 
    -
    10  // create an object_t
    -
    11  json::object_t object = {{"cow", "Kuh"}, {"dog", "Hund"}};
    -
    12 
    -
    13  // swap the object stored in the JSON value
    -
    14  value["translation"].swap(object);
    -
    15 
    -
    16  // output the values
    -
    17  std::cout << "value = " << value << '\n';
    -
    18  std::cout << "object = " << object << '\n';
    -
    19 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
    a type for an object
    Definition: json.hpp:340
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4431
    +
    Example
    The example below shows how JSON values can be swapped.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON value
    8  json value = { {"translation", {{"one", "eins"}, {"two", "zwei"}}} };
    9 
    10  // create an object_t
    11  json::object_t object = {{"cow", "Kuh"}, {"dog", "Hund"}};
    12 
    13  // swap the object stored in the JSON value
    14  value["translation"].swap(object);
    15 
    16  // output the values
    17  std::cout << "value = " << value << '\n';
    18  std::cout << "object = " << object << '\n';
    19 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
    a type for an object
    Definition: json.hpp:341
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4486
    Output (play with this example online):
    value = {"translation":{"cow":"Kuh","dog":"Hund"}}
     object = {"one":"eins","two":"zwei"}
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/swap__object_t.cpp -o swap__object_t 
    Since
    version 1.0.0
    -

    Definition at line 4495 of file json.hpp.

    +

    Definition at line 4551 of file json.hpp.

    @@ -302,9 +283,9 @@ object = {"one":"eins","two":"zwei"} diff --git a/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html b/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html index 22fa95968..41bfb0e64 100644 --- a/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html +++ b/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::crbegin @@ -33,7 +33,7 @@ - + @@ -260,30 +260,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).rbegin().
  • -
    Example
    The following code shows an example for crbegin.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get an iterator to the reverse-beginning
    - -
    12 
    -
    13  // serialize the element that the iterator points to
    -
    14  std::cout << *it << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    const_reverse_iterator crbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3759
    -
    a template for a reverse iterator class
    Definition: json.hpp:232
    +
    Example
    The following code shows an example for crbegin.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get an iterator to the reverse-beginning
    12 
    13  // serialize the element that the iterator points to
    14  std::cout << *it << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    const_reverse_iterator crbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3798
    +
    a template for a reverse iterator class
    Definition: json.hpp:233
    Output (play with this example online):
    5
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/crbegin.cpp -o crbegin 
    Since
    version 1.0.0
    -

    Definition at line 3759 of file json.hpp.

    +

    Definition at line 3798 of file json.hpp.

    @@ -293,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a5114ed5eb394a2805da0bd1acba95ae2.html b/classnlohmann_1_1basic__json_a5114ed5eb394a2805da0bd1acba95ae2.html index 6953ac226..d4548d233 100644 --- a/classnlohmann_1_1basic__json_a5114ed5eb394a2805da0bd1acba95ae2.html +++ b/classnlohmann_1_1basic__json_a5114ed5eb394a2805da0bd1acba95ae2.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::push_back @@ -33,7 +33,7 @@ - + @@ -264,33 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Amortized constant.
    -
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9  json null;
    -
    10 
    -
    11  // print values
    -
    12  std::cout << array << '\n';
    -
    13  std::cout << null << '\n';
    -
    14 
    -
    15  // add values
    -
    16  array.push_back(6);
    -
    17  array += 7;
    -
    18  null += "first";
    -
    19  null += "second";
    -
    20 
    -
    21  // print values
    -
    22  std::cout << array << '\n';
    -
    23  std::cout << null << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4095
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json array = {1, 2, 3, 4, 5};
    9  json null;
    10 
    11  // print values
    12  std::cout << array << '\n';
    13  std::cout << null << '\n';
    14 
    15  // add values
    16  array.push_back(6);
    17  array += 7;
    18  null += "first";
    19  null += "second";
    20 
    21  // print values
    22  std::cout << array << '\n';
    23  std::cout << null << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4143
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3,4,5]
     null
     [1,2,3,4,5,6,7]
    @@ -298,7 +274,7 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
    Since
    version 1.0.0
    -

    Definition at line 4130 of file json.hpp.

    +

    Definition at line 4179 of file json.hpp.

    @@ -308,9 +284,9 @@ null diff --git a/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html b/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html index 8089d4db8..59dfbd74c 100644 --- a/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html +++ b/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_discarded @@ -33,7 +33,7 @@ - + @@ -253,34 +253,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Note
    This function will always be false for JSON values after parsing. That is, discarded values can only occur during parsing, but will be removed when inside a structured value or replaced by null in other cases.
    Returns
    true if type is discarded, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_discarded for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_discarded()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_discarded() << '\n';
    -
    19  std::cout << j_boolean.is_discarded() << '\n';
    -
    20  std::cout << j_number_integer.is_discarded() << '\n';
    -
    21  std::cout << j_number_float.is_discarded() << '\n';
    -
    22  std::cout << j_object.is_discarded() << '\n';
    -
    23  std::cout << j_array.is_discarded() << '\n';
    -
    24  std::cout << j_string.is_discarded() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    bool is_discarded() const noexcept
    return whether value is discarded
    Definition: json.hpp:2127
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code exemplifies is_discarded for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_discarded()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_discarded() << '\n';
    19  std::cout << j_boolean.is_discarded() << '\n';
    20  std::cout << j_number_integer.is_discarded() << '\n';
    21  std::cout << j_number_float.is_discarded() << '\n';
    22  std::cout << j_object.is_discarded() << '\n';
    23  std::cout << j_array.is_discarded() << '\n';
    24  std::cout << j_string.is_discarded() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    bool is_discarded() const noexcept
    return whether value is discarded
    Definition: json.hpp:2138
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    false
     false
     false
    @@ -291,7 +266,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_discarded.cpp -o is_discarded 
    Since
    version 1.0.0
    -

    Definition at line 2127 of file json.hpp.

    +

    Definition at line 2138 of file json.hpp.

    @@ -301,9 +276,9 @@ false diff --git a/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html b/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html index 870c41034..484650804 100644 --- a/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html +++ b/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator[] @@ -33,7 +33,7 @@ - + @@ -267,39 +267,15 @@ use operator[] with null"
    Complexity
    Constant if idx is in the range of the array. Otherwise linear in idx - size().
    -
    Example
    The example below shows how array elements can be read and written using [] operator. Note the addition of null values.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON array
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // output element at index 3 (fourth element)
    -
    11  std::cout << array[3] << '\n';
    -
    12 
    -
    13  // change last element to 6
    -
    14  array[array.size() - 1] = 6;
    -
    15 
    -
    16  // output changed array
    -
    17  std::cout << array << '\n';
    -
    18 
    -
    19  // write beyond array limit
    -
    20  array[10] = 11;
    -
    21 
    -
    22  // output changed array
    -
    23  std::cout << array << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how array elements can be read and written using [] operator. Note the addition of null values.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON array
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // output element at index 3 (fourth element)
    11  std::cout << array[3] << '\n';
    12 
    13  // change last element to 6
    14  array[array.size() - 1] = 6;
    15 
    16  // output changed array
    17  std::cout << array << '\n';
    18 
    19  // write beyond array limit
    20  array[10] = 11;
    21 
    22  // output changed array
    23  std::cout << array << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    4
     [1,2,3,4,6]
     [1,2,3,4,6,null,null,null,null,null,11]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operatorarray__size_type.cpp -o operatorarray__size_type 
    Since
    version 1.0.0
    -

    Definition at line 2803 of file json.hpp.

    +

    Definition at line 2825 of file json.hpp.

    @@ -309,9 +285,9 @@ use operator[] with null" diff --git a/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html b/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html index 9ecd4ebb5..8b3980ee9 100644 --- a/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html +++ b/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::swap @@ -33,7 +33,7 @@ - + @@ -265,35 +265,16 @@ use swap() with boolean"
    Complexity
    Constant.
    -
    Example
    The example below shows how JSON values can be swapped.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON value
    -
    8  json value = { "the good", "the bad", "the ugly" };
    -
    9 
    -
    10  // create string_t
    -
    11  json::string_t string = "the fast";
    -
    12 
    -
    13  // swap the object stored in the JSON value
    -
    14  value[1].swap(string);
    -
    15 
    -
    16  // output the values
    -
    17  std::cout << "value = " << value << '\n';
    -
    18  std::cout << "string = " << string << '\n';
    -
    19 }
    -
    StringType string_t
    a type for a string
    Definition: json.hpp:433
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4431
    +
    Example
    The example below shows how JSON values can be swapped.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON value
    8  json value = { "the good", "the bad", "the ugly" };
    9 
    10  // create string_t
    11  json::string_t string = "the fast";
    12 
    13  // swap the object stored in the JSON value
    14  value[1].swap(string);
    15 
    16  // output the values
    17  std::cout << "value = " << value << '\n';
    18  std::cout << "string = " << string << '\n';
    19 }
    StringType string_t
    a type for a string
    Definition: json.hpp:434
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4486
    Output (play with this example online):
    value = ["the good","the fast","the ugly"]
     string = the bad
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/swap__string_t.cpp -o swap__string_t 
    Since
    version 1.0.0
    -

    Definition at line 4528 of file json.hpp.

    +

    Definition at line 4585 of file json.hpp.

    @@ -303,9 +284,9 @@ string = the bad diff --git a/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html b/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html index b5e1fcfb1..ede59c562 100644 --- a/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html +++ b/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -256,20 +256,8 @@ template<template< typename U, typename V, typename...Args > class Obje
  • As postcondition, it holds: basic_json().empty() == true.
  • -
    Example
    The following code shows the constructor for a null JSON value.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON value with default null value
    -
    8  json j;
    -
    9 
    -
    10  // serialize the JSON null value
    -
    11  std::cout << j << '\n';
    -
    12 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor for a null JSON value.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON value with default null value
    8  json j;
    9 
    10  // serialize the JSON null value
    11  std::cout << j << '\n';
    12 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json.cpp -o basic_json 
    See also
    basic_json(std::nullptr_t) – create a null value
    @@ -283,9 +271,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    diff --git a/classnlohmann_1_1basic__json_a5c8bb5200f5eac10d31e26be46e5b1ac.html b/classnlohmann_1_1basic__json_a5c8bb5200f5eac10d31e26be46e5b1ac.html index 6b2cacb00..5756d5972 100644 --- a/classnlohmann_1_1basic__json_a5c8bb5200f5eac10d31e26be46e5b1ac.html +++ b/classnlohmann_1_1basic__json_a5c8bb5200f5eac10d31e26be46e5b1ac.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator<= @@ -33,7 +33,7 @@ - + @@ -270,31 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether lhs is less than or equal to rhs
    Complexity
    Linear.
    -
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array_1 = {1, 2, 3};
    -
    9  json array_2 = {1, 2, 4};
    -
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    -
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    -
    12  json number_1 = 17;
    -
    13  json number_2 = 17.0000000000001L;
    -
    14  json string_1 = "foo";
    -
    15  json string_2 = "bar";
    -
    16 
    -
    17  // output values and comparisons
    -
    18  std::cout << std::boolalpha;
    -
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 > array_2) << '\n';
    -
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 > object_2) << '\n';
    -
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 > number_2) << '\n';
    -
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 > string_2) << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array_1 = {1, 2, 3};
    9  json array_2 = {1, 2, 4};
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    12  json number_1 = 17;
    13  json number_2 = 17.0000000000001L;
    14  json string_1 = "foo";
    15  json string_2 = "bar";
    16 
    17  // output values and comparisons
    18  std::cout << std::boolalpha;
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 > array_2) << '\n';
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 > object_2) << '\n';
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 > number_2) << '\n';
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 > string_2) << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3] == [1,2,4] false
     {"A":"a","B":"b"} == {"A":"a","B":"b"} false
     17 == 17.0000000000001 false
    @@ -302,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__greater.cpp -o operator__greater 
    Since
    version 1.0.0
    -

    Definition at line 4817 of file json.hpp.

    +

    Definition at line 4919 of file json.hpp.

    @@ -312,9 +289,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a5d428360d75a52f6af74751d1cc912c6.html b/classnlohmann_1_1basic__json_a5d428360d75a52f6af74751d1cc912c6.html index f6f5e3e50..f75d3d8c5 100644 --- a/classnlohmann_1_1basic__json_a5d428360d75a52f6af74751d1cc912c6.html +++ b/classnlohmann_1_1basic__json_a5d428360d75a52f6af74751d1cc912c6.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator value_t @@ -33,7 +33,7 @@ - + @@ -252,45 +252,11 @@ template<template< typename U, typename V, typename...Args > class Obje

    Implicitly return the type of the JSON value as a value from the value_t enumeration.

    Returns
    the type of the JSON value
    Complexity
    Constant.
    -
    Example
    The following code exemplifies the value_t operator for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call operator value_t()
    -
    17  json::value_t t_null = j_null;
    -
    18  json::value_t t_boolean = j_boolean;
    -
    19  json::value_t t_number_integer = j_number_integer;
    -
    20  json::value_t t_number_float = j_number_float;
    -
    21  json::value_t t_object = j_object;
    -
    22  json::value_t t_array = j_array;
    -
    23  json::value_t t_string = j_string;
    -
    24 
    -
    25  // print types
    -
    26  std::cout << std::boolalpha;
    -
    27  std::cout << (t_null == json::value_t::null) << '\n';
    -
    28  std::cout << (t_boolean == json::value_t::boolean) << '\n';
    -
    29  std::cout << (t_number_integer == json::value_t::number_integer) << '\n';
    -
    30  std::cout << (t_number_float == json::value_t::number_float) << '\n';
    -
    31  std::cout << (t_object == json::value_t::object) << '\n';
    -
    32  std::cout << (t_array == json::value_t::array) << '\n';
    -
    33  std::cout << (t_string == json::value_t::string) << '\n';
    -
    34 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code exemplifies the value_t operator for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call operator value_t()
    17  json::value_t t_null = j_null;
    18  json::value_t t_boolean = j_boolean;
    19  json::value_t t_number_integer = j_number_integer;
    20  json::value_t t_number_float = j_number_float;
    21  json::value_t t_object = j_object;
    22  json::value_t t_array = j_array;
    23  json::value_t t_string = j_string;
    24 
    25  // print types
    26  std::cout << std::boolalpha;
    27  std::cout << (t_null == json::value_t::null) << '\n';
    28  std::cout << (t_boolean == json::value_t::boolean) << '\n';
    29  std::cout << (t_number_integer == json::value_t::number_integer) << '\n';
    30  std::cout << (t_number_float == json::value_t::number_float) << '\n';
    31  std::cout << (t_object == json::value_t::object) << '\n';
    32  std::cout << (t_array == json::value_t::array) << '\n';
    33  std::cout << (t_string == json::value_t::string) << '\n';
    34 }
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    -
    value_t
    the JSON type enumeration
    Definition: json.hpp:611
    +
    value_t
    the JSON type enumeration
    Definition: json.hpp:612
    array (ordered collection of values)
    number value (floating-point)
    @@ -306,7 +272,7 @@ true The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__value_t.cpp -o operator__value_t 
    Since
    version 1.0.0
    -

    Definition at line 2147 of file json.hpp.

    +

    Definition at line 2158 of file json.hpp.

    @@ -316,9 +282,9 @@ true diff --git a/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html b/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html index 191a7b898..c6cb1e98d 100644 --- a/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html +++ b/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator<< @@ -33,7 +33,7 @@ - + @@ -270,26 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    the stream o
    Complexity
    Linear.
    -
    Example
    The example below shows the serialization with different parameters to width to adjust the indentation level.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_object = {{"one", 1}, {"two", 2}};
    -
    9  json j_array = {1, 2, 4, 8, 16};
    -
    10 
    -
    11  // serialize without indentation
    -
    12  std::cout << j_object << "\n\n";
    -
    13  std::cout << j_array << "\n\n";
    -
    14 
    -
    15  // serialize with indentation
    -
    16  std::cout << std::setw(4) << j_object << "\n\n";
    -
    17  std::cout << std::setw(2) << j_array << "\n\n";
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows the serialization with different parameters to width to adjust the indentation level.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_object = {{"one", 1}, {"two", 2}};
    9  json j_array = {1, 2, 4, 8, 16};
    10 
    11  // serialize without indentation
    12  std::cout << j_object << "\n\n";
    13  std::cout << j_array << "\n\n";
    14 
    15  // serialize with indentation
    16  std::cout << std::setw(4) << j_object << "\n\n";
    17  std::cout << std::setw(2) << j_array << "\n\n";
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {"one":1,"two":2}
     
     [1,2,4,8,16]
    @@ -310,7 +292,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator_serialize.cpp -o operator_serialize 
    Since
    version 1.0.0
    -

    Definition at line 4898 of file json.hpp.

    +

    Definition at line 5000 of file json.hpp.

    @@ -320,9 +302,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a5f0aad50ed7e8aec3128fe018c18b3fe.html b/classnlohmann_1_1basic__json_a5f0aad50ed7e8aec3128fe018c18b3fe.html index c9162c65a..177bb84a7 100644 --- a/classnlohmann_1_1basic__json_a5f0aad50ed7e8aec3128fe018c18b3fe.html +++ b/classnlohmann_1_1basic__json_a5f0aad50ed7e8aec3128fe018c18b3fe.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::get @@ -33,7 +33,7 @@ - + @@ -266,58 +266,9 @@ template<typename ValueType , typename std::enable_if<
    Complexity
    Linear in the size of the JSON value.
    -
    Example
    The example below shows serveral conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard std::vector<short>, (3) A JSON object can be converted to C++ assiciative containers such as std::unordered_map<std::string, json>.
    1 #include <json.hpp>
    -
    2 #include <unordered_map>
    -
    3 
    -
    4 using namespace nlohmann;
    -
    5 
    -
    6 int main()
    -
    7 {
    -
    8  // create a JSON value with different types
    -
    9  json json_types =
    -
    10  {
    -
    11  {"boolean", true},
    -
    12  {
    -
    13  "number", {
    -
    14  {"integer", 42},
    -
    15  {"floating-point", 17.23}
    -
    16  }
    -
    17  },
    -
    18  {"string", "Hello, world!"},
    -
    19  {"array", {1, 2, 3, 4, 5}},
    -
    20  {"null", nullptr}
    -
    21  };
    -
    22 
    -
    23  // use explicit conversions
    -
    24  auto v1 = json_types["boolean"].get<bool>();
    -
    25  auto v2 = json_types["number"]["integer"].get<int>();
    -
    26  auto v3 = json_types["number"]["integer"].get<short>();
    -
    27  auto v4 = json_types["number"]["floating-point"].get<float>();
    -
    28  auto v5 = json_types["number"]["floating-point"].get<int>();
    -
    29  auto v6 = json_types["string"].get<std::string>();
    -
    30  auto v7 = json_types["array"].get<std::vector<short>>();
    -
    31  auto v8 = json_types.get<std::unordered_map<std::string, json>>();
    -
    32 
    -
    33  // print the conversion results
    -
    34  std::cout << v1 << '\n';
    -
    35  std::cout << v2 << ' ' << v3 << '\n';
    -
    36  std::cout << v4 << ' ' << v5 << '\n';
    -
    37  std::cout << v6 << '\n';
    -
    38 
    -
    39  for (auto i : v7)
    -
    40  {
    -
    41  std::cout << i << ' ';
    -
    42  }
    -
    43  std::cout << "\n\n";
    -
    44 
    -
    45  for (auto i : v8)
    -
    46  {
    -
    47  std::cout << i.first << ": " << i.second << '\n';
    -
    48  }
    -
    49 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    ValueType get() const
    get a value (explicit)
    Definition: json.hpp:2443
    +
    Example
    The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard std::vector<short>, (3) A JSON object can be converted to C++ associative containers such as std::unordered_map<std::string, json>.
    1 #include <json.hpp>
    2 #include <unordered_map>
    3 
    4 using namespace nlohmann;
    5 
    6 int main()
    7 {
    8  // create a JSON value with different types
    9  json json_types =
    10  {
    11  {"boolean", true},
    12  {
    13  "number", {
    14  {"integer", 42},
    15  {"floating-point", 17.23}
    16  }
    17  },
    18  {"string", "Hello, world!"},
    19  {"array", {1, 2, 3, 4, 5}},
    20  {"null", nullptr}
    21  };
    22 
    23  // use explicit conversions
    24  auto v1 = json_types["boolean"].get<bool>();
    25  auto v2 = json_types["number"]["integer"].get<int>();
    26  auto v3 = json_types["number"]["integer"].get<short>();
    27  auto v4 = json_types["number"]["floating-point"].get<float>();
    28  auto v5 = json_types["number"]["floating-point"].get<int>();
    29  auto v6 = json_types["string"].get<std::string>();
    30  auto v7 = json_types["array"].get<std::vector<short>>();
    31  auto v8 = json_types.get<std::unordered_map<std::string, json>>();
    32 
    33  // print the conversion results
    34  std::cout << v1 << '\n';
    35  std::cout << v2 << ' ' << v3 << '\n';
    36  std::cout << v4 << ' ' << v5 << '\n';
    37  std::cout << v6 << '\n';
    38 
    39  for (auto i : v7)
    40  {
    41  std::cout << i << ' ';
    42  }
    43  std::cout << "\n\n";
    44 
    45  for (auto i : v8)
    46  {
    47  std::cout << i.first << ": " << i.second << '\n';
    48  }
    49 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    ValueType get() const
    get a value (explicit)
    Definition: json.hpp:2461
    Output (play with this example online):
    1
     42 42
     17.23 17
    @@ -335,7 +286,7 @@ array: [1,2,3,4,5]
     get() for pointer-member access
    Since
    version 1.0.0
    -

    Definition at line 2443 of file json.hpp.

    +

    Definition at line 2461 of file json.hpp.

    @@ -345,9 +296,9 @@ array: [1,2,3,4,5] diff --git a/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html b/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html index a58ec7d5e..7f03a9f27 100644 --- a/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html +++ b/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::reference @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 212 of file json.hpp.

    +

    Definition at line 213 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html b/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html index 4ced51c97..0e2c3897b 100644 --- a/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html +++ b/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator<< @@ -33,7 +33,7 @@ - + @@ -276,31 +276,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Linear in the length of the input. The parser is a predictive LL(1) parser.
    Note
    A UTF-8 byte order mark is silently ignored.
    -
    Example
    The example below shows how a JSON value is constructed by reading a serialization from a stream.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create stream with serialized JSON
    -
    8  std::stringstream ss;
    -
    9  ss << R"({
    -
    10  "number": 23,
    -
    11  "string": "Hello, world!",
    -
    12  "array": [1, 2, 3, 4, 5],
    -
    13  "boolean": false,
    -
    14  "null": null
    -
    15  })";
    -
    16 
    -
    17  // create JSON value and read the serialization from the stream
    -
    18  json j;
    -
    19  j << ss;
    -
    20 
    -
    21  // serialize JSON
    -
    22  std::cout << std::setw(2) << j << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how a JSON value is constructed by reading a serialization from a stream.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create stream with serialized JSON
    8  std::stringstream ss;
    9  ss << R"({
    10  "number": 23,
    11  "string": "Hello, world!",
    12  "array": [1, 2, 3, 4, 5],
    13  "boolean": false,
    14  "null": null
    15  })";
    16 
    17  // create JSON value and read the serialization from the stream
    18  json j;
    19  j << ss;
    20 
    21  // serialize JSON
    22  std::cout << std::setw(2) << j << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {
       "array": [
         1,
    @@ -318,7 +295,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    See also
    parse(std::istream&, parser_callback_t) for a variant with a parser callback function to filter values while parsing
    Since
    version 1.0.0
    -

    Definition at line 5020 of file json.hpp.

    +

    Definition at line 5122 of file json.hpp.

    @@ -328,9 +305,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html b/classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html index 74b926e79..a279a474b 100644 --- a/classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html +++ b/classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::object_t @@ -33,7 +33,7 @@ - + @@ -252,13 +252,7 @@ template<template< typename U, typename V, typename...Args > class Obje

    Default type

    With the default values for ObjectType (std::map), StringType (std::string), and AllocatorType (std::allocator), the default value for object_t is:

    -
    std::map<
    -
    std::string, // key_type
    -
    basic_json, // value_type
    -
    std::less<std::string>, // key_compare
    -
    std::allocator<std::pair<const std::string, basic_json>> // allocator_type
    -
    >
    -

    Behavior

    +
    std::map<
    std::string, // key_type
    basic_json, // value_type
    std::less<std::string>, // key_compare
    std::allocator<std::pair<const std::string, basic_json>> // allocator_type
    >

    Behavior

    The choice of object_t influences the behavior of the JSON class. With the default type, objects have the following behavior:

    • When all names are unique, objects will be interoperable in the sense that all software implementations receiving that object will agree on the name-value mappings.
    • @@ -276,7 +270,7 @@ template<template< typename U, typename V, typename...Args > class Obje
      See also
      array_t – type for an array value
      Since
      version 1.0.0
      -

      Definition at line 340 of file json.hpp.

      +

      Definition at line 341 of file json.hpp.

      @@ -286,9 +280,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a652414dd930cb3af3b6f454cc535a23e.html b/classnlohmann_1_1basic__json_a652414dd930cb3af3b6f454cc535a23e.html index 89eb435e8..7e827e728 100644 --- a/classnlohmann_1_1basic__json_a652414dd930cb3af3b6f454cc535a23e.html +++ b/classnlohmann_1_1basic__json_a652414dd930cb3af3b6f454cc535a23e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::at @@ -33,7 +33,7 @@ - + @@ -266,42 +266,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be read and written using at.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON object
    -
    8  json object =
    -
    9  {
    -
    10  {"the good", "il buono"},
    -
    11  {"the bad", "il cativo"},
    -
    12  {"the ugly", "il brutto"}
    -
    13  };
    -
    14 
    -
    15  // output element with key "the ugly"
    -
    16  std::cout << object.at("the ugly") << '\n';
    -
    17 
    -
    18  // change element with key "the bad"
    -
    19  object.at("the bad") = "il cattivo";
    -
    20 
    -
    21  // output changed array
    -
    22  std::cout << object << '\n';
    -
    23 
    -
    24  // try to write at a nonexisting key
    -
    25  try
    -
    26  {
    -
    27  object.at("the fast") = "il rapido";
    -
    28  }
    -
    29  catch (std::out_of_range& e)
    -
    30  {
    -
    31  std::cout << "out of range: " << e.what() << '\n';
    -
    32  }
    -
    33 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2620
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be read and written using at.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON object
    8  json object =
    9  {
    10  {"the good", "il buono"},
    11  {"the bad", "il cativo"},
    12  {"the ugly", "il brutto"}
    13  };
    14 
    15  // output element with key "the ugly"
    16  std::cout << object.at("the ugly") << '\n';
    17 
    18  // change element with key "the bad"
    19  object.at("the bad") = "il cattivo";
    20 
    21  // output changed array
    22  std::cout << object << '\n';
    23 
    24  // try to write at a nonexisting key
    25  try
    26  {
    27  object.at("the fast") = "il rapido";
    28  }
    29  catch (std::out_of_range& e)
    30  {
    31  std::cout << "out of range: " << e.what() << '\n';
    32  }
    33 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2638
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "il brutto"
     {"the bad":"il cattivo","the good":"il buono","the ugly":"il brutto"}
     out of range: key 'the fast' not found
    @@ -311,7 +278,7 @@ out of range: key 'the fast' not found
     value() for access by value with a default value
    Since
    version 1.0.0
    -

    Definition at line 2710 of file json.hpp.

    +

    Definition at line 2730 of file json.hpp.

    @@ -321,9 +288,9 @@ out of range: key 'the fast' not found diff --git a/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html b/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html index a0acde195..d3d2f2729 100644 --- a/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html +++ b/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::get_ptr @@ -33,7 +33,7 @@ - + @@ -251,7 +251,7 @@ template<typename PointerType , typename std::enable_if<
    -

    Implict pointer access to the internally stored JSON value. No copies are made.

    +

    Implicit pointer access to the internally stored JSON value. No copies are made.

    Warning
    Writing data to the pointee of the result yields an undefined state.
    Template Parameters
    @@ -261,38 +261,17 @@ template<typename PointerType , typename std::enable_if<
    Returns
    pointer to the internally stored JSON value if the requested pointer type PointerType fits to the JSON value; nullptr otherwise
    Complexity
    Constant.
    -
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON number
    -
    8  json value = 17;
    -
    9 
    -
    10  // explicitly getting pointers
    -
    11  auto p1 = value.get_ptr<const json::number_integer_t*>();
    -
    12  auto p2 = value.get_ptr<json::number_integer_t*>();
    -
    13  auto p3 = value.get_ptr<json::number_integer_t* const>();
    -
    14  auto p4 = value.get_ptr<const json::number_integer_t* const>();
    -
    15  auto p5 = value.get_ptr<json::number_float_t*>();
    -
    16 
    -
    17  // print the pointees
    -
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    -
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    -
    20 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    PointerType get_ptr() noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2527
    -
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:527
    -
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:592
    +
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON number
    8  json value = 17;
    9 
    10  // explicitly getting pointers
    11  auto p1 = value.get_ptr<const json::number_integer_t*>();
    12  auto p2 = value.get_ptr<json::number_integer_t*>();
    13  auto p3 = value.get_ptr<json::number_integer_t* const>();
    14  auto p4 = value.get_ptr<const json::number_integer_t* const>();
    15  auto p5 = value.get_ptr<json::number_float_t*>();
    16 
    17  // print the pointees
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    20 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    PointerType get_ptr() noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2545
    +
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:528
    +
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:593
    Output (play with this example online):
    17 17 17 17
     true
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/get_ptr.cpp -o get_ptr 
    Since
    version 1.0.0
    -

    Definition at line 2527 of file json.hpp.

    +

    Definition at line 2545 of file json.hpp.

    @@ -302,9 +281,9 @@ true diff --git a/classnlohmann_1_1basic__json_a66f936cfbd252f85bd3dc2598e37a64b.html b/classnlohmann_1_1basic__json_a66f936cfbd252f85bd3dc2598e37a64b.html index de286d401..c8d8daaab 100644 --- a/classnlohmann_1_1basic__json_a66f936cfbd252f85bd3dc2598e37a64b.html +++ b/classnlohmann_1_1basic__json_a66f936cfbd252f85bd3dc2598e37a64b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::push_back @@ -33,7 +33,7 @@
    - + @@ -264,33 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Amortized constant.
    -
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9  json null;
    -
    10 
    -
    11  // print values
    -
    12  std::cout << array << '\n';
    -
    13  std::cout << null << '\n';
    -
    14 
    -
    15  // add values
    -
    16  array.push_back(6);
    -
    17  array += 7;
    -
    18  null += "first";
    -
    19  null += "second";
    -
    20 
    -
    21  // print values
    -
    22  std::cout << array << '\n';
    -
    23  std::cout << null << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4095
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json array = {1, 2, 3, 4, 5};
    9  json null;
    10 
    11  // print values
    12  std::cout << array << '\n';
    13  std::cout << null << '\n';
    14 
    15  // add values
    16  array.push_back(6);
    17  array += 7;
    18  null += "first";
    19  null += "second";
    20 
    21  // print values
    22  std::cout << array << '\n';
    23  std::cout << null << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4143
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3,4,5]
     null
     [1,2,3,4,5,6,7]
    @@ -298,7 +274,7 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
    Since
    version 1.0.0
    -

    Definition at line 4095 of file json.hpp.

    +

    Definition at line 4143 of file json.hpp.

    @@ -308,9 +284,9 @@ null diff --git a/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html b/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html index 4e4041139..c8f04f921 100644 --- a/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html +++ b/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::number_integer_t @@ -33,7 +33,7 @@ - + @@ -245,8 +245,7 @@ template<template< typename U, typename V, typename...Args > class Obje

    To store integer numbers in C++, a type is defined by the template parameter NumberIntegerType which chooses the type to use.

    Default type

    With the default values for NumberIntegerType (int64_t), the default value for number_integer_t is:

    -
    int64_t
    -

    Default behavior

    +
    int64_t

    Default behavior

    • The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in integer literals lead to an interpretation as octal number. Internally, the value will be stored as decimal number. For instance, the C++ integer literal 010 will be serialized to 8. During deserialization, leading zeros yield an error.
    • Not-a-number (NaN) values will be serialized to null.
    • @@ -265,7 +264,7 @@ template<template< typename U, typename V, typename...Args > class Obje
      See also
      number_float_t – type for number values (floating-point)
      Since
      version 1.0.0
      -

      Definition at line 527 of file json.hpp.

      +

      Definition at line 528 of file json.hpp.

      @@ -275,9 +274,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a696ced74d8edc0b63a000a72907ab109.html b/classnlohmann_1_1basic__json_a696ced74d8edc0b63a000a72907ab109.html index 810a50469..034b24017 100644 --- a/classnlohmann_1_1basic__json_a696ced74d8edc0b63a000a72907ab109.html +++ b/classnlohmann_1_1basic__json_a696ced74d8edc0b63a000a72907ab109.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_number @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

      This function returns true iff the JSON value is a number. This includes both integer and floating-point values.

      Returns
      true if type is number (regardless whether integer or floating-type), false otherwise.
      Complexity
      Constant.
      -
      Example
      The following code exemplifies is_number for all JSON types.
      1 #include <json.hpp>
      -
      2 
      -
      3 using namespace nlohmann;
      -
      4 
      -
      5 int main()
      -
      6 {
      -
      7  // create JSON values
      -
      8  json j_null;
      -
      9  json j_boolean = true;
      -
      10  json j_number_integer = 17;
      -
      11  json j_number_float = 23.42;
      -
      12  json j_object = {{"one", 1}, {"two", 2}};
      -
      13  json j_array = {1, 2, 4, 8, 16};
      -
      14  json j_string = "Hello, world";
      -
      15 
      -
      16  // call is_number()
      -
      17  std::cout << std::boolalpha;
      -
      18  std::cout << j_null.is_number() << '\n';
      -
      19  std::cout << j_boolean.is_number() << '\n';
      -
      20  std::cout << j_number_integer.is_number() << '\n';
      -
      21  std::cout << j_number_float.is_number() << '\n';
      -
      22  std::cout << j_object.is_number() << '\n';
      -
      23  std::cout << j_array.is_number() << '\n';
      -
      24  std::cout << j_string.is_number() << '\n';
      -
      25 }
      -
      a class to store JSON values
      Definition: json.hpp:187
      -
      namespace for Niels Lohmann
      Definition: json.hpp:78
      -
      bool is_number() const noexcept
      return whether value is a number
      Definition: json.hpp:2000
      +
      Example
      The following code exemplifies is_number for all JSON types.
      1 #include <json.hpp>
      2 
      3 using namespace nlohmann;
      4 
      5 int main()
      6 {
      7  // create JSON values
      8  json j_null;
      9  json j_boolean = true;
      10  json j_number_integer = 17;
      11  json j_number_float = 23.42;
      12  json j_object = {{"one", 1}, {"two", 2}};
      13  json j_array = {1, 2, 4, 8, 16};
      14  json j_string = "Hello, world";
      15 
      16  // call is_number()
      17  std::cout << std::boolalpha;
      18  std::cout << j_null.is_number() << '\n';
      19  std::cout << j_boolean.is_number() << '\n';
      20  std::cout << j_number_integer.is_number() << '\n';
      21  std::cout << j_number_float.is_number() << '\n';
      22  std::cout << j_object.is_number() << '\n';
      23  std::cout << j_array.is_number() << '\n';
      24  std::cout << j_string.is_number() << '\n';
      25 }
      a class to store JSON values
      Definition: json.hpp:188
      +
      namespace for Niels Lohmann
      Definition: json.hpp:79
      +
      bool is_number() const noexcept
      return whether value is a number
      Definition: json.hpp:2011
      Output (play with this example online):
      false
       false
       true
      @@ -293,7 +268,7 @@ false
       is_number_float() – check if value is a floating-point number
      Since
      version 1.0.0
      -

      Definition at line 2000 of file json.hpp.

      +

      Definition at line 2011 of file json.hpp.

      @@ -303,9 +278,9 @@ false diff --git a/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html b/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html index 7cac557bb..8c8e6ef00 100644 --- a/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html +++ b/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -291,39 +291,18 @@ construct with iterators from null"
      Complexity
      Linear in distance between first and last.
      -
      Example
      The example below shows several ways to create JSON values by specifying a subrange with iterators.
      1 #include <json.hpp>
      -
      2 
      -
      3 using namespace nlohmann;
      -
      4 
      -
      5 int main()
      -
      6 {
      -
      7  // create JSON values
      -
      8  json j_array = {"alpha", "bravo", "charly", "delta", "easy"};
      -
      9  json j_number = 42;
      -
      10  json j_object = {{"one", "eins"}, {"two", "zwei"}};
      -
      11 
      -
      12  // create copies using iterators
      -
      13  json j_array_range(j_array.begin() + 1, j_array.end() - 2);
      -
      14  json j_number_range(j_number.begin(), j_number.end());
      -
      15  json j_object_range(j_object.begin(), j_object.find("two"));
      -
      16 
      -
      17  // serialize the values
      -
      18  std::cout << j_array_range << '\n';
      -
      19  std::cout << j_number_range << '\n';
      -
      20  std::cout << j_object_range << '\n';
      -
      21 }
      -
      a class to store JSON values
      Definition: json.hpp:187
      -
      iterator end()
      returns an iterator to one past the last element
      Definition: json.hpp:3639
      -
      iterator begin()
      returns an iterator to the first element
      Definition: json.hpp:3580
      -
      iterator find(typename object_t::key_type key)
      find an element in a JSON object
      Definition: json.hpp:3500
      -
      namespace for Niels Lohmann
      Definition: json.hpp:78
      +
      Example
      The example below shows several ways to create JSON values by specifying a subrange with iterators.
      1 #include <json.hpp>
      2 
      3 using namespace nlohmann;
      4 
      5 int main()
      6 {
      7  // create JSON values
      8  json j_array = {"alpha", "bravo", "charly", "delta", "easy"};
      9  json j_number = 42;
      10  json j_object = {{"one", "eins"}, {"two", "zwei"}};
      11 
      12  // create copies using iterators
      13  json j_array_range(j_array.begin() + 1, j_array.end() - 2);
      14  json j_number_range(j_number.begin(), j_number.end());
      15  json j_object_range(j_object.begin(), j_object.find("two"));
      16 
      17  // serialize the values
      18  std::cout << j_array_range << '\n';
      19  std::cout << j_number_range << '\n';
      20  std::cout << j_object_range << '\n';
      21 }
      a class to store JSON values
      Definition: json.hpp:188
      +
      iterator end()
      returns an iterator to one past the last element
      Definition: json.hpp:3678
      +
      iterator begin()
      returns an iterator to the first element
      Definition: json.hpp:3619
      +
      iterator find(typename object_t::key_type key)
      find an element in a JSON object
      Definition: json.hpp:3536
      +
      namespace for Niels Lohmann
      Definition: json.hpp:79
      Output (play with this example online):
      ["bravo","charly"]
       42
       {"one":"eins"}
       
      The example code above can be translated with
      g++ -std=c++11 -Isrc doc/examples/basic_json__InputIt_InputIt.cpp -o basic_json__InputIt_InputIt 
      Since
      version 1.0.0
      -

      Definition at line 1577 of file json.hpp.

      +

      Definition at line 1580 of file json.hpp.

      @@ -333,9 +312,9 @@ construct with iterators from null" diff --git a/classnlohmann_1_1basic__json_a6b7428e8c1169497f47b81667001cbfb.html b/classnlohmann_1_1basic__json_a6b7428e8c1169497f47b81667001cbfb.html index dec74f55f..41e489568 100644 --- a/classnlohmann_1_1basic__json_a6b7428e8c1169497f47b81667001cbfb.html +++ b/classnlohmann_1_1basic__json_a6b7428e8c1169497f47b81667001cbfb.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::insert @@ -33,7 +33,7 @@ - + @@ -284,32 +284,16 @@ template<template< typename U, typename V, typename...Args > class Obje
      Complexity
      Linear in cnt plus linear in the distance between pos and end of the container.
      -
      Example
      The example shows how insert is used.
      1 #include <json.hpp>
      -
      2 
      -
      3 using namespace nlohmann;
      -
      4 
      -
      5 int main()
      -
      6 {
      -
      7  // create a JSON array
      -
      8  json v = {1, 2, 3, 4};
      -
      9 
      -
      10  // insert number 7 copies of number 7 before number 3
      -
      11  auto new_pos = v.insert(v.begin() + 2, 7, 7);
      -
      12 
      -
      13  // output new array and result of insert call
      -
      14  std::cout << *new_pos << '\n';
      -
      15  std::cout << v << '\n';
      -
      16 }
      -
      a class to store JSON values
      Definition: json.hpp:187
      -
      iterator begin()
      returns an iterator to the first element
      Definition: json.hpp:3580
      -
      namespace for Niels Lohmann
      Definition: json.hpp:78
      -
      iterator insert(const_iterator pos, const basic_json &val)
      inserts element
      Definition: json.hpp:4230
      +
      Example
      The example shows how insert is used.
      1 #include <json.hpp>
      2 
      3 using namespace nlohmann;
      4 
      5 int main()
      6 {
      7  // create a JSON array
      8  json v = {1, 2, 3, 4};
      9 
      10  // insert number 7 copies of number 7 before number 3
      11  auto new_pos = v.insert(v.begin() + 2, 7, 7);
      12 
      13  // output new array and result of insert call
      14  std::cout << *new_pos << '\n';
      15  std::cout << v << '\n';
      16 }
      a class to store JSON values
      Definition: json.hpp:188
      +
      iterator begin()
      returns an iterator to the first element
      Definition: json.hpp:3619
      +
      namespace for Niels Lohmann
      Definition: json.hpp:79
      +
      iterator insert(const_iterator pos, const basic_json &val)
      inserts element
      Definition: json.hpp:4281
      Output (play with this example online):
      7
       [1,2,7,7,7,7,7,7,7,3,4]
       
      The example code above can be translated with
      g++ -std=c++11 -Isrc doc/examples/insert__count.cpp -o insert__count 
      Since
      version 1.0.0
      -

      Definition at line 4285 of file json.hpp.

      +

      Definition at line 4337 of file json.hpp.

      @@ -319,9 +303,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html b/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html index 91ee1ad96..388d7670f 100644 --- a/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html +++ b/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::pointer @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
      -

      Definition at line 227 of file json.hpp.

      +

      Definition at line 228 of file json.hpp.

      @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a6dff6a02a2be250b8f8dc2f47be65544.html b/classnlohmann_1_1basic__json_a6dff6a02a2be250b8f8dc2f47be65544.html index afd1e7763..808aeff8d 100644 --- a/classnlohmann_1_1basic__json_a6dff6a02a2be250b8f8dc2f47be65544.html +++ b/classnlohmann_1_1basic__json_a6dff6a02a2be250b8f8dc2f47be65544.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::erase @@ -33,7 +33,7 @@ - + @@ -266,34 +266,19 @@ range"
      Complexity
      Linear in distance between idx and the end of the container.
      -
      Example
      The example shows the effect of erase.
      1 #include <json.hpp>
      -
      2 
      -
      3 using namespace nlohmann;
      -
      4 
      -
      5 int main()
      -
      6 {
      -
      7  // create a JSON array
      -
      8  json j_array = {0, 1, 2, 3, 4, 5};
      -
      9 
      -
      10  // call erase
      -
      11  j_array.erase(2);
      -
      12 
      -
      13  // print values
      -
      14  std::cout << j_array << '\n';
      -
      15 }
      -
      a class to store JSON values
      Definition: json.hpp:187
      -
      namespace for Niels Lohmann
      Definition: json.hpp:78
      -
      InteratorType erase(InteratorType pos)
      remove element given an iterator
      Definition: json.hpp:3244
      +
      Example
      The example shows the effect of erase.
      1 #include <json.hpp>
      2 
      3 using namespace nlohmann;
      4 
      5 int main()
      6 {
      7  // create a JSON array
      8  json j_array = {0, 1, 2, 3, 4, 5};
      9 
      10  // call erase
      11  j_array.erase(2);
      12 
      13  // print values
      14  std::cout << j_array << '\n';
      15 }
      a class to store JSON values
      Definition: json.hpp:188
      +
      namespace for Niels Lohmann
      Definition: json.hpp:79
      +
      InteratorType erase(InteratorType pos)
      remove element given an iterator
      Definition: json.hpp:3274
      Output (play with this example online):
      [0,1,3,4,5]
       
      The example code above can be translated with
      g++ -std=c++11 -Isrc doc/examples/erase__size_type.cpp -o erase__size_type 
      See also
      erase(InteratorType) – removes the element at a given position
      erase(InteratorType, InteratorType) – removes the elements in the given range
      -erase(const typename object_t::key_type&) – remvoes the element from an object at the given key
      +erase(const typename object_t::key_type&) – removes the element from an object at the given key
      Since
      version 1.0.0
      -

      Definition at line 3465 of file json.hpp.

      +

      Definition at line 3500 of file json.hpp.

      @@ -303,9 +288,9 @@ range" diff --git a/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html b/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html index 7ef97e749..b082112db 100644 --- a/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html +++ b/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator!= @@ -33,7 +33,7 @@ - + @@ -270,31 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether the values lhs and rhs are not equal
    Complexity
    Linear.
    -
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array_1 = {1, 2, 3};
    -
    9  json array_2 = {1, 2, 4};
    -
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    -
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    -
    12  json number_1 = 17;
    -
    13  json number_2 = 17.000000000000001L;
    -
    14  json string_1 = "foo";
    -
    15  json string_2 = "bar";
    -
    16 
    -
    17  // output values and comparisons
    -
    18  std::cout << std::boolalpha;
    -
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 != array_2) << '\n';
    -
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 != object_2) << '\n';
    -
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 != number_2) << '\n';
    -
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 != string_2) << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array_1 = {1, 2, 3};
    9  json array_2 = {1, 2, 4};
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    12  json number_1 = 17;
    13  json number_2 = 17.000000000000001L;
    14  json string_1 = "foo";
    15  json string_2 = "bar";
    16 
    17  // output values and comparisons
    18  std::cout << std::boolalpha;
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 != array_2) << '\n';
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 != object_2) << '\n';
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 != number_2) << '\n';
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 != string_2) << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3] == [1,2,4] true
     {"A":"a","B":"b"} == {"A":"a","B":"b"} false
     17 == 17 false
    @@ -302,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__notequal.cpp -o operator__notequal 
    Since
    version 1.0.0
    -

    Definition at line 4695 of file json.hpp.

    +

    Definition at line 4775 of file json.hpp.

    @@ -312,9 +289,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a71eba33d906745e66f340952b79fbce3.html b/classnlohmann_1_1basic__json_a71eba33d906745e66f340952b79fbce3.html index 7057e8998..8f1ee6b76 100644 --- a/classnlohmann_1_1basic__json_a71eba33d906745e66f340952b79fbce3.html +++ b/classnlohmann_1_1basic__json_a71eba33d906745e66f340952b79fbce3.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_reverse_iterator @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 241 of file json.hpp.

    +

    Definition at line 242 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a72442ccbb378b4464a24a2da1e784041.html b/classnlohmann_1_1basic__json_a72442ccbb378b4464a24a2da1e784041.html index 266723175..66dd73625 100644 --- a/classnlohmann_1_1basic__json_a72442ccbb378b4464a24a2da1e784041.html +++ b/classnlohmann_1_1basic__json_a72442ccbb378b4464a24a2da1e784041.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::value @@ -33,7 +33,7 @@ - + @@ -261,12 +261,7 @@ template<template< typename U, typename V, typename...Args > class Obje

    access specified object element with default value Returns either a copy of an object's element at the specified key key or a given default value if no element with key key exists.

    -

    The function is basically equivalent to executing

    try {
    -
    return at(key);
    -
    } catch(std::out_of_range) {
    -
    return default_value;
    -
    }
    -
    Note
    Unlike at(const typename object_t::key_type&), this function does not throw if the given key key was not found.
    +

    The function is basically equivalent to executing

    try {
    return at(key);
    } catch(std::out_of_range) {
    return default_value;
    }
    Note
    Unlike at(const typename object_t::key_type&), this function does not throw if the given key key was not found.
    Unlike operator[](const typename object_t::key_type& key), this function does not implicitly add an element to the position defined by key. This function is furthermore also applicable to const objects.
    Parameters
    @@ -291,38 +286,9 @@ value() with null"
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be queried with a default value.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object with different entry types
    -
    8  json j =
    -
    9  {
    -
    10  {"integer", 1},
    -
    11  {"floating", 42.23},
    -
    12  {"string", "hello world"},
    -
    13  {"boolean", true},
    -
    14  {"object", {{"key1", 1}, {"key2", 2}}},
    -
    15  {"array", {1, 2, 3}}
    -
    16  };
    -
    17 
    -
    18  // access existing values
    -
    19  int v_integer = j.value("integer", 0);
    -
    20  double v_floating = j.value("floating", 47.11);
    -
    21 
    -
    22  // access nonexisting values and rely on default value
    -
    23  std::string v_string = j.value("nonexisting", "oops");
    -
    24  bool v_boolean = j.value("nonexisting", false);
    -
    25 
    -
    26  // output values
    -
    27  std::cout << std::boolalpha << v_integer << " " << v_floating
    -
    28  << " " << v_string << " " << v_boolean << "\n";
    -
    29 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be queried with a default value.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object with different entry types
    8  json j =
    9  {
    10  {"integer", 1},
    11  {"floating", 42.23},
    12  {"string", "hello world"},
    13  {"boolean", true},
    14  {"object", {{"key1", 1}, {"key2", 2}}},
    15  {"array", {1, 2, 3}}
    16  };
    17 
    18  // access existing values
    19  int v_integer = j.value("integer", 0);
    20  double v_floating = j.value("floating", 47.11);
    21 
    22  // access nonexisting values and rely on default value
    23  std::string v_string = j.value("nonexisting", "oops");
    24  bool v_boolean = j.value("nonexisting", false);
    25 
    26  // output values
    27  std::cout << std::boolalpha << v_integer << " " << v_floating
    28  << " " << v_string << " " << v_boolean << "\n";
    29 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3122
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    1 42.23 oops false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__value.cpp -o basic_json__value 
    See also
    at(const typename object_t::key_type&) for access by reference with range checking
    @@ -330,7 +296,7 @@ value() with null" operator[](const typename object_t::key_type&) for unchecked access by reference
    Since
    version 1.0.0
    -

    Definition at line 3118 of file json.hpp.

    +

    Definition at line 3148 of file json.hpp.

    @@ -340,9 +306,9 @@ value() with null" diff --git a/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html b/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html index 0370287c2..28731d085 100644 --- a/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html +++ b/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::cend @@ -33,7 +33,7 @@ - + @@ -261,33 +261,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).end().
  • -
    Example
    The following code shows an example for cend.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get am iterator to one past the last element
    -
    11  json::const_iterator it = array.cend();
    -
    12 
    -
    13  // decrement the iterator to point to the last element
    -
    14  --it;
    -
    15 
    -
    16  // serialize the element that the iterator points to
    -
    17  std::cout << *it << '\n';
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    const_iterator cend() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3673
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    a const random access iterator for the basic_json class
    Definition: json.hpp:5577
    +
    Example
    The following code shows an example for cend.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get am iterator to one past the last element
    11  json::const_iterator it = array.cend();
    12 
    13  // decrement the iterator to point to the last element
    14  --it;
    15 
    16  // serialize the element that the iterator points to
    17  std::cout << *it << '\n';
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    const_iterator cend() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3712
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    a const random access iterator for the basic_json class
    Definition: json.hpp:5686
    Output (play with this example online):
    5
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/cend.cpp -o cend 
    Since
    version 1.0.0
    -

    Definition at line 3673 of file json.hpp.

    +

    Definition at line 3712 of file json.hpp.

    @@ -297,9 +279,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a74472977b798c7b7989e6e7cb960ecff.html b/classnlohmann_1_1basic__json_a74472977b798c7b7989e6e7cb960ecff.html index 86c22da9f..f6fd44a84 100644 --- a/classnlohmann_1_1basic__json_a74472977b798c7b7989e6e7cb960ecff.html +++ b/classnlohmann_1_1basic__json_a74472977b798c7b7989e6e7cb960ecff.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -262,30 +262,9 @@ template<template< typename U, typename V, typename...Args > class Obje In case the parameter val is not a number, a JSON null value is created instead.
    Complexity
    Constant.
    -
    Example
    The following example creates several floating-point values.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create values of different floating-point types
    -
    8  json::number_float_t v_ok = 3.141592653589793;
    -
    9  json::number_float_t v_nan = NAN;
    -
    10  json::number_float_t v_infinity = INFINITY;
    -
    11 
    -
    12  // create JSON numbers
    -
    13  json j_ok(v_ok);
    -
    14  json j_nan(v_nan);
    -
    15  json j_infinity(v_infinity);
    -
    16 
    -
    17  // serialize the JSON numbers
    -
    18  std::cout << j_ok << '\n';
    -
    19  std::cout << j_nan << '\n';
    -
    20  std::cout << j_infinity << '\n';
    -
    21 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:592
    +
    Example
    The following example creates several floating-point values.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create values of different floating-point types
    8  json::number_float_t v_ok = 3.141592653589793;
    9  json::number_float_t v_nan = NAN;
    10  json::number_float_t v_infinity = INFINITY;
    11 
    12  // create JSON numbers
    13  json j_ok(v_ok);
    14  json j_nan(v_nan);
    15  json j_infinity(v_infinity);
    16 
    17  // serialize the JSON numbers
    18  std::cout << j_ok << '\n';
    19  std::cout << j_nan << '\n';
    20  std::cout << j_infinity << '\n';
    21 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:593
    Output (play with this example online):
    3.14159265358979
     null
     null
    @@ -293,7 +272,7 @@ null
     
    See also
    basic_json(const CompatibleNumberFloatType) – create a number value (floating-point) from a compatible number type
    Since
    version 1.0.0
    -

    Definition at line 1258 of file json.hpp.

    +

    Definition at line 1259 of file json.hpp.

    @@ -303,9 +282,9 @@ null diff --git a/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html b/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html index d9e641dab..f31757dbe 100644 --- a/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html +++ b/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator>= @@ -33,7 +33,7 @@ - + @@ -270,31 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether lhs is greater than or equal to rhs
    Complexity
    Linear.
    -
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array_1 = {1, 2, 3};
    -
    9  json array_2 = {1, 2, 4};
    -
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    -
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    -
    12  json number_1 = 17;
    -
    13  json number_2 = 17.0000000000001L;
    -
    14  json string_1 = "foo";
    -
    15  json string_2 = "bar";
    -
    16 
    -
    17  // output values and comparisons
    -
    18  std::cout << std::boolalpha;
    -
    19  std::cout << array_1 << " >= " << array_2 << " " << (array_1 >= array_2) << '\n';
    -
    20  std::cout << object_1 << " >= " << object_2 << " " << (object_1 >= object_2) << '\n';
    -
    21  std::cout << number_1 << " >= " << number_2 << " " << (number_1 >= number_2) << '\n';
    -
    22  std::cout << string_1 << " >= " << string_2 << " " << (string_1 >= string_2) << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array_1 = {1, 2, 3};
    9  json array_2 = {1, 2, 4};
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    12  json number_1 = 17;
    13  json number_2 = 17.0000000000001L;
    14  json string_1 = "foo";
    15  json string_2 = "bar";
    16 
    17  // output values and comparisons
    18  std::cout << std::boolalpha;
    19  std::cout << array_1 << " >= " << array_2 << " " << (array_1 >= array_2) << '\n';
    20  std::cout << object_1 << " >= " << object_2 << " " << (object_1 >= object_2) << '\n';
    21  std::cout << number_1 << " >= " << number_2 << " " << (number_1 >= number_2) << '\n';
    22  std::cout << string_1 << " >= " << string_2 << " " << (string_1 >= string_2) << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3] >= [1,2,4] false
     {"A":"a","B":"b"} >= {"A":"a","B":"b"} true
     17 >= 17.0000000000001 false
    @@ -302,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__greaterequal.cpp -o operator__greaterequal 
    Since
    version 1.0.0
    -

    Definition at line 4861 of file json.hpp.

    +

    Definition at line 4963 of file json.hpp.

    @@ -312,9 +289,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a74ccfa471a0c061876b247f820f3c741.html b/classnlohmann_1_1basic__json_a74ccfa471a0c061876b247f820f3c741.html index 53ece109f..89b5c10fa 100644 --- a/classnlohmann_1_1basic__json_a74ccfa471a0c061876b247f820f3c741.html +++ b/classnlohmann_1_1basic__json_a74ccfa471a0c061876b247f820f3c741.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::parse @@ -33,7 +33,7 @@ - + @@ -270,69 +270,14 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    result of the deserialization
    Complexity
    Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the parser callback function cb has a super-linear complexity.
    Note
    A UTF-8 byte order mark is silently ignored.
    -
    Example
    The example below demonstrates the parse function with and without callback function.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // a JSON text
    -
    8  auto text = R"(
    -
    9  {
    -
    10  "Image": {
    -
    11  "Width": 800,
    -
    12  "Height": 600,
    -
    13  "Title": "View from 15th Floor",
    -
    14  "Thumbnail": {
    -
    15  "Url": "http://www.example.com/image/481989943",
    -
    16  "Height": 125,
    -
    17  "Width": 100
    -
    18  },
    -
    19  "Animated" : false,
    -
    20  "IDs": [116, 943, 234, 38793]
    -
    21  }
    -
    22  }
    -
    23  )";
    -
    24 
    -
    25  // fill a stream with JSON text
    -
    26  std::stringstream ss;
    -
    27  ss << text;
    -
    28 
    -
    29  // parse and serialize JSON
    -
    30  json j_complete = json::parse(ss);
    -
    31  std::cout << std::setw(4) << j_complete << "\n\n";
    -
    32 
    -
    33 
    -
    34  // define parser callback
    -
    35  json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
    -
    36  {
    -
    37  // skip object elements with key "Thumbnail"
    -
    38  if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
    -
    39  {
    -
    40  return false;
    -
    41  }
    -
    42  else
    -
    43  {
    -
    44  return true;
    -
    45  }
    -
    46  };
    -
    47 
    -
    48  // fill a stream with JSON text
    -
    49  ss.clear();
    -
    50  ss << text;
    -
    51 
    -
    52  // parse (with callback) and serialize JSON
    -
    53  json j_filtered = json::parse(ss, cb);
    -
    54  std::cout << std::setw(4) << j_filtered << '\n';
    -
    55 }
    -
    basic_json<> json
    default JSON class
    Definition: json.hpp:7811
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:819
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4028
    +
    Example
    The example below demonstrates the parse function with and without callback function.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // a JSON text
    8  auto text = R"(
    9  {
    10  "Image": {
    11  "Width": 800,
    12  "Height": 600,
    13  "Title": "View from 15th Floor",
    14  "Thumbnail": {
    15  "Url": "http://www.example.com/image/481989943",
    16  "Height": 125,
    17  "Width": 100
    18  },
    19  "Animated" : false,
    20  "IDs": [116, 943, 234, 38793]
    21  }
    22  }
    23  )";
    24 
    25  // fill a stream with JSON text
    26  std::stringstream ss;
    27  ss << text;
    28 
    29  // parse and serialize JSON
    30  json j_complete = json::parse(ss);
    31  std::cout << std::setw(4) << j_complete << "\n\n";
    32 
    33 
    34  // define parser callback
    35  json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
    36  {
    37  // skip object elements with key "Thumbnail"
    38  if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
    39  {
    40  return false;
    41  }
    42  else
    43  {
    44  return true;
    45  }
    46  };
    47 
    48  // fill a stream with JSON text
    49  ss.clear();
    50  ss << text;
    51 
    52  // parse (with callback) and serialize JSON
    53  json j_filtered = json::parse(ss, cb);
    54  std::cout << std::setw(4) << j_filtered << '\n';
    55 }
    basic_json<> json
    default JSON class
    Definition: json.hpp:7968
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:820
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4073
    the parser read a key of a value in an object
    -
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:4955
    -
    parse_event_t
    JSON callback events.
    Definition: json.hpp:754
    +
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:5057
    +
    parse_event_t
    JSON callback events.
    Definition: json.hpp:755
    Output (play with this example online):
    {
         "Image": {
             "Animated": false,
    @@ -371,7 +316,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    See also
    parse(const string_t&, parser_callback_t) for a version that reads from a string
    Since
    version 1.0.0
    -

    Definition at line 4984 of file json.hpp.

    +

    Definition at line 5086 of file json.hpp.

    @@ -381,9 +326,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a75a1754e0d39f33095d3102a8bdb9881.html b/classnlohmann_1_1basic__json_a75a1754e0d39f33095d3102a8bdb9881.html index 5d0121bae..28a188e9c 100644 --- a/classnlohmann_1_1basic__json_a75a1754e0d39f33095d3102a8bdb9881.html +++ b/classnlohmann_1_1basic__json_a75a1754e0d39f33095d3102a8bdb9881.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::erase @@ -33,7 +33,7 @@ - + @@ -252,7 +252,7 @@ template<class InteratorType , typename std::enable_if<
    -

    Removes the element specified by iterator pos. Invalidates iterators and references at or after the point of the erase, including the end() iterator. The iterator pos must be valid and dereferenceable. Thus the end() iterator (which is valid, but is not dereferencable) cannot be used as a value for pos.

    +

    Removes the element specified by iterator pos. Invalidates iterators and references at or after the point of the erase, including the end() iterator. The iterator pos must be valid and dereferenceable. Thus the end() iterator (which is valid, but is not dereferenceable) cannot be used as a value for pos.

    If called on a primitive type other than null, the resulting JSON value will be null.

    Parameters
    @@ -284,41 +284,11 @@ of range"
  • other types: constant
  • -
    Example
    The example shows the result of erase for different JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_boolean = true;
    -
    9  json j_number_integer = 17;
    -
    10  json j_number_float = 23.42;
    -
    11  json j_object = {{"one", 1}, {"two", 2}};
    -
    12  json j_array = {1, 2, 4, 8, 16};
    -
    13  json j_string = "Hello, world";
    -
    14 
    -
    15  // call erase
    -
    16  j_boolean.erase(j_boolean.begin());
    -
    17  j_number_integer.erase(j_number_integer.begin());
    -
    18  j_number_float.erase(j_number_float.begin());
    -
    19  j_object.erase(j_object.find("two"));
    -
    20  j_array.erase(j_array.begin() + 2);
    -
    21  j_string.erase(j_string.begin());
    -
    22 
    -
    23  // print values
    -
    24  std::cout << j_boolean << '\n';
    -
    25  std::cout << j_number_integer << '\n';
    -
    26  std::cout << j_number_float << '\n';
    -
    27  std::cout << j_object << '\n';
    -
    28  std::cout << j_array << '\n';
    -
    29  std::cout << j_string << '\n';
    -
    30 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3580
    -
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3500
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3244
    +
    Example
    The example shows the result of erase for different JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_boolean = true;
    9  json j_number_integer = 17;
    10  json j_number_float = 23.42;
    11  json j_object = {{"one", 1}, {"two", 2}};
    12  json j_array = {1, 2, 4, 8, 16};
    13  json j_string = "Hello, world";
    14 
    15  // call erase
    16  j_boolean.erase(j_boolean.begin());
    17  j_number_integer.erase(j_number_integer.begin());
    18  j_number_float.erase(j_number_float.begin());
    19  j_object.erase(j_object.find("two"));
    20  j_array.erase(j_array.begin() + 2);
    21  j_string.erase(j_string.begin());
    22 
    23  // print values
    24  std::cout << j_boolean << '\n';
    25  std::cout << j_number_integer << '\n';
    26  std::cout << j_number_float << '\n';
    27  std::cout << j_object << '\n';
    28  std::cout << j_array << '\n';
    29  std::cout << j_string << '\n';
    30 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3619
    +
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3536
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3274
    Output (play with this example online):
    null
     null
     null
    @@ -328,12 +298,12 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/erase__IteratorType.cpp -o erase__IteratorType 
    See also
    erase(InteratorType, InteratorType) – removes the elements in the given range
    -erase(const typename object_t::key_type&) – remvoes the element from an object at the given key
    +erase(const typename object_t::key_type&) – removes the element from an object at the given key
    erase(const size_type) – removes the element from an array at the given index
    Since
    version 1.0.0
    -

    Definition at line 3244 of file json.hpp.

    +

    Definition at line 3274 of file json.hpp.

    @@ -343,9 +313,9 @@ null diff --git a/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html b/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html index 43a58dc3e..1e67c37db 100644 --- a/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html +++ b/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html @@ -3,7 +3,7 @@ - +JSON for Modern C++: nlohmann::basic_json::get @@ -33,7 +33,7 @@
    - + @@ -261,39 +261,18 @@ template<typename PointerType , typename std::enable_if<
    Returns
    pointer to the internally stored JSON value if the requested pointer type PointerType fits to the JSON value; nullptr otherwise
    Complexity
    Constant.
    -
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON number
    -
    8  json value = 17;
    -
    9 
    -
    10  // explicitly getting pointers
    -
    11  auto p1 = value.get<const json::number_integer_t*>();
    -
    12  auto p2 = value.get<json::number_integer_t*>();
    -
    13  auto p3 = value.get<json::number_integer_t* const>();
    -
    14  auto p4 = value.get<const json::number_integer_t* const>();
    -
    15  auto p5 = value.get<json::number_float_t*>();
    -
    16 
    -
    17  // print the pointees
    -
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    -
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    -
    20 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    ValueType get() const
    get a value (explicit)
    Definition: json.hpp:2443
    -
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:527
    -
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:592
    +
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON number
    8  json value = 17;
    9 
    10  // explicitly getting pointers
    11  auto p1 = value.get<const json::number_integer_t*>();
    12  auto p2 = value.get<json::number_integer_t*>();
    13  auto p3 = value.get<json::number_integer_t* const>();
    14  auto p4 = value.get<const json::number_integer_t* const>();
    15  auto p5 = value.get<json::number_float_t*>();
    16 
    17  // print the pointees
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    20 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    ValueType get() const
    get a value (explicit)
    Definition: json.hpp:2461
    +
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:528
    +
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:593
    Output (play with this example online):
    17 17 17 17
     true
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/get__PointerType.cpp -o get__PointerType 
    See also
    get_ptr() for explicit pointer-member access
    Since
    version 1.0.0
    -

    Definition at line 2492 of file json.hpp.

    +

    Definition at line 2510 of file json.hpp.

    @@ -303,9 +282,9 @@ true diff --git a/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html b/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html index 85c375bd3..2d3026020 100644 --- a/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html +++ b/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::rend @@ -33,7 +33,7 @@ - + @@ -260,33 +260,15 @@ Illustration from cppreference.com
  • Has the semantics of reverse_iterator(begin()).
  • -
    Example
    The following code shows an example for rend.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get an iterator to the reverse-end
    -
    11  json::reverse_iterator it = array.rend();
    -
    12 
    -
    13  // increment the iterator to point to the first element
    -
    14  --it;
    -
    15 
    -
    16  // serialize the element that the iterator points to
    -
    17  std::cout << *it << '\n';
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    reverse_iterator rend()
    returns an iterator to the reverse-end
    Definition: json.hpp:3728
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    a template for a reverse iterator class
    Definition: json.hpp:232
    +
    Example
    The following code shows an example for rend.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get an iterator to the reverse-end
    11  json::reverse_iterator it = array.rend();
    12 
    13  // increment the iterator to point to the first element
    14  --it;
    15 
    16  // serialize the element that the iterator points to
    17  std::cout << *it << '\n';
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    reverse_iterator rend()
    returns an iterator to the reverse-end
    Definition: json.hpp:3767
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    a template for a reverse iterator class
    Definition: json.hpp:233
    Output (play with this example online):
    1
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/rend.cpp -o rend 
    Since
    version 1.0.0
    -

    Definition at line 3728 of file json.hpp.

    +

    Definition at line 3767 of file json.hpp.

    @@ -296,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html b/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html index e07af42cb..023248631 100644 --- a/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html +++ b/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::find @@ -33,7 +33,7 @@ - + @@ -259,36 +259,17 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    Iterator to an element with key equivalent to key. If no such element is found, past-the-end (see end()) iterator is returned.
    Complexity
    Logarithmic in the size of the JSON object.
    -
    Example
    The example shows how find is used.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  json j_object = {{"one", 1}, {"two", 2}};
    -
    9 
    -
    10  // call find
    -
    11  auto it_two = j_object.find("two");
    -
    12  auto it_three = j_object.find("three");
    -
    13 
    -
    14  // print values
    -
    15  std::cout << std::boolalpha;
    -
    16  std::cout << "\"two\" was found: " << (it_two != j_object.end()) << '\n';
    -
    17  std::cout << "value at key \"two\": " << *it_two << '\n';
    -
    18  std::cout << "\"three\" was found: " << (it_three != j_object.end()) << '\n';
    -
    19 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3639
    -
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3500
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how find is used.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  json j_object = {{"one", 1}, {"two", 2}};
    9 
    10  // call find
    11  auto it_two = j_object.find("two");
    12  auto it_three = j_object.find("three");
    13 
    14  // print values
    15  std::cout << std::boolalpha;
    16  std::cout << "\"two\" was found: " << (it_two != j_object.end()) << '\n';
    17  std::cout << "value at key \"two\": " << *it_two << '\n';
    18  std::cout << "\"three\" was found: " << (it_three != j_object.end()) << '\n';
    19 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3678
    +
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3536
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "two" was found: true
     value at key "two": 2
     "three" was found: false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/find__key_type.cpp -o find__key_type 
    Since
    version 1.0.0
    -

    Definition at line 3516 of file json.hpp.

    +

    Definition at line 3553 of file json.hpp.

    @@ -298,9 +279,9 @@ value at key "two": 2 diff --git a/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html b/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html index 5bc98eedf..693f0e313 100644 --- a/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html +++ b/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::value_type @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 209 of file json.hpp.

    +

    Definition at line 210 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a7d1b990f2c12fecb57db1504fdadd0bb.html b/classnlohmann_1_1basic__json_a7d1b990f2c12fecb57db1504fdadd0bb.html index c1314012b..3879037a0 100644 --- a/classnlohmann_1_1basic__json_a7d1b990f2c12fecb57db1504fdadd0bb.html +++ b/classnlohmann_1_1basic__json_a7d1b990f2c12fecb57db1504fdadd0bb.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::erase @@ -33,7 +33,7 @@ - + @@ -265,26 +265,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    log(size()) + count(key)
    -
    Example
    The example shows the effect of erase.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  json j_object = {{"one", 1}, {"two", 2}};
    -
    9 
    -
    10  // call erase
    -
    11  auto count_one = j_object.erase("one");
    -
    12  auto count_three = j_object.erase("three");
    -
    13 
    -
    14  // print values
    -
    15  std::cout << j_object << '\n';
    -
    16  std::cout << count_one << " " << count_three << '\n';
    -
    17 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3244
    +
    Example
    The example shows the effect of erase.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  json j_object = {{"one", 1}, {"two", 2}};
    9 
    10  // call erase
    11  auto count_one = j_object.erase("one");
    12  auto count_three = j_object.erase("three");
    13 
    14  // print values
    15  std::cout << j_object << '\n';
    16  std::cout << count_one << " " << count_three << '\n';
    17 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3274
    Output (play with this example online):
    {"two":2}
     1 0
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/erase__key_type.cpp -o erase__key_type 
    @@ -295,7 +278,7 @@ template<template< typename U, typename V, typename...Args > class Obje erase(const size_type) – removes the element from an array at the given index
    Since
    version 1.0.0
    -

    Definition at line 3428 of file json.hpp.

    +

    Definition at line 3462 of file json.hpp.

    @@ -305,9 +288,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a7dab69b10b98e7bc694339720e37fb2b.html b/classnlohmann_1_1basic__json_a7dab69b10b98e7bc694339720e37fb2b.html index 636f238b8..ea09ddeb5 100644 --- a/classnlohmann_1_1basic__json_a7dab69b10b98e7bc694339720e37fb2b.html +++ b/classnlohmann_1_1basic__json_a7dab69b10b98e7bc694339720e37fb2b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::find @@ -33,7 +33,7 @@ - + @@ -259,36 +259,17 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    Iterator to an element with key equivalent to key. If no such element is found, past-the-end (see end()) iterator is returned.
    Complexity
    Logarithmic in the size of the JSON object.
    -
    Example
    The example shows how find is used.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  json j_object = {{"one", 1}, {"two", 2}};
    -
    9 
    -
    10  // call find
    -
    11  auto it_two = j_object.find("two");
    -
    12  auto it_three = j_object.find("three");
    -
    13 
    -
    14  // print values
    -
    15  std::cout << std::boolalpha;
    -
    16  std::cout << "\"two\" was found: " << (it_two != j_object.end()) << '\n';
    -
    17  std::cout << "value at key \"two\": " << *it_two << '\n';
    -
    18  std::cout << "\"three\" was found: " << (it_three != j_object.end()) << '\n';
    -
    19 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3639
    -
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3500
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how find is used.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  json j_object = {{"one", 1}, {"two", 2}};
    9 
    10  // call find
    11  auto it_two = j_object.find("two");
    12  auto it_three = j_object.find("three");
    13 
    14  // print values
    15  std::cout << std::boolalpha;
    16  std::cout << "\"two\" was found: " << (it_two != j_object.end()) << '\n';
    17  std::cout << "value at key \"two\": " << *it_two << '\n';
    18  std::cout << "\"three\" was found: " << (it_three != j_object.end()) << '\n';
    19 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3678
    +
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3536
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "two" was found: true
     value at key "two": 2
     "three" was found: false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/find__key_type.cpp -o find__key_type 
    Since
    version 1.0.0
    -

    Definition at line 3500 of file json.hpp.

    +

    Definition at line 3536 of file json.hpp.

    @@ -298,9 +279,9 @@ value at key "two": 2 diff --git a/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html b/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html index 420e26ec3..ad276d966 100644 --- a/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html +++ b/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator!= @@ -33,7 +33,7 @@ - + @@ -270,29 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether v is not null
    Complexity
    Constant.
    Example
    The example compares several JSON types to the null pointer.
    -
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array = {1, 2, 3};
    -
    9  json object = {{"A", "a"}, {"B", "b"}};
    -
    10  json number = 17;
    -
    11  json string = "foo";
    -
    12  json null;
    -
    13 
    -
    14  // output values and comparisons
    -
    15  std::cout << std::boolalpha;
    -
    16  std::cout << array << " != nullptr " << (array != nullptr) << '\n';
    -
    17  std::cout << object << " != nullptr " << (object != nullptr) << '\n';
    -
    18  std::cout << number << " != nullptr " << (number != nullptr) << '\n';
    -
    19  std::cout << string << " != nullptr " << (string != nullptr) << '\n';
    -
    20  std::cout << null << " != nullptr " << (null != nullptr) << '\n';
    -
    21 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array = {1, 2, 3};
    9  json object = {{"A", "a"}, {"B", "b"}};
    10  json number = 17;
    11  json string = "foo";
    12  json null;
    13 
    14  // output values and comparisons
    15  std::cout << std::boolalpha;
    16  std::cout << array << " != nullptr " << (array != nullptr) << '\n';
    17  std::cout << object << " != nullptr " << (object != nullptr) << '\n';
    18  std::cout << number << " != nullptr " << (number != nullptr) << '\n';
    19  std::cout << string << " != nullptr " << (string != nullptr) << '\n';
    20  std::cout << null << " != nullptr " << (null != nullptr) << '\n';
    21 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79

    Output (play with this example online):

    [1,2,3] != nullptr true
     {"A":"a","B":"b"} != nullptr true
     17 != nullptr true
    @@ -300,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     null != nullptr false
     

    The example code above can be translated with

    g++ -std=c++11 -Isrc doc/examples/operator__notequal__nullptr_t.cpp -o operator__notequal__nullptr_t 
    Since
    version 1.0.0
    -

    Definition at line 4727 of file json.hpp.

    +

    Definition at line 4807 of file json.hpp.

    @@ -310,9 +289,9 @@ null != nullptr false diff --git a/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html b/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html index 9933dd860..44abf3f96 100644 --- a/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html +++ b/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::size_type @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 221 of file json.hpp.

    +

    Definition at line 222 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html b/classnlohmann_1_1basic__json_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html index 3eff05cc1..660da9c21 100644 --- a/classnlohmann_1_1basic__json_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html +++ b/classnlohmann_1_1basic__json_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::front @@ -33,7 +33,7 @@ - + @@ -259,38 +259,10 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows an example for front.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_object_empty(json::value_t::object);
    -
    14  json j_array = {1, 2, 4, 8, 16};
    -
    15  json j_array_empty(json::value_t::array);
    -
    16  json j_string = "Hello, world";
    -
    17 
    -
    18  // call front()
    -
    19  //std::cout << j_null.front() << '\n'; // would throw
    -
    20  std::cout << j_boolean.front() << '\n';
    -
    21  std::cout << j_number_integer.front() << '\n';
    -
    22  std::cout << j_number_float.front() << '\n';
    -
    23  std::cout << j_object.front() << '\n';
    -
    24  //std::cout << j_object_empty.front() << '\n'; // would throw
    -
    25  std::cout << j_array.front() << '\n';
    -
    26  //std::cout << j_array_empty.front() << '\n'; // would throw
    -
    27  std::cout << j_string.front() << '\n';
    -
    28 }
    -
    reference front()
    access the first element
    Definition: json.hpp:3143
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code shows an example for front.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_object_empty(json::value_t::object);
    14  json j_array = {1, 2, 4, 8, 16};
    15  json j_array_empty(json::value_t::array);
    16  json j_string = "Hello, world";
    17 
    18  // call front()
    19  //std::cout << j_null.front() << '\n'; // would throw
    20  std::cout << j_boolean.front() << '\n';
    21  std::cout << j_number_integer.front() << '\n';
    22  std::cout << j_number_float.front() << '\n';
    23  std::cout << j_object.front() << '\n';
    24  //std::cout << j_object_empty.front() << '\n'; // would throw
    25  std::cout << j_array.front() << '\n';
    26  //std::cout << j_array_empty.front() << '\n'; // would throw
    27  std::cout << j_string.front() << '\n';
    28 }
    reference front()
    access the first element
    Definition: json.hpp:3173
    +
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    Output (play with this example online):
    true
     17
    @@ -301,7 +273,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/front.cpp -o front 
    Since
    version 1.0.0
    -

    Definition at line 3143 of file json.hpp.

    +

    Definition at line 3173 of file json.hpp.

    @@ -311,9 +283,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a87db51b6b936fb2ea293cdbc8702dcb8.html b/classnlohmann_1_1basic__json_a87db51b6b936fb2ea293cdbc8702dcb8.html index 11edb74ac..27ab29539 100644 --- a/classnlohmann_1_1basic__json_a87db51b6b936fb2ea293cdbc8702dcb8.html +++ b/classnlohmann_1_1basic__json_a87db51b6b936fb2ea293cdbc8702dcb8.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator> @@ -33,7 +33,7 @@ - + @@ -270,31 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether lhs is greater than to rhs
    Complexity
    Linear.
    -
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array_1 = {1, 2, 3};
    -
    9  json array_2 = {1, 2, 4};
    -
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    -
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    -
    12  json number_1 = 17;
    -
    13  json number_2 = 17.0000000000001L;
    -
    14  json string_1 = "foo";
    -
    15  json string_2 = "bar";
    -
    16 
    -
    17  // output values and comparisons
    -
    18  std::cout << std::boolalpha;
    -
    19  std::cout << array_1 << " <= " << array_2 << " " << (array_1 <= array_2) << '\n';
    -
    20  std::cout << object_1 << " <= " << object_2 << " " << (object_1 <= object_2) << '\n';
    -
    21  std::cout << number_1 << " <= " << number_2 << " " << (number_1 <= number_2) << '\n';
    -
    22  std::cout << string_1 << " <= " << string_2 << " " << (string_1 <= string_2) << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array_1 = {1, 2, 3};
    9  json array_2 = {1, 2, 4};
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    12  json number_1 = 17;
    13  json number_2 = 17.0000000000001L;
    14  json string_1 = "foo";
    15  json string_2 = "bar";
    16 
    17  // output values and comparisons
    18  std::cout << std::boolalpha;
    19  std::cout << array_1 << " <= " << array_2 << " " << (array_1 <= array_2) << '\n';
    20  std::cout << object_1 << " <= " << object_2 << " " << (object_1 <= object_2) << '\n';
    21  std::cout << number_1 << " <= " << number_2 << " " << (number_1 <= number_2) << '\n';
    22  std::cout << string_1 << " <= " << string_2 << " " << (string_1 <= string_2) << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3] <= [1,2,4] true
     {"A":"a","B":"b"} <= {"A":"a","B":"b"} true
     17 <= 17.0000000000001 true
    @@ -302,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__lessequal.cpp -o operator__lessequal 
    Since
    version 1.0.0
    -

    Definition at line 4839 of file json.hpp.

    +

    Definition at line 4941 of file json.hpp.

    @@ -312,9 +289,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a8b526709d395142b68d21abfbfff17c3.html b/classnlohmann_1_1basic__json_a8b526709d395142b68d21abfbfff17c3.html index 69b9ab731..107e68f34 100644 --- a/classnlohmann_1_1basic__json_a8b526709d395142b68d21abfbfff17c3.html +++ b/classnlohmann_1_1basic__json_a8b526709d395142b68d21abfbfff17c3.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::front @@ -33,7 +33,7 @@ - + @@ -259,38 +259,10 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows an example for front.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_object_empty(json::value_t::object);
    -
    14  json j_array = {1, 2, 4, 8, 16};
    -
    15  json j_array_empty(json::value_t::array);
    -
    16  json j_string = "Hello, world";
    -
    17 
    -
    18  // call front()
    -
    19  //std::cout << j_null.front() << '\n'; // would throw
    -
    20  std::cout << j_boolean.front() << '\n';
    -
    21  std::cout << j_number_integer.front() << '\n';
    -
    22  std::cout << j_number_float.front() << '\n';
    -
    23  std::cout << j_object.front() << '\n';
    -
    24  //std::cout << j_object_empty.front() << '\n'; // would throw
    -
    25  std::cout << j_array.front() << '\n';
    -
    26  //std::cout << j_array_empty.front() << '\n'; // would throw
    -
    27  std::cout << j_string.front() << '\n';
    -
    28 }
    -
    reference front()
    access the first element
    Definition: json.hpp:3143
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code shows an example for front.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_object_empty(json::value_t::object);
    14  json j_array = {1, 2, 4, 8, 16};
    15  json j_array_empty(json::value_t::array);
    16  json j_string = "Hello, world";
    17 
    18  // call front()
    19  //std::cout << j_null.front() << '\n'; // would throw
    20  std::cout << j_boolean.front() << '\n';
    21  std::cout << j_number_integer.front() << '\n';
    22  std::cout << j_number_float.front() << '\n';
    23  std::cout << j_object.front() << '\n';
    24  //std::cout << j_object_empty.front() << '\n'; // would throw
    25  std::cout << j_array.front() << '\n';
    26  //std::cout << j_array_empty.front() << '\n'; // would throw
    27  std::cout << j_string.front() << '\n';
    28 }
    reference front()
    access the first element
    Definition: json.hpp:3173
    +
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    Output (play with this example online):
    true
     17
    @@ -301,7 +273,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/front.cpp -o front 
    Since
    version 1.0.0
    -

    Definition at line 3151 of file json.hpp.

    +

    Definition at line 3181 of file json.hpp.

    @@ -311,9 +283,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a8c40cd9ead4de7c82f28268bdf0ec98a.html b/classnlohmann_1_1basic__json_a8c40cd9ead4de7c82f28268bdf0ec98a.html index be62de0be..78c24bc3f 100644 --- a/classnlohmann_1_1basic__json_a8c40cd9ead4de7c82f28268bdf0ec98a.html +++ b/classnlohmann_1_1basic__json_a8c40cd9ead4de7c82f28268bdf0ec98a.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::clear @@ -33,7 +33,7 @@ - + @@ -268,42 +268,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Note
    Floating-point numbers are set to 0.0 which will be serialized to 0. The vale type remains number_float_t.
    Complexity
    Linear in the size of the JSON value.
    -
    Example
    The example below shows the effect of clear to different JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call clear()
    -
    17  j_null.clear();
    -
    18  j_boolean.clear();
    -
    19  j_number_integer.clear();
    -
    20  j_number_float.clear();
    -
    21  j_object.clear();
    -
    22  j_array.clear();
    -
    23  j_string.clear();
    -
    24 
    -
    25  // serialize the cleared values()
    -
    26  std::cout << j_null << '\n';
    -
    27  std::cout << j_boolean << '\n';
    -
    28  std::cout << j_number_integer << '\n';
    -
    29  std::cout << j_number_float << '\n';
    -
    30  std::cout << j_object << '\n';
    -
    31  std::cout << j_array << '\n';
    -
    32  std::cout << j_string << '\n';
    -
    33 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4028
    +
    Example
    The example below shows the effect of clear to different JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call clear()
    17  j_null.clear();
    18  j_boolean.clear();
    19  j_number_integer.clear();
    20  j_number_float.clear();
    21  j_object.clear();
    22  j_array.clear();
    23  j_string.clear();
    24 
    25  // serialize the cleared values()
    26  std::cout << j_null << '\n';
    27  std::cout << j_boolean << '\n';
    28  std::cout << j_number_integer << '\n';
    29  std::cout << j_number_float << '\n';
    30  std::cout << j_object << '\n';
    31  std::cout << j_array << '\n';
    32  std::cout << j_string << '\n';
    33 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4073
    Output (play with this example online):
    null
     false
     0
    @@ -314,7 +281,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/clear.cpp -o clear 
    Since
    version 1.0.0
    -

    Definition at line 4028 of file json.hpp.

    +

    Definition at line 4073 of file json.hpp.

    @@ -324,9 +291,9 @@ false diff --git a/classnlohmann_1_1basic__json_a8e34088252a3ee6b2377f3a1f26dd1ba.html b/classnlohmann_1_1basic__json_a8e34088252a3ee6b2377f3a1f26dd1ba.html index 741b88a5e..2a338e769 100644 --- a/classnlohmann_1_1basic__json_a8e34088252a3ee6b2377f3a1f26dd1ba.html +++ b/classnlohmann_1_1basic__json_a8e34088252a3ee6b2377f3a1f26dd1ba.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator[] @@ -33,7 +33,7 @@ - + @@ -267,23 +267,8 @@ operator[] with null"
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be read using the [] operator.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  const json object =
    -
    9  {
    -
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    -
    11  };
    -
    12 
    -
    13  // output element with key "two"
    -
    14  std::cout << object["two"] << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be read using the [] operator.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  const json object =
    9  {
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    11  };
    12 
    13  // output element with key "two"
    14  std::cout << object["two"] << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    2
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operatorarray__key_type_const.cpp -o operatorarray__key_type_const 
    See also
    at(const typename object_t::key_type&) for access by reference with range checking
    @@ -291,7 +276,7 @@ operator[] with null" value() for access by value with a default value
    Since
    version 1.0.0
    -

    Definition at line 2934 of file json.hpp.

    +

    Definition at line 2959 of file json.hpp.

    @@ -301,9 +286,9 @@ operator[] with null" diff --git a/classnlohmann_1_1basic__json_a8e4e11999b4e7faa8f31f21164ebd65a.html b/classnlohmann_1_1basic__json_a8e4e11999b4e7faa8f31f21164ebd65a.html index a23408e4a..bbb28933f 100644 --- a/classnlohmann_1_1basic__json_a8e4e11999b4e7faa8f31f21164ebd65a.html +++ b/classnlohmann_1_1basic__json_a8e4e11999b4e7faa8f31f21164ebd65a.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::iterator_wrapper @@ -33,7 +33,7 @@ - + @@ -250,10 +250,10 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    This functuion allows to access iterator::key() and iterator::value() during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator.

    +

    This function allows to access iterator::key() and iterator::value() during range-based for loops. In these loops, a reference to the JSON values is returned, so there is no access to the underlying iterator.

    Note
    The name of this function is not yet final and may change in the future.
    -

    Definition at line 3811 of file json.hpp.

    +

    Definition at line 3850 of file json.hpp.

    @@ -263,9 +263,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html b/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html index ccaf8b046..9749113a0 100644 --- a/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html +++ b/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::insert @@ -33,7 +33,7 @@ - + @@ -287,36 +287,17 @@ belong to container"
    Returns
    iterator pointing to the first element inserted, or pos if first==last
    Complexity
    Linear in std::distance(first, last) plus linear in the distance between pos and end of the container.
    -
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON array
    -
    8  json v = {1, 2, 3, 4};
    -
    9 
    -
    10  // create a JSON array to copy values from
    -
    11  json v2 = {"one", "two", "three", "four"};
    -
    12 
    -
    13  // insert range from v2 before the end of array v
    -
    14  auto new_pos = v.insert(v.end(), v2.begin(), v2.end());
    -
    15 
    -
    16  // output new array and result of insert call
    -
    17  std::cout << *new_pos << '\n';
    -
    18  std::cout << v << '\n';
    -
    19 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3639
    -
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3580
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4230
    +
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON array
    8  json v = {1, 2, 3, 4};
    9 
    10  // create a JSON array to copy values from
    11  json v2 = {"one", "two", "three", "four"};
    12 
    13  // insert range from v2 before the end of array v
    14  auto new_pos = v.insert(v.end(), v2.begin(), v2.end());
    15 
    16  // output new array and result of insert call
    17  std::cout << *new_pos << '\n';
    18  std::cout << v << '\n';
    19 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3678
    +
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3619
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4281
    Output (play with this example online):
    "one"
     [1,2,3,4,"one","two","three","four"]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/insert__range.cpp -o insert__range 
    Since
    version 1.0.0
    -

    Definition at line 4337 of file json.hpp.

    +

    Definition at line 4390 of file json.hpp.

    @@ -326,9 +307,9 @@ belong to container" diff --git a/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html b/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html index ba276c782..f67ca594c 100644 --- a/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html +++ b/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -252,26 +252,14 @@ template<template< typename U, typename V, typename...Args > class Obje

    Create a null JSON value. This is the explicitly version of the null value constructor as it takes a null pointer as parameter. It allows to create null values by explicitly assigning a nullptr to a JSON value. The passed null pointer itself is not read – it is only used to choose the right constructor.

    Complexity
    Constant.
    -
    Example
    The following code shows the constructor with null pointer parameter.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON null value
    -
    8  json j(nullptr);
    -
    9 
    -
    10  // serialize the JSON null value
    -
    11  std::cout << j << '\n';
    -
    12 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor with null pointer parameter.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON null value
    8  json j(nullptr);
    9 
    10  // serialize the JSON null value
    11  std::cout << j << '\n';
    12 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__nullptr_t.cpp -o basic_json__nullptr_t 
    See also
    basic_json() – default constructor (implicitly creating a null value)
    Since
    version 1.0.0
    -

    Definition at line 910 of file json.hpp.

    +

    Definition at line 911 of file json.hpp.

    @@ -281,9 +269,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a960962c683909619d1d2fbbe856c022e.html b/classnlohmann_1_1basic__json_a960962c683909619d1d2fbbe856c022e.html index 850d8389f..c163f5f0e 100644 --- a/classnlohmann_1_1basic__json_a960962c683909619d1d2fbbe856c022e.html +++ b/classnlohmann_1_1basic__json_a960962c683909619d1d2fbbe856c022e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator+= @@ -33,7 +33,7 @@ - + @@ -264,33 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Amortized constant.
    -
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9  json null;
    -
    10 
    -
    11  // print values
    -
    12  std::cout << array << '\n';
    -
    13  std::cout << null << '\n';
    -
    14 
    -
    15  // add values
    -
    16  array.push_back(6);
    -
    17  array += 7;
    -
    18  null += "first";
    -
    19  null += "second";
    -
    20 
    -
    21  // print values
    -
    22  std::cout << array << '\n';
    -
    23  std::cout << null << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4095
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example shows how push_back and += can be used to add elements to a JSON array. Note how the null value was silently converted to a JSON array.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json array = {1, 2, 3, 4, 5};
    9  json null;
    10 
    11  // print values
    12  std::cout << array << '\n';
    13  std::cout << null << '\n';
    14 
    15  // add values
    16  array.push_back(6);
    17  array += 7;
    18  null += "first";
    19  null += "second";
    20 
    21  // print values
    22  std::cout << array << '\n';
    23  std::cout << null << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4143
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3,4,5]
     null
     [1,2,3,4,5,6,7]
    @@ -298,7 +274,7 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
    Since
    version 1.0.0
    -

    Definition at line 4153 of file json.hpp.

    +

    Definition at line 4203 of file json.hpp.

    @@ -308,9 +284,9 @@ null diff --git a/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html b/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html index 5a40aa7c0..b376f5203 100644 --- a/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html +++ b/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator== @@ -33,7 +33,7 @@ - + @@ -270,29 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether v is null
    Complexity
    Constant.
    Example
    The example compares several JSON types to the null pointer.
    -
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array = {1, 2, 3};
    -
    9  json object = {{"A", "a"}, {"B", "b"}};
    -
    10  json number = 17;
    -
    11  json string = "foo";
    -
    12  json null;
    -
    13 
    -
    14  // output values and comparisons
    -
    15  std::cout << std::boolalpha;
    -
    16  std::cout << array << " == nullptr " << (array == nullptr) << '\n';
    -
    17  std::cout << object << " == nullptr " << (object == nullptr) << '\n';
    -
    18  std::cout << number << " == nullptr " << (number == nullptr) << '\n';
    -
    19  std::cout << string << " == nullptr " << (string == nullptr) << '\n';
    -
    20  std::cout << null << " == nullptr " << (null == nullptr) << '\n';
    -
    21 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array = {1, 2, 3};
    9  json object = {{"A", "a"}, {"B", "b"}};
    10  json number = 17;
    11  json string = "foo";
    12  json null;
    13 
    14  // output values and comparisons
    15  std::cout << std::boolalpha;
    16  std::cout << array << " == nullptr " << (array == nullptr) << '\n';
    17  std::cout << object << " == nullptr " << (object == nullptr) << '\n';
    18  std::cout << number << " == nullptr " << (number == nullptr) << '\n';
    19  std::cout << string << " == nullptr " << (string == nullptr) << '\n';
    20  std::cout << null << " == nullptr " << (null == nullptr) << '\n';
    21 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79

    Output (play with this example online):

    [1,2,3] == nullptr false
     {"A":"a","B":"b"} == nullptr false
     17 == nullptr false
    @@ -300,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     null == nullptr true
     

    The example code above can be translated with

    g++ -std=c++11 -Isrc doc/examples/operator__equal__nullptr_t.cpp -o operator__equal__nullptr_t 
    Since
    version 1.0.0
    -

    Definition at line 4665 of file json.hpp.

    +

    Definition at line 4745 of file json.hpp.

    @@ -310,9 +289,9 @@ null == nullptr true diff --git a/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html b/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html index fa651f69e..606d1530c 100644 --- a/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html +++ b/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator== @@ -33,7 +33,7 @@ - + @@ -270,29 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether v is null
    Complexity
    Constant.
    Example
    The example compares several JSON types to the null pointer.
    -
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array = {1, 2, 3};
    -
    9  json object = {{"A", "a"}, {"B", "b"}};
    -
    10  json number = 17;
    -
    11  json string = "foo";
    -
    12  json null;
    -
    13 
    -
    14  // output values and comparisons
    -
    15  std::cout << std::boolalpha;
    -
    16  std::cout << array << " == nullptr " << (array == nullptr) << '\n';
    -
    17  std::cout << object << " == nullptr " << (object == nullptr) << '\n';
    -
    18  std::cout << number << " == nullptr " << (number == nullptr) << '\n';
    -
    19  std::cout << string << " == nullptr " << (string == nullptr) << '\n';
    -
    20  std::cout << null << " == nullptr " << (null == nullptr) << '\n';
    -
    21 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array = {1, 2, 3};
    9  json object = {{"A", "a"}, {"B", "b"}};
    10  json number = 17;
    11  json string = "foo";
    12  json null;
    13 
    14  // output values and comparisons
    15  std::cout << std::boolalpha;
    16  std::cout << array << " == nullptr " << (array == nullptr) << '\n';
    17  std::cout << object << " == nullptr " << (object == nullptr) << '\n';
    18  std::cout << number << " == nullptr " << (number == nullptr) << '\n';
    19  std::cout << string << " == nullptr " << (string == nullptr) << '\n';
    20  std::cout << null << " == nullptr " << (null == nullptr) << '\n';
    21 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79

    Output (play with this example online):

    [1,2,3] == nullptr false
     {"A":"a","B":"b"} == nullptr false
     17 == nullptr false
    @@ -300,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     null == nullptr true
     

    The example code above can be translated with

    g++ -std=c++11 -Isrc doc/examples/operator__equal__nullptr_t.cpp -o operator__equal__nullptr_t 
    Since
    version 1.0.0
    -

    Definition at line 4674 of file json.hpp.

    +

    Definition at line 4754 of file json.hpp.

    @@ -310,9 +289,9 @@ null == nullptr true diff --git a/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html b/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html index 212016b2f..9fe05d361 100644 --- a/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html +++ b/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_number_integer @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON value is an integer number. This excludes floating-point values.

    Returns
    true if type is an integer number, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_number_integer for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_number_integer()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_number_integer() << '\n';
    -
    19  std::cout << j_boolean.is_number_integer() << '\n';
    -
    20  std::cout << j_number_integer.is_number_integer() << '\n';
    -
    21  std::cout << j_number_float.is_number_integer() << '\n';
    -
    22  std::cout << j_object.is_number_integer() << '\n';
    -
    23  std::cout << j_array.is_number_integer() << '\n';
    -
    24  std::cout << j_string.is_number_integer() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    bool is_number_integer() const noexcept
    return whether value is an integer number
    Definition: json.hpp:2023
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code exemplifies is_number_integer for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_number_integer()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_number_integer() << '\n';
    19  std::cout << j_boolean.is_number_integer() << '\n';
    20  std::cout << j_number_integer.is_number_integer() << '\n';
    21  std::cout << j_number_float.is_number_integer() << '\n';
    22  std::cout << j_object.is_number_integer() << '\n';
    23  std::cout << j_array.is_number_integer() << '\n';
    24  std::cout << j_string.is_number_integer() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    bool is_number_integer() const noexcept
    return whether value is an integer number
    Definition: json.hpp:2034
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    false
     false
     true
    @@ -293,7 +268,7 @@ false
     is_number_float() – check if value is a floating-point number
    Since
    version 1.0.0
    -

    Definition at line 2023 of file json.hpp.

    +

    Definition at line 2034 of file json.hpp.

    @@ -303,9 +278,9 @@ false diff --git a/classnlohmann_1_1basic__json_a9a73d1b71c9e913aa2888d8b40c72ee9.html b/classnlohmann_1_1basic__json_a9a73d1b71c9e913aa2888d8b40c72ee9.html index de4ec9b10..4b74440e1 100644 --- a/classnlohmann_1_1basic__json_a9a73d1b71c9e913aa2888d8b40c72ee9.html +++ b/classnlohmann_1_1basic__json_a9a73d1b71c9e913aa2888d8b40c72ee9.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -269,33 +269,16 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Linear in cnt.
    -
    Example
    The following code shows examples for the basic_json(size_type, const basic_json&) constructor.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array by creating copies of a JSON value
    -
    8  json value = "Hello";
    -
    9  json array_0 = json(0, value);
    -
    10  json array_1 = json(1, value);
    -
    11  json array_5 = json(5, value);
    -
    12 
    -
    13  // serialize the JSON arrays
    -
    14  std::cout << array_0 << '\n';
    -
    15  std::cout << array_1 << '\n';
    -
    16  std::cout << array_5 << '\n';
    -
    17 }
    -
    basic_json<> json
    default JSON class
    Definition: json.hpp:7811
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows examples for the basic_json(size_type, const basic_json&) constructor.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array by creating copies of a JSON value
    8  json value = "Hello";
    9  json array_0 = json(0, value);
    10  json array_1 = json(1, value);
    11  json array_5 = json(5, value);
    12 
    13  // serialize the JSON arrays
    14  std::cout << array_0 << '\n';
    15  std::cout << array_1 << '\n';
    16  std::cout << array_5 << '\n';
    17 }
    basic_json<> json
    default JSON class
    Definition: json.hpp:7968
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    []
     ["Hello"]
     ["Hello","Hello","Hello","Hello","Hello"]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__size_type_basic_json.cpp -o basic_json__size_type_basic_json 
    Since
    version 1.0.0
    -

    Definition at line 1531 of file json.hpp.

    +

    Definition at line 1534 of file json.hpp.

    @@ -305,9 +288,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html b/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html index 3a533eecd..0c8c26ef3 100644 --- a/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html +++ b/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_number_float @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON value is a floating-point number. This excludes integer values.

    Returns
    true if type is a floating-point number, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_number_float for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_number_float()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_number_float() << '\n';
    -
    19  std::cout << j_boolean.is_number_float() << '\n';
    -
    20  std::cout << j_number_integer.is_number_float() << '\n';
    -
    21  std::cout << j_number_float.is_number_float() << '\n';
    -
    22  std::cout << j_object.is_number_float() << '\n';
    -
    23  std::cout << j_array.is_number_float() << '\n';
    -
    24  std::cout << j_string.is_number_float() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    bool is_number_float() const noexcept
    return whether value is a floating-point number
    Definition: json.hpp:2046
    +
    Example
    The following code exemplifies is_number_float for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_number_float()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_number_float() << '\n';
    19  std::cout << j_boolean.is_number_float() << '\n';
    20  std::cout << j_number_integer.is_number_float() << '\n';
    21  std::cout << j_number_float.is_number_float() << '\n';
    22  std::cout << j_object.is_number_float() << '\n';
    23  std::cout << j_array.is_number_float() << '\n';
    24  std::cout << j_string.is_number_float() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    bool is_number_float() const noexcept
    return whether value is a floating-point number
    Definition: json.hpp:2057
    Output (play with this example online):
    false
     false
     false
    @@ -293,7 +268,7 @@ false
     is_number_integer() – check if value is an integer number
    Since
    version 1.0.0
    -

    Definition at line 2046 of file json.hpp.

    +

    Definition at line 2057 of file json.hpp.

    @@ -303,9 +278,9 @@ false diff --git a/classnlohmann_1_1basic__json_a9daafb4c15ed5a008cb825bbd8c29d87.html b/classnlohmann_1_1basic__json_a9daafb4c15ed5a008cb825bbd8c29d87.html index ad2712e6f..28b6b277e 100644 --- a/classnlohmann_1_1basic__json_a9daafb4c15ed5a008cb825bbd8c29d87.html +++ b/classnlohmann_1_1basic__json_a9daafb4c15ed5a008cb825bbd8c29d87.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator[] @@ -33,7 +33,7 @@ - + @@ -270,23 +270,8 @@ operator[] with null"
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be read using the [] operator.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  const json object =
    -
    9  {
    -
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    -
    11  };
    -
    12 
    -
    13  // output element with key "two"
    -
    14  std::cout << object["two"] << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be read using the [] operator.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  const json object =
    9  {
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    11  };
    12 
    13  // output element with key "two"
    14  std::cout << object["two"] << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    2
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operatorarray__key_type_const.cpp -o operatorarray__key_type_const 
    See also
    at(const typename object_t::key_type&) for access by reference with range checking
    @@ -294,7 +279,7 @@ operator[] with null" value() for access by value with a default value
    Since
    version 1.0.0
    -

    Definition at line 3027 of file json.hpp.

    +

    Definition at line 3055 of file json.hpp.

    @@ -304,9 +289,9 @@ operator[] with null" diff --git a/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html b/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html index b27cf69d1..62ed6e22f 100644 --- a/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html +++ b/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_primitive @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON type is primitive (string, number, boolean, or null).

    Returns
    true if type is primitive (string, number, boolean, or null), false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_primitive for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_primitive()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_primitive() << '\n';
    -
    19  std::cout << j_boolean.is_primitive() << '\n';
    -
    20  std::cout << j_number_integer.is_primitive() << '\n';
    -
    21  std::cout << j_number_float.is_primitive() << '\n';
    -
    22  std::cout << j_object.is_primitive() << '\n';
    -
    23  std::cout << j_array.is_primitive() << '\n';
    -
    24  std::cout << j_string.is_primitive() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    bool is_primitive() const noexcept
    return whether type is primitive
    Definition: json.hpp:1918
    +
    Example
    The following code exemplifies is_primitive for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_primitive()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_primitive() << '\n';
    19  std::cout << j_boolean.is_primitive() << '\n';
    20  std::cout << j_number_integer.is_primitive() << '\n';
    21  std::cout << j_number_float.is_primitive() << '\n';
    22  std::cout << j_object.is_primitive() << '\n';
    23  std::cout << j_array.is_primitive() << '\n';
    24  std::cout << j_string.is_primitive() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    bool is_primitive() const noexcept
    return whether type is primitive
    Definition: json.hpp:1929
    Output (play with this example online):
    true
     true
     true
    @@ -290,7 +265,7 @@ true
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_primitive.cpp -o is_primitive 
    Since
    version 1.0.0
    -

    Definition at line 1918 of file json.hpp.

    +

    Definition at line 1929 of file json.hpp.

    @@ -300,9 +275,9 @@ true diff --git a/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html b/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html index 3fa7adde6..1d604d891 100644 --- a/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html +++ b/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::parse @@ -33,7 +33,7 @@ - + @@ -270,69 +270,14 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    result of the deserialization
    Complexity
    Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the parser callback function cb has a super-linear complexity.
    Note
    A UTF-8 byte order mark is silently ignored.
    -
    Example
    The example below demonstrates the parse function with and without callback function.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // a JSON text
    -
    8  auto text = R"(
    -
    9  {
    -
    10  "Image": {
    -
    11  "Width": 800,
    -
    12  "Height": 600,
    -
    13  "Title": "View from 15th Floor",
    -
    14  "Thumbnail": {
    -
    15  "Url": "http://www.example.com/image/481989943",
    -
    16  "Height": 125,
    -
    17  "Width": 100
    -
    18  },
    -
    19  "Animated" : false,
    -
    20  "IDs": [116, 943, 234, 38793]
    -
    21  }
    -
    22  }
    -
    23  )";
    -
    24 
    -
    25  // fill a stream with JSON text
    -
    26  std::stringstream ss;
    -
    27  ss << text;
    -
    28 
    -
    29  // parse and serialize JSON
    -
    30  json j_complete = json::parse(ss);
    -
    31  std::cout << std::setw(4) << j_complete << "\n\n";
    -
    32 
    -
    33 
    -
    34  // define parser callback
    -
    35  json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
    -
    36  {
    -
    37  // skip object elements with key "Thumbnail"
    -
    38  if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
    -
    39  {
    -
    40  return false;
    -
    41  }
    -
    42  else
    -
    43  {
    -
    44  return true;
    -
    45  }
    -
    46  };
    -
    47 
    -
    48  // fill a stream with JSON text
    -
    49  ss.clear();
    -
    50  ss << text;
    -
    51 
    -
    52  // parse (with callback) and serialize JSON
    -
    53  json j_filtered = json::parse(ss, cb);
    -
    54  std::cout << std::setw(4) << j_filtered << '\n';
    -
    55 }
    -
    basic_json<> json
    default JSON class
    Definition: json.hpp:7811
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:819
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4028
    +
    Example
    The example below demonstrates the parse function with and without callback function.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // a JSON text
    8  auto text = R"(
    9  {
    10  "Image": {
    11  "Width": 800,
    12  "Height": 600,
    13  "Title": "View from 15th Floor",
    14  "Thumbnail": {
    15  "Url": "http://www.example.com/image/481989943",
    16  "Height": 125,
    17  "Width": 100
    18  },
    19  "Animated" : false,
    20  "IDs": [116, 943, 234, 38793]
    21  }
    22  }
    23  )";
    24 
    25  // fill a stream with JSON text
    26  std::stringstream ss;
    27  ss << text;
    28 
    29  // parse and serialize JSON
    30  json j_complete = json::parse(ss);
    31  std::cout << std::setw(4) << j_complete << "\n\n";
    32 
    33 
    34  // define parser callback
    35  json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
    36  {
    37  // skip object elements with key "Thumbnail"
    38  if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
    39  {
    40  return false;
    41  }
    42  else
    43  {
    44  return true;
    45  }
    46  };
    47 
    48  // fill a stream with JSON text
    49  ss.clear();
    50  ss << text;
    51 
    52  // parse (with callback) and serialize JSON
    53  json j_filtered = json::parse(ss, cb);
    54  std::cout << std::setw(4) << j_filtered << '\n';
    55 }
    basic_json<> json
    default JSON class
    Definition: json.hpp:7968
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:820
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4073
    the parser read a key of a value in an object
    -
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:4955
    -
    parse_event_t
    JSON callback events.
    Definition: json.hpp:754
    +
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:5057
    +
    parse_event_t
    JSON callback events.
    Definition: json.hpp:755
    Output (play with this example online):
    {
         "Image": {
             "Animated": false,
    @@ -371,7 +316,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    See also
    parse(const string_t&, parser_callback_t) for a version that reads from a string
    Since
    version 1.0.0
    -

    Definition at line 4992 of file json.hpp.

    +

    Definition at line 5094 of file json.hpp.

    @@ -381,9 +326,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aa1f3b3f1dca79392d6727b81f9668c6c.html b/classnlohmann_1_1basic__json_aa1f3b3f1dca79392d6727b81f9668c6c.html index 5391297c3..42828680d 100644 --- a/classnlohmann_1_1basic__json_aa1f3b3f1dca79392d6727b81f9668c6c.html +++ b/classnlohmann_1_1basic__json_aa1f3b3f1dca79392d6727b81f9668c6c.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::back @@ -33,7 +33,7 @@ - + @@ -259,39 +259,11 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows an example for back.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_object_empty(json::value_t::object);
    -
    14  json j_array = {1, 2, 4, 8, 16};
    -
    15  json j_array_empty(json::value_t::array);
    -
    16  json j_string = "Hello, world";
    -
    17 
    -
    18  // call back()
    -
    19  //std::cout << j_null.back() << '\n'; // would throw
    -
    20  std::cout << j_boolean.back() << '\n';
    -
    21  std::cout << j_number_integer.back() << '\n';
    -
    22  std::cout << j_number_float.back() << '\n';
    -
    23  std::cout << j_object.back() << '\n';
    -
    24  //std::cout << j_object_empty.back() << '\n'; // would throw
    -
    25  std::cout << j_array.back() << '\n';
    -
    26  //std::cout << j_array_empty.back() << '\n'; // would throw
    -
    27  std::cout << j_string.back() << '\n';
    -
    28 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code shows an example for back.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_object_empty(json::value_t::object);
    14  json j_array = {1, 2, 4, 8, 16};
    15  json j_array_empty(json::value_t::array);
    16  json j_string = "Hello, world";
    17 
    18  // call back()
    19  //std::cout << j_null.back() << '\n'; // would throw
    20  std::cout << j_boolean.back() << '\n';
    21  std::cout << j_number_integer.back() << '\n';
    22  std::cout << j_number_float.back() << '\n';
    23  std::cout << j_object.back() << '\n';
    24  //std::cout << j_object_empty.back() << '\n'; // would throw
    25  std::cout << j_array.back() << '\n';
    26  //std::cout << j_array_empty.back() << '\n'; // would throw
    27  std::cout << j_string.back() << '\n';
    28 }
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    -
    reference back()
    access the last element
    Definition: json.hpp:3177
    +
    reference back()
    access the last element
    Definition: json.hpp:3207
    Output (play with this example online):
    true
     17
     23.42
    @@ -301,7 +273,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/back.cpp -o back 
    Since
    version 1.0.0
    -

    Definition at line 3177 of file json.hpp.

    +

    Definition at line 3207 of file json.hpp.

    @@ -311,9 +283,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aa5413178b8041f7ac685dec4b040dd2c.html b/classnlohmann_1_1basic__json_aa5413178b8041f7ac685dec4b040dd2c.html index 68830defe..db34442a8 100644 --- a/classnlohmann_1_1basic__json_aa5413178b8041f7ac685dec4b040dd2c.html +++ b/classnlohmann_1_1basic__json_aa5413178b8041f7ac685dec4b040dd2c.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::end @@ -33,7 +33,7 @@ - + @@ -261,33 +261,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).end().
  • -
    Example
    The following code shows an example for cend.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get am iterator to one past the last element
    -
    11  json::const_iterator it = array.cend();
    -
    12 
    -
    13  // decrement the iterator to point to the last element
    -
    14  --it;
    -
    15 
    -
    16  // serialize the element that the iterator points to
    -
    17  std::cout << *it << '\n';
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    const_iterator cend() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3673
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    a const random access iterator for the basic_json class
    Definition: json.hpp:5577
    +
    Example
    The following code shows an example for cend.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get am iterator to one past the last element
    11  json::const_iterator it = array.cend();
    12 
    13  // decrement the iterator to point to the last element
    14  --it;
    15 
    16  // serialize the element that the iterator points to
    17  std::cout << *it << '\n';
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    const_iterator cend() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3712
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    a const random access iterator for the basic_json class
    Definition: json.hpp:5686
    Output (play with this example online):
    5
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/cend.cpp -o cend 
    Since
    version 1.0.0
    -

    Definition at line 3649 of file json.hpp.

    +

    Definition at line 3688 of file json.hpp.

    @@ -297,9 +279,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html b/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html index e28ae65f5..35495a838 100644 --- a/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html +++ b/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::~basic_json @@ -33,7 +33,7 @@ - + @@ -258,7 +258,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    Since
    version 1.0.0
    -

    Definition at line 1797 of file json.hpp.

    +

    Definition at line 1808 of file json.hpp.

    @@ -268,9 +268,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aa6c32f669a2e523666072003d0ea46f4.html b/classnlohmann_1_1basic__json_aa6c32f669a2e523666072003d0ea46f4.html index b4d5d7396..d1b65e02d 100644 --- a/classnlohmann_1_1basic__json_aa6c32f669a2e523666072003d0ea46f4.html +++ b/classnlohmann_1_1basic__json_aa6c32f669a2e523666072003d0ea46f4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -272,49 +272,8 @@ template<class CompatibleObjectType , typename std::enable_if<
    -
    Example
    The following code shows the constructor with several compatible object type parameters.
    1 #include <json.hpp>
    -
    2 #include <unordered_map>
    -
    3 
    -
    4 using namespace nlohmann;
    -
    5 
    -
    6 int main()
    -
    7 {
    -
    8  // create an object from std::map
    -
    9  std::map<std::string, int> c_map
    -
    10  {
    -
    11  {"one", 1}, {"two", 2}, {"three", 3}
    -
    12  };
    -
    13  json j_map(c_map);
    -
    14 
    -
    15  // create an object from std::unordered_map
    -
    16  std::unordered_map<const char*, double> c_umap
    -
    17  {
    -
    18  {"one", 1.2}, {"two", 2.3}, {"three", 3.4}
    -
    19  };
    -
    20  json j_umap(c_umap);
    -
    21 
    -
    22  // create an object from std::multimap
    -
    23  std::multimap<std::string, bool> c_mmap
    -
    24  {
    -
    25  {"one", true}, {"two", true}, {"three", false}, {"three", true}
    -
    26  };
    -
    27  json j_mmap(c_mmap); // only one entry for key "three" is used
    -
    28 
    -
    29  // create an object from std::unordered_multimap
    -
    30  std::unordered_multimap<std::string, bool> c_ummap
    -
    31  {
    -
    32  {"one", true}, {"two", true}, {"three", false}, {"three", true}
    -
    33  };
    -
    34  json j_ummap(c_ummap); // only one entry for key "three" is used
    -
    35 
    -
    36  // serialize the JSON objects
    -
    37  std::cout << j_map << '\n';
    -
    38  std::cout << j_umap << '\n';
    -
    39  std::cout << j_mmap << '\n';
    -
    40  std::cout << j_ummap << '\n';
    -
    41 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor with several compatible object type parameters.
    1 #include <json.hpp>
    2 #include <unordered_map>
    3 
    4 using namespace nlohmann;
    5 
    6 int main()
    7 {
    8  // create an object from std::map
    9  std::map<std::string, int> c_map
    10  {
    11  {"one", 1}, {"two", 2}, {"three", 3}
    12  };
    13  json j_map(c_map);
    14 
    15  // create an object from std::unordered_map
    16  std::unordered_map<const char*, double> c_umap
    17  {
    18  {"one", 1.2}, {"two", 2.3}, {"three", 3.4}
    19  };
    20  json j_umap(c_umap);
    21 
    22  // create an object from std::multimap
    23  std::multimap<std::string, bool> c_mmap
    24  {
    25  {"one", true}, {"two", true}, {"three", false}, {"three", true}
    26  };
    27  json j_mmap(c_mmap); // only one entry for key "three" is used
    28 
    29  // create an object from std::unordered_multimap
    30  std::unordered_multimap<std::string, bool> c_ummap
    31  {
    32  {"one", true}, {"two", true}, {"three", false}, {"three", true}
    33  };
    34  json j_ummap(c_ummap); // only one entry for key "three" is used
    35 
    36  // serialize the JSON objects
    37  std::cout << j_map << '\n';
    38  std::cout << j_umap << '\n';
    39  std::cout << j_mmap << '\n';
    40  std::cout << j_ummap << '\n';
    41 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {"one":1,"three":3,"two":2}
     {"one":1.2,"three":3.4,"two":2.3}
     {"one":true,"three":false,"two":true}
    @@ -323,7 +282,7 @@ template<class CompatibleObjectType , typename std::enable_if<
     
    See also
    basic_json(const object_t&) – create an object value
    Since
    version 1.0.0
    -

    Definition at line 965 of file json.hpp.

    +

    Definition at line 966 of file json.hpp.

    @@ -333,9 +292,9 @@ template<class CompatibleObjectType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html b/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html index 00de18913..0713710f9 100644 --- a/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html +++ b/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::swap @@ -33,7 +33,7 @@ - + @@ -265,36 +265,16 @@ use swap() with string"
    Complexity
    Constant.
    -
    Example
    The example below shows how JSON values can be swapped.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON value
    -
    8  json value = {{"array", {1, 2, 3, 4}}};
    -
    9 
    -
    10  // create an array_t
    -
    11  json::array_t array = {"Snap", "Crackle", "Pop"};
    -
    12 
    -
    13  // swap the array stored in the JSON value
    -
    14  value["array"].swap(array);
    -
    15 
    -
    16  // output the values
    -
    17  std::cout << "value = " << value << '\n';
    -
    18  std::cout << "array = " << array << '\n';
    -
    19 }
    -
    ArrayType< basic_json, AllocatorType< basic_json >> array_t
    a type for an array
    Definition: json.hpp:386
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4431
    +
    Example
    The example below shows how JSON values can be swapped.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON value
    8  json value = {{"array", {1, 2, 3, 4}}};
    9 
    10  // create an array_t
    11  json::array_t array = {"Snap", "Crackle", "Pop"};
    12 
    13  // swap the array stored in the JSON value
    14  value["array"].swap(array);
    15 
    16  // output the values
    17  std::cout << "value = " << value << '\n';
    18  std::cout << "array = " << array << '\n';
    19 }
    ArrayType< basic_json, AllocatorType< basic_json >> array_t
    a type for an array
    Definition: json.hpp:387
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4486
    Output (play with this example online):
    value = {"array":["Snap","Crackle","Pop"]}
     array = [1,2,3,4]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/swap__array_t.cpp -o swap__array_t 
    Since
    version 1.0.0
    -

    Definition at line 4462 of file json.hpp.

    +

    Definition at line 4517 of file json.hpp.

    @@ -304,9 +284,9 @@ array = [1,2,3,4] diff --git a/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html b/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html index c898bee21..680b8791b 100644 --- a/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html +++ b/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::parser_callback_t @@ -33,7 +33,7 @@ - + @@ -273,7 +273,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    See also
    parse(std::istream&, parser_callback_t) or parse(const string_t&, parser_callback_t) for examples
    Since
    version 1.0.0
    -

    Definition at line 819 of file json.hpp.

    +

    Definition at line 820 of file json.hpp.

    @@ -283,9 +283,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aac185a137428a7337aa620de07bfbbd7.html b/classnlohmann_1_1basic__json_aac185a137428a7337aa620de07bfbbd7.html index a500de71d..e5982d214 100644 --- a/classnlohmann_1_1basic__json_aac185a137428a7337aa620de07bfbbd7.html +++ b/classnlohmann_1_1basic__json_aac185a137428a7337aa620de07bfbbd7.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator< @@ -33,7 +33,7 @@ - + @@ -266,7 +266,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    Since
    version 1.0.0
    -

    Definition at line 4561 of file json.hpp.

    +

    Definition at line 4619 of file json.hpp.

    @@ -276,9 +276,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aacd442b66140c764c594ac8ad7dfd5b3.html b/classnlohmann_1_1basic__json_aacd442b66140c764c594ac8ad7dfd5b3.html index 06d49ffb0..718ed7d22 100644 --- a/classnlohmann_1_1basic__json_aacd442b66140c764c594ac8ad7dfd5b3.html +++ b/classnlohmann_1_1basic__json_aacd442b66140c764c594ac8ad7dfd5b3.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator< @@ -33,7 +33,7 @@ - + @@ -274,31 +274,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether lhs is less than rhs
    Complexity
    Linear.
    -
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array_1 = {1, 2, 3};
    -
    9  json array_2 = {1, 2, 4};
    -
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    -
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    -
    12  json number_1 = 17;
    -
    13  json number_2 = 17.0000000000001L;
    -
    14  json string_1 = "foo";
    -
    15  json string_2 = "bar";
    -
    16 
    -
    17  // output values and comparisons
    -
    18  std::cout << std::boolalpha;
    -
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 < array_2) << '\n';
    -
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 < object_2) << '\n';
    -
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 < number_2) << '\n';
    -
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 < string_2) << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example demonstrates comparing several JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array_1 = {1, 2, 3};
    9  json array_2 = {1, 2, 4};
    10  json object_1 = {{"A", "a"}, {"B", "b"}};
    11  json object_2 = {{"B", "b"}, {"A", "a"}};
    12  json number_1 = 17;
    13  json number_2 = 17.0000000000001L;
    14  json string_1 = "foo";
    15  json string_2 = "bar";
    16 
    17  // output values and comparisons
    18  std::cout << std::boolalpha;
    19  std::cout << array_1 << " == " << array_2 << " " << (array_1 < array_2) << '\n';
    20  std::cout << object_1 << " == " << object_2 << " " << (object_1 < object_2) << '\n';
    21  std::cout << number_1 << " == " << number_2 << " " << (number_1 < number_2) << '\n';
    22  std::cout << string_1 << " == " << string_2 << " " << (string_1 < string_2) << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3] == [1,2,4] true
     {"A":"a","B":"b"} == {"A":"a","B":"b"} false
     17 == 17.0000000000001 true
    @@ -306,7 +283,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__less.cpp -o operator__less 
    Since
    version 1.0.0
    -

    Definition at line 4756 of file json.hpp.

    +

    Definition at line 4836 of file json.hpp.

    @@ -316,9 +293,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html b/classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html index f3df051b5..e57de9c0f 100644 --- a/classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html +++ b/classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::number_float_t @@ -33,7 +33,7 @@ - + @@ -245,8 +245,7 @@ template<template< typename U, typename V, typename...Args > class Obje

    To store floating-point numbers in C++, a type is defined by the template parameter NumberFloatType which chooses the type to use.

    Default type

    With the default values for NumberFloatType (double), the default value for number_float_t is:

    -
    double
    -

    Default behavior

    +
    double

    Default behavior

    • The restrictions about leading zeros is not enforced in C++. Instead, leading zeros in floating-point literals will be ignored. Internally, the value will be stored as decimal number. For instance, the C++ floating-point literal 01.2 will be serialized to 1.2. During deserialization, leading zeros yield an error.
    • Not-a-number (NaN) values will be serialized to null.
    • @@ -255,13 +254,13 @@ template<template< typename U, typename V, typename...Args > class Obje

      RFC 7159 states:

      This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754-2008 binary64 (double precision) numbers is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision.

      -

      This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values smaller than -1.79769313486232e+308 and values greather than 1.79769313486232e+308 will be stored as NaN internally and be serialized to null.

      +

      This implementation does exactly follow this approach, as it uses double precision floating-point numbers. Note values smaller than -1.79769313486232e+308 and values greater than 1.79769313486232e+308 will be stored as NaN internally and be serialized to null.

      Storage

      Floating-point number values are stored directly inside a basic_json type.

      See also
      number_integer_t – type for number values (integer)
      Since
      version 1.0.0
      -

      Definition at line 592 of file json.hpp.

      +

      Definition at line 593 of file json.hpp.

      @@ -271,9 +270,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html b/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html index 65b0f5521..d1c102d39 100644 --- a/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html +++ b/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator>> @@ -33,7 +33,7 @@ - + @@ -276,31 +276,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Linear in the length of the input. The parser is a predictive LL(1) parser.
    Note
    A UTF-8 byte order mark is silently ignored.
    -
    Example
    The example below shows how a JSON value is constructed by reading a serialization from a stream.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create stream with serialized JSON
    -
    8  std::stringstream ss;
    -
    9  ss << R"({
    -
    10  "number": 23,
    -
    11  "string": "Hello, world!",
    -
    12  "array": [1, 2, 3, 4, 5],
    -
    13  "boolean": false,
    -
    14  "null": null
    -
    15  })";
    -
    16 
    -
    17  // create JSON value and read the serialization from the stream
    -
    18  json j;
    -
    19  j << ss;
    -
    20 
    -
    21  // serialize JSON
    -
    22  std::cout << std::setw(2) << j << '\n';
    -
    23 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how a JSON value is constructed by reading a serialization from a stream.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create stream with serialized JSON
    8  std::stringstream ss;
    9  ss << R"({
    10  "number": 23,
    11  "string": "Hello, world!",
    12  "array": [1, 2, 3, 4, 5],
    13  "boolean": false,
    14  "null": null
    15  })";
    16 
    17  // create JSON value and read the serialization from the stream
    18  json j;
    19  j << ss;
    20 
    21  // serialize JSON
    22  std::cout << std::setw(2) << j << '\n';
    23 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {
       "array": [
         1,
    @@ -318,7 +295,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    See also
    parse(std::istream&, parser_callback_t) for a variant with a parser callback function to filter values while parsing
    Since
    version 1.0.0
    -

    Definition at line 5030 of file json.hpp.

    +

    Definition at line 5132 of file json.hpp.

    @@ -328,9 +305,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aafa839f2a74dc1b5060314b3423143b8.html b/classnlohmann_1_1basic__json_aafa839f2a74dc1b5060314b3423143b8.html index 43f92015e..29906523d 100644 --- a/classnlohmann_1_1basic__json_aafa839f2a74dc1b5060314b3423143b8.html +++ b/classnlohmann_1_1basic__json_aafa839f2a74dc1b5060314b3423143b8.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::boolean_t @@ -33,7 +33,7 @@ - + @@ -242,12 +242,11 @@ template<template< typename U, typename V, typename...Args > class Obje

    To store objects in C++, a type is defined by the template parameter BooleanType which chooses the type to use.

    Default type

    With the default values for BooleanType (bool), the default value for boolean_t is:

    -
    bool
    -

    Storage

    +
    bool

    Storage

    Boolean values are stored directly inside a basic_json type.

    Since
    version 1.0.0
    -

    Definition at line 459 of file json.hpp.

    +

    Definition at line 460 of file json.hpp.

    @@ -257,9 +256,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ab14e3503305622fb5ab01a7f490916e8.html b/classnlohmann_1_1basic__json_ab14e3503305622fb5ab01a7f490916e8.html index 588732252..e2808c657 100644 --- a/classnlohmann_1_1basic__json_ab14e3503305622fb5ab01a7f490916e8.html +++ b/classnlohmann_1_1basic__json_ab14e3503305622fb5ab01a7f490916e8.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::insert @@ -33,7 +33,7 @@ - + @@ -277,32 +277,16 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    iterator pointing to the first element inserted, or pos if ilist is empty
    Complexity
    Linear in ilist.size() plus linear in the distance between pos and end of the container.
    -
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON array
    -
    8  json v = {1, 2, 3, 4};
    -
    9 
    -
    10  // insert range from v2 before the end of array v
    -
    11  auto new_pos = v.insert(v.end(), {7, 8, 9});
    -
    12 
    -
    13  // output new array and result of insert call
    -
    14  std::cout << *new_pos << '\n';
    -
    15  std::cout << v << '\n';
    -
    16 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3639
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4230
    +
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON array
    8  json v = {1, 2, 3, 4};
    9 
    10  // insert range from v2 before the end of array v
    11  auto new_pos = v.insert(v.end(), {7, 8, 9});
    12 
    13  // output new array and result of insert call
    14  std::cout << *new_pos << '\n';
    15  std::cout << v << '\n';
    16 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3678
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4281
    Output (play with this example online):
    7
     [1,2,3,4,7,8,9]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/insert__ilist.cpp -o insert__ilist 
    Since
    version 1.0.0
    -

    Definition at line 4394 of file json.hpp.

    +

    Definition at line 4448 of file json.hpp.

    @@ -312,9 +296,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ab2162bc76e10d8736cab9b2039956054.html b/classnlohmann_1_1basic__json_ab2162bc76e10d8736cab9b2039956054.html index 35bbbc8c9..7fcfeea3e 100644 --- a/classnlohmann_1_1basic__json_ab2162bc76e10d8736cab9b2039956054.html +++ b/classnlohmann_1_1basic__json_ab2162bc76e10d8736cab9b2039956054.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::end @@ -33,7 +33,7 @@ - + @@ -260,33 +260,15 @@ Illustration from cppreference.com
  • The complexity is constant.
  • -
    Example
    The following code shows an example for end.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get am iterator to one past the last element
    -
    11  json::iterator it = array.end();
    -
    12 
    -
    13  // decrement the iterator to point to the last element
    -
    14  --it;
    -
    15 
    -
    16  // serialize the element that the iterator points to
    -
    17  std::cout << *it << '\n';
    -
    18 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    a mutable random access iterator for the basic_json class
    Definition: json.hpp:6079
    -
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3639
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows an example for end.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get am iterator to one past the last element
    11  json::iterator it = array.end();
    12 
    13  // decrement the iterator to point to the last element
    14  --it;
    15 
    16  // serialize the element that the iterator points to
    17  std::cout << *it << '\n';
    18 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    a mutable random access iterator for the basic_json class
    Definition: json.hpp:6228
    +
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3678
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    5
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/end.cpp -o end 
    Since
    version 1.0.0
    -

    Definition at line 3639 of file json.hpp.

    +

    Definition at line 3678 of file json.hpp.

    @@ -296,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_ab74b2398f29acc6ffbf48f1b8974a848.html b/classnlohmann_1_1basic__json_ab74b2398f29acc6ffbf48f1b8974a848.html index 95c59a88b..94039f345 100644 --- a/classnlohmann_1_1basic__json_ab74b2398f29acc6ffbf48f1b8974a848.html +++ b/classnlohmann_1_1basic__json_ab74b2398f29acc6ffbf48f1b8974a848.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -266,35 +266,8 @@ template<typename CompatibleNumberIntegerType , typename std::enable_if<
    Complexity
    Constant.
    -
    Example
    The example below shows the construction of several JSON integer number values from compatible types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create values of different integer types
    -
    8  short n42 = 42;
    -
    9  int n23 = 23;
    -
    10  long n1024 = 1024;
    -
    11  int_least32_t n17 = 17;
    -
    12  uint8_t n8 = 8;
    -
    13 
    -
    14  // create JSON numbers
    -
    15  json j42(n42);
    -
    16  json j23(n23);
    -
    17  json j1024(n1024);
    -
    18  json j17(n17);
    -
    19  json j8(n8);
    -
    20 
    -
    21  // serialize the JSON numbers
    -
    22  std::cout << j42 << '\n';
    -
    23  std::cout << j23 << '\n';
    -
    24  std::cout << j1024 << '\n';
    -
    25  std::cout << j17 << '\n';
    -
    26  std::cout << j8 << '\n';
    -
    27 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows the construction of several JSON integer number values from compatible types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create values of different integer types
    8  short n42 = 42;
    9  int n23 = 23;
    10  long n1024 = 1024;
    11  int_least32_t n17 = 17;
    12  uint8_t n8 = 8;
    13 
    14  // create JSON numbers
    15  json j42(n42);
    16  json j23(n23);
    17  json j1024(n1024);
    18  json j17(n17);
    19  json j8(n8);
    20 
    21  // serialize the JSON numbers
    22  std::cout << j42 << '\n';
    23  std::cout << j23 << '\n';
    24  std::cout << j1024 << '\n';
    25  std::cout << j17 << '\n';
    26  std::cout << j8 << '\n';
    27 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    42
     23
     1024
    @@ -306,7 +279,7 @@ template<typename CompatibleNumberIntegerType , typename std::enable_if<
     basic_json(const int) – create a number value (integer)
    Since
    version 1.0.0
    -

    Definition at line 1229 of file json.hpp.

    +

    Definition at line 1230 of file json.hpp.

    @@ -316,9 +289,9 @@ template<typename CompatibleNumberIntegerType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_ab7d60fb6cb8e8f5740e588f9dc953819.html b/classnlohmann_1_1basic__json_ab7d60fb6cb8e8f5740e588f9dc953819.html index bd4625f09..0ba5f91ec 100644 --- a/classnlohmann_1_1basic__json_ab7d60fb6cb8e8f5740e588f9dc953819.html +++ b/classnlohmann_1_1basic__json_ab7d60fb6cb8e8f5740e588f9dc953819.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -272,66 +272,8 @@ template<class CompatibleArrayType , typename std::enable_if<
    -
    Example
    The following code shows the constructor with several compatible array type parameters.
    1 #include <json.hpp>
    -
    2 #include <deque>
    -
    3 #include <list>
    -
    4 #include <forward_list>
    -
    5 #include <set>
    -
    6 #include <unordered_set>
    -
    7 
    -
    8 using namespace nlohmann;
    -
    9 
    -
    10 int main()
    -
    11 {
    -
    12  // create an array from std::vector
    -
    13  std::vector<int> c_vector {1, 2, 3, 4};
    -
    14  json j_vec(c_vector);
    -
    15 
    -
    16  // create an array from std::deque
    -
    17  std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
    -
    18  json j_deque(c_deque);
    -
    19 
    -
    20  // create an array from std::list
    -
    21  std::list<bool> c_list {true, true, false, true};
    -
    22  json j_list(c_list);
    -
    23 
    -
    24  // create an array from std::forward_list
    -
    25  std::forward_list<int64_t> c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543};
    -
    26  json j_flist(c_flist);
    -
    27 
    -
    28  // create an array from std::array
    -
    29  std::array<unsigned long, 4> c_array {{1, 2, 3, 4}};
    -
    30  json j_array(c_array);
    -
    31 
    -
    32  // create an array from std::set
    -
    33  std::set<std::string> c_set {"one", "two", "three", "four", "one"};
    -
    34  json j_set(c_set); // only one entry for "one" is used
    -
    35 
    -
    36  // create an array from std::unordered_set
    -
    37  std::unordered_set<std::string> c_uset {"one", "two", "three", "four", "one"};
    -
    38  json j_uset(c_uset); // only one entry for "one" is used
    -
    39 
    -
    40  // create an array from std::multiset
    -
    41  std::multiset<std::string> c_mset {"one", "two", "one", "four"};
    -
    42  json j_mset(c_mset); // only one entry for "one" is used
    -
    43 
    -
    44  // create an array from std::unordered_multiset
    -
    45  std::unordered_multiset<std::string> c_umset {"one", "two", "one", "four"};
    -
    46  json j_umset(c_umset); // both entries for "one" are used
    -
    47 
    -
    48  // serialize the JSON arrays
    -
    49  std::cout << j_vec << '\n';
    -
    50  std::cout << j_deque << '\n';
    -
    51  std::cout << j_list << '\n';
    -
    52  std::cout << j_flist << '\n';
    -
    53  std::cout << j_array << '\n';
    -
    54  std::cout << j_set << '\n';
    -
    55  std::cout << j_uset << '\n';
    -
    56  std::cout << j_mset << '\n';
    -
    57  std::cout << j_umset << '\n';
    -
    58 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor with several compatible array type parameters.
    1 #include <json.hpp>
    2 #include <deque>
    3 #include <list>
    4 #include <forward_list>
    5 #include <set>
    6 #include <unordered_set>
    7 
    8 using namespace nlohmann;
    9 
    10 int main()
    11 {
    12  // create an array from std::vector
    13  std::vector<int> c_vector {1, 2, 3, 4};
    14  json j_vec(c_vector);
    15 
    16  // create an array from std::deque
    17  std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
    18  json j_deque(c_deque);
    19 
    20  // create an array from std::list
    21  std::list<bool> c_list {true, true, false, true};
    22  json j_list(c_list);
    23 
    24  // create an array from std::forward_list
    25  std::forward_list<int64_t> c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543};
    26  json j_flist(c_flist);
    27 
    28  // create an array from std::array
    29  std::array<unsigned long, 4> c_array {{1, 2, 3, 4}};
    30  json j_array(c_array);
    31 
    32  // create an array from std::set
    33  std::set<std::string> c_set {"one", "two", "three", "four", "one"};
    34  json j_set(c_set); // only one entry for "one" is used
    35 
    36  // create an array from std::unordered_set
    37  std::unordered_set<std::string> c_uset {"one", "two", "three", "four", "one"};
    38  json j_uset(c_uset); // only one entry for "one" is used
    39 
    40  // create an array from std::multiset
    41  std::multiset<std::string> c_mset {"one", "two", "one", "four"};
    42  json j_mset(c_mset); // only one entry for "one" is used
    43 
    44  // create an array from std::unordered_multiset
    45  std::unordered_multiset<std::string> c_umset {"one", "two", "one", "four"};
    46  json j_umset(c_umset); // both entries for "one" are used
    47 
    48  // serialize the JSON arrays
    49  std::cout << j_vec << '\n';
    50  std::cout << j_deque << '\n';
    51  std::cout << j_list << '\n';
    52  std::cout << j_flist << '\n';
    53  std::cout << j_array << '\n';
    54  std::cout << j_set << '\n';
    55  std::cout << j_uset << '\n';
    56  std::cout << j_mset << '\n';
    57  std::cout << j_umset << '\n';
    58 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    [1,2,3,4]
     [1.2,2.3,3.4,5.6]
     [true,true,false,true]
    @@ -345,7 +287,7 @@ template<class CompatibleArrayType , typename std::enable_if<
     
    See also
    basic_json(const array_t&) – create an array value
    Since
    version 1.0.0
    -

    Definition at line 1029 of file json.hpp.

    +

    Definition at line 1030 of file json.hpp.

    @@ -355,9 +297,9 @@ template<class CompatibleArrayType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html b/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html index 76ad60710..d322cf759 100644 --- a/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html +++ b/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::size @@ -33,7 +33,7 @@ - + @@ -273,38 +273,10 @@ template<template< typename U, typename V, typename...Args > class Obje
  • Has the semantics of std::distance(begin(), end()).
  • -
    Example
    The following code calls size on the different value types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_object_empty(json::value_t::object);
    -
    14  json j_array = {1, 2, 4, 8, 16};
    -
    15  json j_array_empty(json::value_t::array);
    -
    16  json j_string = "Hello, world";
    -
    17 
    -
    18  // call size()
    -
    19  std::cout << j_null.size() << '\n';
    -
    20  std::cout << j_boolean.size() << '\n';
    -
    21  std::cout << j_number_integer.size() << '\n';
    -
    22  std::cout << j_number_float.size() << '\n';
    -
    23  std::cout << j_object.size() << '\n';
    -
    24  std::cout << j_object_empty.size() << '\n';
    -
    25  std::cout << j_array.size() << '\n';
    -
    26  std::cout << j_array_empty.size() << '\n';
    -
    27  std::cout << j_string.size() << '\n';
    -
    28 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    size_type size() const noexcept
    returns the number of elements
    Definition: json.hpp:3911
    +
    Example
    The following code calls size on the different value types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_object_empty(json::value_t::object);
    14  json j_array = {1, 2, 4, 8, 16};
    15  json j_array_empty(json::value_t::array);
    16  json j_string = "Hello, world";
    17 
    18  // call size()
    19  std::cout << j_null.size() << '\n';
    20  std::cout << j_boolean.size() << '\n';
    21  std::cout << j_number_integer.size() << '\n';
    22  std::cout << j_number_float.size() << '\n';
    23  std::cout << j_object.size() << '\n';
    24  std::cout << j_object_empty.size() << '\n';
    25  std::cout << j_array.size() << '\n';
    26  std::cout << j_array_empty.size() << '\n';
    27  std::cout << j_string.size() << '\n';
    28 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    size_type size() const noexcept
    returns the number of elements
    Definition: json.hpp:3952
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    Output (play with this example online):
    0
     1
    @@ -318,7 +290,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/size.cpp -o size 
    Since
    version 1.0.0
    -

    Definition at line 3911 of file json.hpp.

    +

    Definition at line 3952 of file json.hpp.

    @@ -328,9 +300,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ab9da2afc6f77295f25252725fde142a6.html b/classnlohmann_1_1basic__json_ab9da2afc6f77295f25252725fde142a6.html index d26b09dd4..a1ccfca35 100644 --- a/classnlohmann_1_1basic__json_ab9da2afc6f77295f25252725fde142a6.html +++ b/classnlohmann_1_1basic__json_ab9da2afc6f77295f25252725fde142a6.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::back @@ -33,7 +33,7 @@ - + @@ -259,39 +259,11 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows an example for back.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_object_empty(json::value_t::object);
    -
    14  json j_array = {1, 2, 4, 8, 16};
    -
    15  json j_array_empty(json::value_t::array);
    -
    16  json j_string = "Hello, world";
    -
    17 
    -
    18  // call back()
    -
    19  //std::cout << j_null.back() << '\n'; // would throw
    -
    20  std::cout << j_boolean.back() << '\n';
    -
    21  std::cout << j_number_integer.back() << '\n';
    -
    22  std::cout << j_number_float.back() << '\n';
    -
    23  std::cout << j_object.back() << '\n';
    -
    24  //std::cout << j_object_empty.back() << '\n'; // would throw
    -
    25  std::cout << j_array.back() << '\n';
    -
    26  //std::cout << j_array_empty.back() << '\n'; // would throw
    -
    27  std::cout << j_string.back() << '\n';
    -
    28 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    +
    Example
    The following code shows an example for back.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_object_empty(json::value_t::object);
    14  json j_array = {1, 2, 4, 8, 16};
    15  json j_array_empty(json::value_t::array);
    16  json j_string = "Hello, world";
    17 
    18  // call back()
    19  //std::cout << j_null.back() << '\n'; // would throw
    20  std::cout << j_boolean.back() << '\n';
    21  std::cout << j_number_integer.back() << '\n';
    22  std::cout << j_number_float.back() << '\n';
    23  std::cout << j_object.back() << '\n';
    24  //std::cout << j_object_empty.back() << '\n'; // would throw
    25  std::cout << j_array.back() << '\n';
    26  //std::cout << j_array_empty.back() << '\n'; // would throw
    27  std::cout << j_string.back() << '\n';
    28 }
    a class to store JSON values
    Definition: json.hpp:188
    object (unordered set of name/value pairs)
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    array (ordered collection of values)
    -
    reference back()
    access the last element
    Definition: json.hpp:3177
    +
    reference back()
    access the last element
    Definition: json.hpp:3207
    Output (play with this example online):
    true
     17
     23.42
    @@ -301,7 +273,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/back.cpp -o back 
    Since
    version 1.0.0
    -

    Definition at line 3187 of file json.hpp.

    +

    Definition at line 3217 of file json.hpp.

    @@ -311,9 +283,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_abe8f3224ca4041908ddb466cb9caecf1.html b/classnlohmann_1_1basic__json_abe8f3224ca4041908ddb466cb9caecf1.html index 2c0c45642..2529209c6 100644 --- a/classnlohmann_1_1basic__json_abe8f3224ca4041908ddb466cb9caecf1.html +++ b/classnlohmann_1_1basic__json_abe8f3224ca4041908ddb466cb9caecf1.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::max_size @@ -33,7 +33,7 @@ - + @@ -273,33 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
  • Has the semantics of returning b.size() where b is the largest possible JSON value.
  • -
    Example
    The following code calls max_size on the different value types. Note the output is implementation specific.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call max_size()
    -
    17  std::cout << j_null.max_size() << '\n';
    -
    18  std::cout << j_boolean.max_size() << '\n';
    -
    19  std::cout << j_number_integer.max_size() << '\n';
    -
    20  std::cout << j_number_float.max_size() << '\n';
    -
    21  std::cout << j_object.max_size() << '\n';
    -
    22  std::cout << j_array.max_size() << '\n';
    -
    23  std::cout << j_string.max_size() << '\n';
    -
    24 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    size_type max_size() const noexcept
    returns the maximum possible number of elements
    Definition: json.hpp:3971
    +
    Example
    The following code calls max_size on the different value types. Note the output is implementation specific.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call max_size()
    17  std::cout << j_null.max_size() << '\n';
    18  std::cout << j_boolean.max_size() << '\n';
    19  std::cout << j_number_integer.max_size() << '\n';
    20  std::cout << j_number_float.max_size() << '\n';
    21  std::cout << j_object.max_size() << '\n';
    22  std::cout << j_array.max_size() << '\n';
    23  std::cout << j_string.max_size() << '\n';
    24 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    size_type max_size() const noexcept
    returns the maximum possible number of elements
    Definition: json.hpp:4014
    Output (play with this example online):
    0
     1
     1
    @@ -310,7 +286,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/max_size.cpp -o max_size 
    Since
    version 1.0.0
    -

    Definition at line 3971 of file json.hpp.

    +

    Definition at line 4014 of file json.hpp.

    @@ -320,9 +296,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ac160789f17d206a5404981ca0957e303.html b/classnlohmann_1_1basic__json_ac160789f17d206a5404981ca0957e303.html index 57302cb02..034ba4b54 100644 --- a/classnlohmann_1_1basic__json_ac160789f17d206a5404981ca0957e303.html +++ b/classnlohmann_1_1basic__json_ac160789f17d206a5404981ca0957e303.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -259,23 +259,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Note
    This constructor allows to pass enums directly to a constructor. As C++ has no way of specifying the type of an anonymous enum explicitly, we can only rely on the fact that such values implicitly convert to int. As int may already be the same type of number_integer_t, we may need to switch off the constructor basic_json(const number_integer_t).
    Complexity
    Constant.
    -
    Example
    The example below shows the construction of a JSON integer number value from an anonymous enum.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // an anonymous enum
    -
    8  enum { t = 17 };
    -
    9 
    -
    10  // create a JSON number from the enum
    -
    11  json j(t);
    -
    12 
    -
    13  // serialize the JSON numbers
    -
    14  std::cout << j << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows the construction of a JSON integer number value from an anonymous enum.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // an anonymous enum
    8  enum { t = 17 };
    9 
    10  // create a JSON number from the enum
    11  json j(t);
    12 
    13  // serialize the JSON numbers
    14  std::cout << j << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    17
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__const_int.cpp -o basic_json__const_int 
    See also
    basic_json(const number_integer_t) – create a number value (integer)
    @@ -283,7 +268,7 @@ template<template< typename U, typename V, typename...Args > class Obje basic_json(const CompatibleNumberIntegerType) – create a number value (integer) from a compatible number type
    Since
    version 1.0.0
    -

    Definition at line 1194 of file json.hpp.

    +

    Definition at line 1195 of file json.hpp.

    @@ -293,9 +278,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ac4011bd0781e51afe4994d2b09fd27e9.html b/classnlohmann_1_1basic__json_ac4011bd0781e51afe4994d2b09fd27e9.html index b81427c67..4620fee15 100644 --- a/classnlohmann_1_1basic__json_ac4011bd0781e51afe4994d2b09fd27e9.html +++ b/classnlohmann_1_1basic__json_ac4011bd0781e51afe4994d2b09fd27e9.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::const_reference @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 215 of file json.hpp.

    +

    Definition at line 216 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ac8163abe518595f19dbee68db1caaaf7.html b/classnlohmann_1_1basic__json_ac8163abe518595f19dbee68db1caaaf7.html index 0b4b92e74..72dc215ec 100644 --- a/classnlohmann_1_1basic__json_ac8163abe518595f19dbee68db1caaaf7.html +++ b/classnlohmann_1_1basic__json_ac8163abe518595f19dbee68db1caaaf7.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_object @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON value is an object.

    Returns
    true if type is object, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_object for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_object()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_object() << '\n';
    -
    19  std::cout << j_boolean.is_object() << '\n';
    -
    20  std::cout << j_number_integer.is_object() << '\n';
    -
    21  std::cout << j_number_float.is_object() << '\n';
    -
    22  std::cout << j_object.is_object() << '\n';
    -
    23  std::cout << j_array.is_object() << '\n';
    -
    24  std::cout << j_string.is_object() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    bool is_object() const noexcept
    return whether value is an object
    Definition: json.hpp:2065
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code exemplifies is_object for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_object()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_object() << '\n';
    19  std::cout << j_boolean.is_object() << '\n';
    20  std::cout << j_number_integer.is_object() << '\n';
    21  std::cout << j_number_float.is_object() << '\n';
    22  std::cout << j_object.is_object() << '\n';
    23  std::cout << j_array.is_object() << '\n';
    24  std::cout << j_string.is_object() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    bool is_object() const noexcept
    return whether value is an object
    Definition: json.hpp:2076
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    false
     false
     false
    @@ -290,7 +265,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_object.cpp -o is_object 
    Since
    version 1.0.0
    -

    Definition at line 2065 of file json.hpp.

    +

    Definition at line 2076 of file json.hpp.

    @@ -300,9 +275,9 @@ false diff --git a/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html b/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html index 8530ed777..9ef98f9a0 100644 --- a/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html +++ b/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::array_t @@ -33,7 +33,7 @@ - + @@ -251,11 +251,7 @@ template<template< typename U, typename V, typename...Args > class Obje

    Default type

    With the default values for ArrayType (std::vector) and AllocatorType (std::allocator), the default value for array_t is:

    -
    std::vector<
    -
    basic_json, // value_type
    -
    std::allocator<basic_json> // allocator_type
    -
    >
    -

    Limits

    +
    std::vector<
    basic_json, // value_type
    std::allocator<basic_json> // allocator_type
    >

    Limits

    RFC 7159 specifies:

    An implementation may set limits on the maximum depth of nesting.

    @@ -265,7 +261,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    See also
    object_t – type for an object value
    Since
    version 1.0.0
    -

    Definition at line 386 of file json.hpp.

    +

    Definition at line 387 of file json.hpp.

    @@ -275,9 +271,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ac943391891fcde0a71a15ce990e0f7f4.html b/classnlohmann_1_1basic__json_ac943391891fcde0a71a15ce990e0f7f4.html index 362725e1a..c8326401a 100644 --- a/classnlohmann_1_1basic__json_ac943391891fcde0a71a15ce990e0f7f4.html +++ b/classnlohmann_1_1basic__json_ac943391891fcde0a71a15ce990e0f7f4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -269,30 +269,14 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows an example for the copy constructor.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON array
    -
    8  json j1 = {"one", "two", 3, 4.5, false};
    -
    9 
    -
    10  // create a copy
    -
    11  json j2(j1);
    -
    12 
    -
    13  // serialize the JSON array
    -
    14  std::cout << j1 << " = " << j2 << '\n';
    -
    15  std::cout << std::boolalpha << (j1 == j2) << '\n';
    -
    16 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows an example for the copy constructor.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON array
    8  json j1 = {"one", "two", 3, 4.5, false};
    9 
    10  // create a copy
    11  json j2(j1);
    12 
    13  // serialize the JSON array
    14  std::cout << j1 << " = " << j2 << '\n';
    15  std::cout << std::boolalpha << (j1 == j2) << '\n';
    16 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    ["one","two",3,4.5,false] = ["one","two",3,4.5,false]
     true
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__basic_json.cpp -o basic_json__basic_json 
    Since
    version 1.0.0
    -

    Definition at line 1675 of file json.hpp.

    +

    Definition at line 1683 of file json.hpp.

    @@ -302,9 +286,9 @@ true diff --git a/classnlohmann_1_1basic__json_acd08f9179c8c1e9f2cd7575a724ce27e.html b/classnlohmann_1_1basic__json_acd08f9179c8c1e9f2cd7575a724ce27e.html index 5bba23049..926657131 100644 --- a/classnlohmann_1_1basic__json_acd08f9179c8c1e9f2cd7575a724ce27e.html +++ b/classnlohmann_1_1basic__json_acd08f9179c8c1e9f2cd7575a724ce27e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -252,7 +252,7 @@ template<typename T , typename std::enable_if<
    -

    Create an interger number JSON value with a given content.

    +

    Create an integer number JSON value with a given content.

    Template Parameters
    @@ -267,23 +267,9 @@ template<typename T , typename std::enable_if<
    Note
    This constructor would have the same signature as basic_json(const int value), so we need to switch this one off in case number_integer_t is the same as int. This is done via the helper type T.
    Complexity
    Constant.
    -
    Example
    The example below shows the construction of a JSON integer number value.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON number from number_integer_t
    -
    8  json::number_integer_t value = 42;
    -
    9 
    -
    10  json j(value);
    -
    11 
    -
    12  // serialize the JSON numbers
    -
    13  std::cout << j << '\n';
    -
    14 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:527
    +
    Example
    The example below shows the construction of a JSON integer number value.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON number from number_integer_t
    8  json::number_integer_t value = 42;
    9 
    10  json j(value);
    11 
    12  // serialize the JSON numbers
    13  std::cout << j << '\n';
    14 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:528
    Output (play with this example online):
    42
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__number_integer_t.cpp -o basic_json__number_integer_t 
    See also
    basic_json(const int) – create a number value (integer)
    @@ -291,7 +277,7 @@ template<typename T , typename std::enable_if< basic_json(const CompatibleNumberIntegerType) – create a number value (integer) from a compatible number type
    Since
    version 1.0.0
    -

    Definition at line 1165 of file json.hpp.

    +

    Definition at line 1166 of file json.hpp.

    @@ -301,9 +287,9 @@ template<typename T , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html b/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html index 65e19b3a8..a5ee331ed 100644 --- a/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html +++ b/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html @@ -3,7 +3,7 @@ - +JSON for Modern C++: nlohmann::basic_json::begin @@ -33,7 +33,7 @@
    Thelper type to compare number_integer_t and int (not visible in) the interface.
    - + @@ -260,30 +260,15 @@ Illustration from cppreference.com
  • The complexity is constant.
  • -
    Example
    The following code shows an example for begin.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get am iterator to the first element
    -
    11  json::iterator it = array.begin();
    -
    12 
    -
    13  // serialize the element that the iterator points to
    -
    14  std::cout << *it << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    a mutable random access iterator for the basic_json class
    Definition: json.hpp:6079
    -
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3580
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows an example for begin.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get am iterator to the first element
    11  json::iterator it = array.begin();
    12 
    13  // serialize the element that the iterator points to
    14  std::cout << *it << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    a mutable random access iterator for the basic_json class
    Definition: json.hpp:6228
    +
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3619
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    1
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/begin.cpp -o begin 
    Since
    version 1.0.0
    -

    Definition at line 3580 of file json.hpp.

    +

    Definition at line 3619 of file json.hpp.

    @@ -293,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html b/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html index 42073c366..fa68e97c3 100644 --- a/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html +++ b/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::string_t @@ -33,7 +33,7 @@ - + @@ -250,8 +250,7 @@ template<template< typename U, typename V, typename...Args > class Obje

    Default type

    With the default values for StringType (std::string), the default value for string_t is:

    -
    std::string
    -

    String comparison

    +
    std::string

    String comparison

    RFC 7159 states:

    Software implementations are typically required to test names of object members for equality. Implementations that transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may incorrectly find that "a\\\\b" and "a\\u005Cb" are not equal.

    @@ -260,7 +259,7 @@ template<template< typename U, typename V, typename...Args > class Obje

    String values are stored as pointers in a basic_json type. That is, for any access to string values, a pointer of type string_t* must be dereferenced.

    Since
    version 1.0.0
    -

    Definition at line 433 of file json.hpp.

    +

    Definition at line 434 of file json.hpp.

    @@ -270,9 +269,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html b/classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html index 27907e266..af2d33609 100644 --- a/classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html +++ b/classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::object @@ -33,7 +33,7 @@ - + @@ -250,7 +250,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Creates a JSON object value from a given initializer list. The initializer lists elements must be pairs, and their first elments must be strings. If the initializer list is empty, the empty object {} is created.

    +

    Creates a JSON object value from a given initializer list. The initializer lists elements must be pairs, and their first elements must be strings. If the initializer list is empty, the empty object {} is created.

    Note
    This function is only added for symmetry reasons. In contrast to the related function array(std::initializer_list<basic_json>), there are no cases which can only be expressed by this function. That is, any initializer list init can also be passed to the initializer list constructor basic_json(std::initializer_list<basic_json>, bool, value_t).
    Parameters
    @@ -266,26 +266,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Linear in the size of init.
    -
    Example
    The following code shows an example for the object function.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON objects
    -
    8  json j_no_init_list = json::object();
    -
    9  json j_empty_init_list = json::object({});
    -
    10  json j_list_of_pairs = json::object({ {"one", 1}, {"two", 2} });
    -
    11  //json j_invalid_list = json::object({ "one", 1 }); // would throw
    -
    12 
    -
    13  // serialize the JSON objects
    -
    14  std::cout << j_no_init_list << '\n';
    -
    15  std::cout << j_empty_init_list << '\n';
    -
    16  std::cout << j_list_of_pairs << '\n';
    -
    17 }
    -
    static basic_json object(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an object from an initializer list
    Definition: json.hpp:1507
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows an example for the object function.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON objects
    8  json j_no_init_list = json::object();
    9  json j_empty_init_list = json::object({});
    10  json j_list_of_pairs = json::object({ {"one", 1}, {"two", 2} });
    11  //json j_invalid_list = json::object({ "one", 1 }); // would throw
    12 
    13  // serialize the JSON objects
    14  std::cout << j_no_init_list << '\n';
    15  std::cout << j_empty_init_list << '\n';
    16  std::cout << j_list_of_pairs << '\n';
    17 }
    static basic_json object(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an object from an initializer list
    Definition: json.hpp:1510
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {}
     {}
     {"one":1,"two":2}
    @@ -295,7 +278,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     array(std::initializer_list<basic_json>) – create a JSON array value from an initializer list
    Since
    version 1.0.0
    -

    Definition at line 1507 of file json.hpp.

    +

    Definition at line 1510 of file json.hpp.

    @@ -305,9 +288,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html b/classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html index 84266a4ef..1dfb0034d 100644 --- a/classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html +++ b/classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::get_allocator @@ -33,7 +33,7 @@
    - + @@ -250,7 +250,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 249 of file json.hpp.

    +

    Definition at line 250 of file json.hpp.

    @@ -260,9 +260,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ad497cbc4f80c8d79662ee6e19bf145dd.html b/classnlohmann_1_1basic__json_ad497cbc4f80c8d79662ee6e19bf145dd.html index e3e2153fb..709a9bcfd 100644 --- a/classnlohmann_1_1basic__json_ad497cbc4f80c8d79662ee6e19bf145dd.html +++ b/classnlohmann_1_1basic__json_ad497cbc4f80c8d79662ee6e19bf145dd.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::erase @@ -33,7 +33,7 @@ - + @@ -294,42 +294,12 @@ erase() with null"
  • other types: constant
  • -
    Example
    The example shows the result of erase for different JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_boolean = true;
    -
    9  json j_number_integer = 17;
    -
    10  json j_number_float = 23.42;
    -
    11  json j_object = {{"one", 1}, {"two", 2}};
    -
    12  json j_array = {1, 2, 4, 8, 16};
    -
    13  json j_string = "Hello, world";
    -
    14 
    -
    15  // call erase
    -
    16  j_boolean.erase(j_boolean.begin(), j_boolean.end());
    -
    17  j_number_integer.erase(j_number_integer.begin(), j_number_integer.end());
    -
    18  j_number_float.erase(j_number_float.begin(), j_number_float.end());
    -
    19  j_object.erase(j_object.find("two"), j_object.end());
    -
    20  j_array.erase(j_array.begin() + 1, j_array.begin() + 3);
    -
    21  j_string.erase(j_string.begin(), j_string.end());
    -
    22 
    -
    23  // print values
    -
    24  std::cout << j_boolean << '\n';
    -
    25  std::cout << j_number_integer << '\n';
    -
    26  std::cout << j_number_float << '\n';
    -
    27  std::cout << j_object << '\n';
    -
    28  std::cout << j_array << '\n';
    -
    29  std::cout << j_string << '\n';
    -
    30 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3639
    -
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3580
    -
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3500
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3244
    +
    Example
    The example shows the result of erase for different JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_boolean = true;
    9  json j_number_integer = 17;
    10  json j_number_float = 23.42;
    11  json j_object = {{"one", 1}, {"two", 2}};
    12  json j_array = {1, 2, 4, 8, 16};
    13  json j_string = "Hello, world";
    14 
    15  // call erase
    16  j_boolean.erase(j_boolean.begin(), j_boolean.end());
    17  j_number_integer.erase(j_number_integer.begin(), j_number_integer.end());
    18  j_number_float.erase(j_number_float.begin(), j_number_float.end());
    19  j_object.erase(j_object.find("two"), j_object.end());
    20  j_array.erase(j_array.begin() + 1, j_array.begin() + 3);
    21  j_string.erase(j_string.begin(), j_string.end());
    22 
    23  // print values
    24  std::cout << j_boolean << '\n';
    25  std::cout << j_number_integer << '\n';
    26  std::cout << j_number_float << '\n';
    27  std::cout << j_object << '\n';
    28  std::cout << j_array << '\n';
    29  std::cout << j_string << '\n';
    30 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3678
    +
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3619
    +
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3536
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3274
    Output (play with this example online):
    null
     null
     null
    @@ -339,12 +309,12 @@ null
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/erase__IteratorType_IteratorType.cpp -o erase__IteratorType_IteratorType 
    See also
    erase(InteratorType) – removes the element at a given position
    -erase(const typename object_t::key_type&) – remvoes the element from an object at the given key
    +erase(const typename object_t::key_type&) – removes the element from an object at the given key
    erase(const size_type) – removes the element from an array at the given index
    Since
    version 1.0.0
    -

    Definition at line 3347 of file json.hpp.

    +

    Definition at line 3379 of file json.hpp.

    @@ -354,9 +324,9 @@ null diff --git a/classnlohmann_1_1basic__json_ad6734c2b91b1b77aa2b43b65c3619c05.html b/classnlohmann_1_1basic__json_ad6734c2b91b1b77aa2b43b65c3619c05.html index 580842056..033fbe133 100644 --- a/classnlohmann_1_1basic__json_ad6734c2b91b1b77aa2b43b65c3619c05.html +++ b/classnlohmann_1_1basic__json_ad6734c2b91b1b77aa2b43b65c3619c05.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -270,29 +270,8 @@ template<typename CompatibleNumberFloatType , typename = typename std::enabl In case the parameter val is not a number, a JSON null value is created instead.
    Complexity
    Constant.
    -
    Example
    The example below shows the construction of several JSON floating-point number values from compatible types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create values of different floating-point types
    -
    8  float f42 = 42.23;
    -
    9  float f_nan = 1.0f / 0.0f;
    -
    10  double f23 = 23.42;
    -
    11 
    -
    12  // create JSON numbers
    -
    13  json j42(f42);
    -
    14  json j_nan(f_nan);
    -
    15  json j23(f23);
    -
    16 
    -
    17  // serialize the JSON numbers
    -
    18  std::cout << j42 << '\n';
    -
    19  std::cout << j_nan << '\n';
    -
    20  std::cout << j23 << '\n';
    -
    21 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows the construction of several JSON floating-point number values from compatible types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create values of different floating-point types
    8  float f42 = 42.23;
    9  float f_nan = 1.0f / 0.0f;
    10  double f23 = 23.42;
    11 
    12  // create JSON numbers
    13  json j42(f42);
    14  json j_nan(f_nan);
    15  json j23(f23);
    16 
    17  // serialize the JSON numbers
    18  std::cout << j42 << '\n';
    19  std::cout << j_nan << '\n';
    20  std::cout << j23 << '\n';
    21 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    42.2299995422363
     null
     23.42
    @@ -300,7 +279,7 @@ null
     
    See also
    basic_json(const number_float_t) – create a number value (floating-point)
    Since
    version 1.0.0
    -

    Definition at line 1304 of file json.hpp.

    +

    Definition at line 1305 of file json.hpp.

    @@ -310,9 +289,9 @@ null diff --git a/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html b/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html index 3e4e60867..8da71b702 100644 --- a/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html +++ b/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::cbegin @@ -33,7 +33,7 @@ - + @@ -261,30 +261,15 @@ Illustration from cppreference.com
  • Has the semantics of const_cast<const basic_json&>(*this).begin().
  • -
    Example
    The following code shows an example for cbegin.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  const json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get am iterator to the first element
    -
    11  json::const_iterator it = array.cbegin();
    -
    12 
    -
    13  // serialize the element that the iterator points to
    -
    14  std::cout << *it << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    const_iterator cbegin() const
    returns a const iterator to the first element
    Definition: json.hpp:3614
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    a const random access iterator for the basic_json class
    Definition: json.hpp:5577
    +
    Example
    The following code shows an example for cbegin.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  const json array = {1, 2, 3, 4, 5};
    9 
    10  // get am iterator to the first element
    11  json::const_iterator it = array.cbegin();
    12 
    13  // serialize the element that the iterator points to
    14  std::cout << *it << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    const_iterator cbegin() const
    returns a const iterator to the first element
    Definition: json.hpp:3653
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    a const random access iterator for the basic_json class
    Definition: json.hpp:5686
    Output (play with this example online):
    1
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/cbegin.cpp -o cbegin 
    Since
    version 1.0.0
    -

    Definition at line 3614 of file json.hpp.

    +

    Definition at line 3653 of file json.hpp.

    @@ -294,9 +279,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html b/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html index bbedf58df..09ab15ba6 100644 --- a/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html +++ b/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::at @@ -33,7 +33,7 @@ - + @@ -266,44 +266,17 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Constant.
    -
    Example
    The example below shows how array elements can be read and written using at.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON array
    -
    8  json array = {"first", "2nd", "third", "fourth"};
    -
    9 
    -
    10  // output element at index 2 (third element)
    -
    11  std::cout << array.at(2) << '\n';
    -
    12 
    -
    13  // change element at index 1 (second element) to "second"
    -
    14  array.at(1) = "second";
    -
    15 
    -
    16  // output changed array
    -
    17  std::cout << array << '\n';
    -
    18 
    -
    19  // try to write beyond the array limit
    -
    20  try
    -
    21  {
    -
    22  array.at(5) = "sixth";
    -
    23  }
    -
    24  catch (std::out_of_range& e)
    -
    25  {
    -
    26  std::cout << "out of range: " << e.what() << '\n';
    -
    27  }
    -
    28 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2620
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how array elements can be read and written using at.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON array
    8  json array = {"first", "2nd", "third", "fourth"};
    9 
    10  // output element at index 2 (third element)
    11  std::cout << array.at(2) << '\n';
    12 
    13  // change element at index 1 (second element) to "second"
    14  array.at(1) = "second";
    15 
    16  // output changed array
    17  std::cout << array << '\n';
    18 
    19  // try to write beyond the array limit
    20  try
    21  {
    22  array.at(5) = "sixth";
    23  }
    24  catch (std::out_of_range& e)
    25  {
    26  std::cout << "out of range: " << e.what() << '\n';
    27  }
    28 }
    static basic_json array(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an array from an initializer list
    Definition: json.hpp:1470
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2638
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "third"
     ["first","second","third","fourth"]
     out of range: array index 5 is out of range
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/at__size_type.cpp -o at__size_type 
    Since
    version 1.0.0
    -

    Definition at line 2620 of file json.hpp.

    +

    Definition at line 2638 of file json.hpp.

    @@ -313,9 +286,9 @@ out of range: array index 5 is out of range diff --git a/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html b/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html index a12ece6e4..32625a092 100644 --- a/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html +++ b/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::difference_type @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 218 of file json.hpp.

    +

    Definition at line 219 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ade7bd6e0fe221fec9d3fa9b430f5ce76.html b/classnlohmann_1_1basic__json_ade7bd6e0fe221fec9d3fa9b430f5ce76.html index 9ab8daa96..64982e0c4 100644 --- a/classnlohmann_1_1basic__json_ade7bd6e0fe221fec9d3fa9b430f5ce76.html +++ b/classnlohmann_1_1basic__json_ade7bd6e0fe221fec9d3fa9b430f5ce76.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::dump @@ -33,7 +33,7 @@ - + @@ -250,7 +250,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Serialization function for JSON values. The function tries to mimick Python's json.dumps() function, and currently supports its indent parameter.

    +

    Serialization function for JSON values. The function tries to mimic Python's json.dumps() function, and currently supports its indent parameter.

    Parameters
    @@ -259,29 +259,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    string containing the serialization of the JSON value
    Complexity
    Linear.
    -
    Example
    The following example shows the effect of different indent parameters to the result of the serializaion.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_object = {{"one", 1}, {"two", 2}};
    -
    9  json j_array = {1, 2, 4, 8, 16};
    -
    10 
    -
    11  // call dump()
    -
    12  std::cout << j_object.dump() << "\n\n";
    -
    13  std::cout << j_object.dump(-1) << "\n\n";
    -
    14  std::cout << j_object.dump(0) << "\n\n";
    -
    15  std::cout << j_object.dump(4) << "\n\n";
    -
    16  std::cout << j_array.dump() << "\n\n";
    -
    17  std::cout << j_array.dump(-1) << "\n\n";
    -
    18  std::cout << j_array.dump(0) << "\n\n";
    -
    19  std::cout << j_array.dump(4) << "\n\n";
    -
    20 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    string_t dump(const int indent=-1) const
    serialization
    Definition: json.hpp:1866
    +
    Example
    The following example shows the effect of different indent parameters to the result of the serialization.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_object = {{"one", 1}, {"two", 2}};
    9  json j_array = {1, 2, 4, 8, 16};
    10 
    11  // call dump()
    12  std::cout << j_object.dump() << "\n\n";
    13  std::cout << j_object.dump(-1) << "\n\n";
    14  std::cout << j_object.dump(0) << "\n\n";
    15  std::cout << j_object.dump(4) << "\n\n";
    16  std::cout << j_array.dump() << "\n\n";
    17  std::cout << j_array.dump(-1) << "\n\n";
    18  std::cout << j_array.dump(0) << "\n\n";
    19  std::cout << j_array.dump(4) << "\n\n";
    20 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    string_t dump(const int indent=-1) const
    serialization
    Definition: json.hpp:1877
    Output (play with this example online):
    {"one":1,"two":2}
     
     {"one":1,"two":2}
    @@ -320,7 +300,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    See also
    https://docs.python.org/2/library/json.html#json.dump
    Since
    version 1.0.0
    -

    Definition at line 1866 of file json.hpp.

    +

    Definition at line 1877 of file json.hpp.

    @@ -330,9 +310,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_adeaef2ab021997a11a826c378c2365e1.html b/classnlohmann_1_1basic__json_adeaef2ab021997a11a826c378c2365e1.html index 09735f6e2..4d6bfefd7 100644 --- a/classnlohmann_1_1basic__json_adeaef2ab021997a11a826c378c2365e1.html +++ b/classnlohmann_1_1basic__json_adeaef2ab021997a11a826c378c2365e1.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@
    [in]indentif indent is nonnegative, then array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. -1 (the default) selects the most compact representation
    - + @@ -258,28 +258,14 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Constant.
    -
    Example
    The example below demonstrates boolean values.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create boolean values
    -
    8  json j_truth = true;
    -
    9  json j_falsity = false;
    -
    10 
    -
    11  // serialize the JSON booleans
    -
    12  std::cout << j_truth << '\n';
    -
    13  std::cout << j_falsity << '\n';
    -
    14 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below demonstrates boolean values.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create boolean values
    8  json j_truth = true;
    9  json j_falsity = false;
    10 
    11  // serialize the JSON booleans
    12  std::cout << j_truth << '\n';
    13  std::cout << j_falsity << '\n';
    14 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    true
     false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__boolean_t.cpp -o basic_json__boolean_t 
    Since
    version 1.0.0
    -

    Definition at line 1131 of file json.hpp.

    +

    Definition at line 1132 of file json.hpp.

    @@ -289,9 +275,9 @@ false diff --git a/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html b/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html index 4453bcf64..d6ce855c6 100644 --- a/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html +++ b/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator= @@ -33,7 +33,7 @@ - + @@ -262,31 +262,14 @@ template<template< typename U, typename V, typename...Args > class Obje
  • The complexity is linear.
  • -
    Example
    The code below shows and example for the copy assignment. It creates a copy of value a which is then swapped with b. Finally, the copy of a (which is the null value after the swap) is destroyed.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json a = 23;
    -
    9  json b = 42;
    -
    10 
    -
    11  // copy-assign a to b
    -
    12  b = a;
    -
    13 
    -
    14  // serialize the JSON arrays
    -
    15  std::cout << a << '\n';
    -
    16  std::cout << b << '\n';
    -
    17 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The code below shows and example for the copy assignment. It creates a copy of value a which is then swapped with b. Finally, the copy of a (which is the null value after the swap) is destroyed.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json a = 23;
    9  json b = 42;
    10 
    11  // copy-assign a to b
    12  b = a;
    13 
    14  // serialize the JSON arrays
    15  std::cout << a << '\n';
    16  std::cout << b << '\n';
    17 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    23
     23
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__copyassignment.cpp -o basic_json__copyassignment 
    Since
    version 1.0.0
    -

    Definition at line 1771 of file json.hpp.

    +

    Definition at line 1782 of file json.hpp.

    @@ -296,9 +279,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html b/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html index 52fd9b967..8b764627a 100644 --- a/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html +++ b/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator!= @@ -33,7 +33,7 @@ - + @@ -270,29 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    whether v is not null
    Complexity
    Constant.
    Example
    The example compares several JSON types to the null pointer.
    -
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create several JSON values
    -
    8  json array = {1, 2, 3};
    -
    9  json object = {{"A", "a"}, {"B", "b"}};
    -
    10  json number = 17;
    -
    11  json string = "foo";
    -
    12  json null;
    -
    13 
    -
    14  // output values and comparisons
    -
    15  std::cout << std::boolalpha;
    -
    16  std::cout << array << " != nullptr " << (array != nullptr) << '\n';
    -
    17  std::cout << object << " != nullptr " << (object != nullptr) << '\n';
    -
    18  std::cout << number << " != nullptr " << (number != nullptr) << '\n';
    -
    19  std::cout << string << " != nullptr " << (string != nullptr) << '\n';
    -
    20  std::cout << null << " != nullptr " << (null != nullptr) << '\n';
    -
    21 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create several JSON values
    8  json array = {1, 2, 3};
    9  json object = {{"A", "a"}, {"B", "b"}};
    10  json number = 17;
    11  json string = "foo";
    12  json null;
    13 
    14  // output values and comparisons
    15  std::cout << std::boolalpha;
    16  std::cout << array << " != nullptr " << (array != nullptr) << '\n';
    17  std::cout << object << " != nullptr " << (object != nullptr) << '\n';
    18  std::cout << number << " != nullptr " << (number != nullptr) << '\n';
    19  std::cout << string << " != nullptr " << (string != nullptr) << '\n';
    20  std::cout << null << " != nullptr " << (null != nullptr) << '\n';
    21 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79

    Output (play with this example online):

    [1,2,3] != nullptr true
     {"A":"a","B":"b"} != nullptr true
     17 != nullptr true
    @@ -300,7 +279,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     null != nullptr false
     

    The example code above can be translated with

    g++ -std=c++11 -Isrc doc/examples/operator__notequal__nullptr_t.cpp -o operator__notequal__nullptr_t 
    Since
    version 1.0.0
    -

    Definition at line 4718 of file json.hpp.

    +

    Definition at line 4798 of file json.hpp.

    @@ -310,9 +289,9 @@ null != nullptr false diff --git a/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html b/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html index 234f9e30c..674538a00 100644 --- a/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html +++ b/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::get @@ -33,7 +33,7 @@ - + @@ -261,39 +261,18 @@ template<typename PointerType , typename std::enable_if<
    Returns
    pointer to the internally stored JSON value if the requested pointer type PointerType fits to the JSON value; nullptr otherwise
    Complexity
    Constant.
    -
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON number
    -
    8  json value = 17;
    -
    9 
    -
    10  // explicitly getting pointers
    -
    11  auto p1 = value.get<const json::number_integer_t*>();
    -
    12  auto p2 = value.get<json::number_integer_t*>();
    -
    13  auto p3 = value.get<json::number_integer_t* const>();
    -
    14  auto p4 = value.get<const json::number_integer_t* const>();
    -
    15  auto p5 = value.get<json::number_float_t*>();
    -
    16 
    -
    17  // print the pointees
    -
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    -
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    -
    20 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    ValueType get() const
    get a value (explicit)
    Definition: json.hpp:2443
    -
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:527
    -
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:592
    +
    Example
    The example below shows how pointers to internal values of a JSON value can be requested. Note that no type conversions are made and a nullptr is returned if the value and the requested pointer type does not match.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON number
    8  json value = 17;
    9 
    10  // explicitly getting pointers
    11  auto p1 = value.get<const json::number_integer_t*>();
    12  auto p2 = value.get<json::number_integer_t*>();
    13  auto p3 = value.get<json::number_integer_t* const>();
    14  auto p4 = value.get<const json::number_integer_t* const>();
    15  auto p5 = value.get<json::number_float_t*>();
    16 
    17  // print the pointees
    18  std::cout << *p1 << ' ' << *p2 << ' ' << *p3 << ' ' << *p4 << '\n';
    19  std::cout << std::boolalpha << (p5 == nullptr) << '\n';
    20 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    ValueType get() const
    get a value (explicit)
    Definition: json.hpp:2461
    +
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:528
    +
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:593
    Output (play with this example online):
    17 17 17 17
     true
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/get__PointerType.cpp -o get__PointerType 
    See also
    get_ptr() for explicit pointer-member access
    Since
    version 1.0.0
    -

    Definition at line 2478 of file json.hpp.

    +

    Definition at line 2496 of file json.hpp.

    @@ -303,9 +282,9 @@ true diff --git a/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html b/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html index dbb8f92c4..8cdacd667 100644 --- a/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html +++ b/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_structured @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON type is structured (array or object).

    Returns
    true if type is structured (array or object), false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_structured for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_structured()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_structured() << '\n';
    -
    19  std::cout << j_boolean.is_structured() << '\n';
    -
    20  std::cout << j_number_integer.is_structured() << '\n';
    -
    21  std::cout << j_number_float.is_structured() << '\n';
    -
    22  std::cout << j_object.is_structured() << '\n';
    -
    23  std::cout << j_array.is_structured() << '\n';
    -
    24  std::cout << j_string.is_structured() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    bool is_structured() const noexcept
    return whether type is structured
    Definition: json.hpp:1938
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code exemplifies is_structured for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_structured()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_structured() << '\n';
    19  std::cout << j_boolean.is_structured() << '\n';
    20  std::cout << j_number_integer.is_structured() << '\n';
    21  std::cout << j_number_float.is_structured() << '\n';
    22  std::cout << j_object.is_structured() << '\n';
    23  std::cout << j_array.is_structured() << '\n';
    24  std::cout << j_string.is_structured() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    bool is_structured() const noexcept
    return whether type is structured
    Definition: json.hpp:1949
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    false
     false
     false
    @@ -290,7 +265,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_structured.cpp -o is_structured 
    Since
    version 1.0.0
    -

    Definition at line 1938 of file json.hpp.

    +

    Definition at line 1949 of file json.hpp.

    @@ -300,9 +275,9 @@ false diff --git a/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html b/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html index 93769585a..058b7f99c 100644 --- a/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html +++ b/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::allocator_type @@ -33,7 +33,7 @@ - + @@ -239,7 +239,7 @@ template<template< typename U, typename V, typename...Args > class Obje
    -

    Definition at line 224 of file json.hpp.

    +

    Definition at line 225 of file json.hpp.

    @@ -249,9 +249,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ae960d2d6bc7b94fe39cc5e9f106edfa9.html b/classnlohmann_1_1basic__json_ae960d2d6bc7b94fe39cc5e9f106edfa9.html index b88d13e1e..59e8dde34 100644 --- a/classnlohmann_1_1basic__json_ae960d2d6bc7b94fe39cc5e9f106edfa9.html +++ b/classnlohmann_1_1basic__json_ae960d2d6bc7b94fe39cc5e9f106edfa9.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator[] @@ -33,7 +33,7 @@ - + @@ -266,26 +266,14 @@ operator[] with null"
    Complexity
    Constant.
    -
    Example
    The example below shows how array elements can be read using the [] operator.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON array
    -
    8  json array = {"first", "2nd", "third", "fourth"};
    -
    9 
    -
    10  // output element at index 2 (third element)
    -
    11  std::cout << array.at(2) << '\n';
    -
    12 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2620
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how array elements can be read using the [] operator.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON array
    8  json array = {"first", "2nd", "third", "fourth"};
    9 
    10  // output element at index 2 (third element)
    11  std::cout << array.at(2) << '\n';
    12 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2638
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "third"
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operatorarray__size_type_const.cpp -o operatorarray__size_type_const 
    Since
    version 1.0.0
    -

    Definition at line 2847 of file json.hpp.

    +

    Definition at line 2870 of file json.hpp.

    @@ -295,9 +283,9 @@ operator[] with null" diff --git a/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html b/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html index 702b9e67f..61969c8e1 100644 --- a/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html +++ b/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::parse_event_t @@ -33,7 +33,7 @@ - + @@ -269,7 +269,7 @@ template<template< typename U, typename V, typename...Args > class Obje -

    Definition at line 754 of file json.hpp.

    +

    Definition at line 755 of file json.hpp.

    @@ -279,9 +279,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html b/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html index 6174772f6..52c25e704 100644 --- a/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html +++ b/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::swap @@ -33,7 +33,7 @@ - + @@ -258,32 +258,15 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Constant.
    -
    Example
    The example below shows how JSON arrays can be swapped.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create two JSON values
    -
    8  json j1 = {1, 2, 3, 4, 5};
    -
    9  json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}};
    -
    10 
    -
    11  // swap the values
    -
    12  j1.swap(j2);
    -
    13 
    -
    14  // output the values
    -
    15  std::cout << "j1 = " << j1 << '\n';
    -
    16  std::cout << "j2 = " << j2 << '\n';
    -
    17 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4431
    +
    Example
    The example below shows how JSON arrays can be swapped.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create two JSON values
    8  json j1 = {1, 2, 3, 4, 5};
    9  json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}};
    10 
    11  // swap the values
    12  j1.swap(j2);
    13 
    14  // output the values
    15  std::cout << "j1 = " << j1 << '\n';
    16  std::cout << "j2 = " << j2 << '\n';
    17 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4486
    Output (play with this example online):
    j1 = {"e":2.71828182845905,"pi":3.14159265358979}
     j2 = [1,2,3,4,5]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/swap__reference.cpp -o swap__reference 
    Since
    version 1.0.0
    -

    Definition at line 4431 of file json.hpp.

    +

    Definition at line 4486 of file json.hpp.

    @@ -293,9 +276,9 @@ j2 = [1,2,3,4,5] diff --git a/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html b/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html index 31c6a9a9c..e0deddbcf 100644 --- a/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html +++ b/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::rbegin @@ -33,7 +33,7 @@ - + @@ -260,30 +260,15 @@ Illustration from cppreference.com
  • Has the semantics of reverse_iterator(end()).
  • -
    Example
    The following code shows an example for rbegin.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create an array value
    -
    8  json array = {1, 2, 3, 4, 5};
    -
    9 
    -
    10  // get an iterator to the reverse-beginning
    -
    11  json::reverse_iterator it = array.rbegin();
    -
    12 
    -
    13  // serialize the element that the iterator points to
    -
    14  std::cout << *it << '\n';
    -
    15 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    reverse_iterator rbegin()
    returns an iterator to the reverse-beginning
    Definition: json.hpp:3697
    -
    a template for a reverse iterator class
    Definition: json.hpp:232
    +
    Example
    The following code shows an example for rbegin.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create an array value
    8  json array = {1, 2, 3, 4, 5};
    9 
    10  // get an iterator to the reverse-beginning
    11  json::reverse_iterator it = array.rbegin();
    12 
    13  // serialize the element that the iterator points to
    14  std::cout << *it << '\n';
    15 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    reverse_iterator rbegin()
    returns an iterator to the reverse-beginning
    Definition: json.hpp:3736
    +
    a template for a reverse iterator class
    Definition: json.hpp:233
    Output (play with this example online):
    5
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/rbegin.cpp -o rbegin 
    Since
    version 1.0.0
    -

    Definition at line 3697 of file json.hpp.

    +

    Definition at line 3736 of file json.hpp.

    @@ -293,9 +278,9 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_af127fb69c580c17821da5f5be57e3585.html b/classnlohmann_1_1basic__json_af127fb69c580c17821da5f5be57e3585.html index a04b784e4..6910eb58b 100644 --- a/classnlohmann_1_1basic__json_af127fb69c580c17821da5f5be57e3585.html +++ b/classnlohmann_1_1basic__json_af127fb69c580c17821da5f5be57e3585.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -264,20 +264,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    -
    Example
    The following code shows the constructor with string literal parameter.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON string directly from a string literal
    -
    8  json j("The quick brown fox jumps over the lazy doc");
    -
    9 
    -
    10  // serialize the JSON array
    -
    11  std::cout << j << '\n';
    -
    12 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows the constructor with string literal parameter.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON string directly from a string literal
    8  json j("The quick brown fox jumps over the lazy doc");
    9 
    10  // serialize the JSON array
    11  std::cout << j << '\n';
    12 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "The quick brown fox jumps over the lazy doc"
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/basic_json__string_t_value_type.cpp -o basic_json__string_t_value_type 
    See also
    basic_json(const string_t&) – create a string value
    @@ -285,7 +273,7 @@ template<template< typename U, typename V, typename...Args > class Obje basic_json(const CompatibleStringType&) – create a string value from a compatible string container
    Since
    version 1.0.0
    -

    Definition at line 1082 of file json.hpp.

    +

    Definition at line 1083 of file json.hpp.

    @@ -295,9 +283,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html b/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html index 4704216c9..feeb82a25 100644 --- a/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html +++ b/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::basic_json @@ -33,7 +33,7 @@ - + @@ -272,7 +272,7 @@ template<template< typename U, typename V, typename...Args > class Obje
  • If the list consists of pairs whose first element is a string, a JSON object value is created where the first elements of the pairs are treated as keys and the second elements are as values.
  • In all other cases, an array is created.
  • -

    The rules aim to create the best fit between a C++ initializer list and JSON values. The ratioinale is as follows:

    +

    The rules aim to create the best fit between a C++ initializer list and JSON values. The rationale is as follows:

    1. The empty initializer list is written as {} which is exactly an empty JSON object.
    2. C++ has now way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an object.
    3. @@ -300,29 +300,9 @@ initializer list"
    Complexity
    Linear in the size of the initializer list init.
    -
    Example
    The example below shows how JSON values are created from initializer lists
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_empty_init_list = json({});
    -
    9  json j_object = { {"one", 1}, {"two", 2} };
    -
    10  json j_array = {1, 2, 3, 4};
    -
    11  json j_nested_object = { {"one", {1}}, {"two", {1, 2}} };
    -
    12  json j_nested_array = { {{1}, "one"}, {{1, 2}, "two"} };
    -
    13 
    -
    14  // serialize the JSON value
    -
    15  std::cout << j_empty_init_list << '\n';
    -
    16  std::cout << j_object << '\n';
    -
    17  std::cout << j_array << '\n';
    -
    18  std::cout << j_nested_object << '\n';
    -
    19  std::cout << j_nested_array << '\n';
    -
    20 }
    -
    basic_json<> json
    default JSON class
    Definition: json.hpp:7811
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how JSON values are created from initializer lists
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_empty_init_list = json({});
    9  json j_object = { {"one", 1}, {"two", 2} };
    10  json j_array = {1, 2, 3, 4};
    11  json j_nested_object = { {"one", {1}}, {"two", {1, 2}} };
    12  json j_nested_array = { {{1}, "one"}, {{1, 2}, "two"} };
    13 
    14  // serialize the JSON value
    15  std::cout << j_empty_init_list << '\n';
    16  std::cout << j_object << '\n';
    17  std::cout << j_array << '\n';
    18  std::cout << j_nested_object << '\n';
    19  std::cout << j_nested_array << '\n';
    20 }
    basic_json<> json
    default JSON class
    Definition: json.hpp:7968
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    {}
     {"one":1,"two":2}
     [1,2,3,4]
    @@ -334,7 +314,7 @@ initializer list"
     object(std::initializer_list<basic_json>) – create a JSON object value from an initializer list
    Since
    version 1.0.0
    -

    Definition at line 1377 of file json.hpp.

    +

    Definition at line 1378 of file json.hpp.

    @@ -344,9 +324,9 @@ initializer list" diff --git a/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html b/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html index 7d0c743c1..a27e24850 100644 --- a/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html +++ b/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::parse @@ -33,7 +33,7 @@ - + @@ -270,60 +270,13 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    result of the deserialization
    Complexity
    Linear in the length of the input. The parser is a predictive LL(1) parser. The complexity can be higher if the parser callback function cb has a super-linear complexity.
    Note
    A UTF-8 byte order mark is silently ignored.
    -
    Example
    The example below demonstrates the parse function with and without callback function.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // a JSON text
    -
    8  std::string text = R"(
    -
    9  {
    -
    10  "Image": {
    -
    11  "Width": 800,
    -
    12  "Height": 600,
    -
    13  "Title": "View from 15th Floor",
    -
    14  "Thumbnail": {
    -
    15  "Url": "http://www.example.com/image/481989943",
    -
    16  "Height": 125,
    -
    17  "Width": 100
    -
    18  },
    -
    19  "Animated" : false,
    -
    20  "IDs": [116, 943, 234, 38793]
    -
    21  }
    -
    22  }
    -
    23  )";
    -
    24 
    -
    25  // parse and serialize JSON
    -
    26  json j_complete = json::parse(text);
    -
    27  std::cout << std::setw(4) << j_complete << "\n\n";
    -
    28 
    -
    29 
    -
    30  // define parser callback
    -
    31  json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
    -
    32  {
    -
    33  // skip object elements with key "Thumbnail"
    -
    34  if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
    -
    35  {
    -
    36  return false;
    -
    37  }
    -
    38  else
    -
    39  {
    -
    40  return true;
    -
    41  }
    -
    42  };
    -
    43 
    -
    44  // parse (with callback) and serialize JSON
    -
    45  json j_filtered = json::parse(text, cb);
    -
    46  std::cout << std::setw(4) << j_filtered << '\n';
    -
    47 }
    -
    basic_json<> json
    default JSON class
    Definition: json.hpp:7811
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:819
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below demonstrates the parse function with and without callback function.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // a JSON text
    8  std::string text = R"(
    9  {
    10  "Image": {
    11  "Width": 800,
    12  "Height": 600,
    13  "Title": "View from 15th Floor",
    14  "Thumbnail": {
    15  "Url": "http://www.example.com/image/481989943",
    16  "Height": 125,
    17  "Width": 100
    18  },
    19  "Animated" : false,
    20  "IDs": [116, 943, 234, 38793]
    21  }
    22  }
    23  )";
    24 
    25  // parse and serialize JSON
    26  json j_complete = json::parse(text);
    27  std::cout << std::setw(4) << j_complete << "\n\n";
    28 
    29 
    30  // define parser callback
    31  json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
    32  {
    33  // skip object elements with key "Thumbnail"
    34  if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
    35  {
    36  return false;
    37  }
    38  else
    39  {
    40  return true;
    41  }
    42  };
    43 
    44  // parse (with callback) and serialize JSON
    45  json j_filtered = json::parse(text, cb);
    46  std::cout << std::setw(4) << j_filtered << '\n';
    47 }
    basic_json<> json
    default JSON class
    Definition: json.hpp:7968
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:820
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    the parser read a key of a value in an object
    -
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:4955
    -
    parse_event_t
    JSON callback events.
    Definition: json.hpp:754
    +
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:5057
    +
    parse_event_t
    JSON callback events.
    Definition: json.hpp:755
    Output (play with this example online):
    {
         "Image": {
             "Animated": false,
    @@ -362,7 +315,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     
    See also
    parse(std::istream&, parser_callback_t) for a version that reads from an input stream
    Since
    version 1.0.0
    -

    Definition at line 4955 of file json.hpp.

    +

    Definition at line 5057 of file json.hpp.

    @@ -372,9 +325,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_af661bc209bf22097e2f76607a11b56bf.html b/classnlohmann_1_1basic__json_af661bc209bf22097e2f76607a11b56bf.html index 3cad6927f..39b18457a 100644 --- a/classnlohmann_1_1basic__json_af661bc209bf22097e2f76607a11b56bf.html +++ b/classnlohmann_1_1basic__json_af661bc209bf22097e2f76607a11b56bf.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::is_boolean @@ -33,7 +33,7 @@ - + @@ -252,34 +252,9 @@ template<template< typename U, typename V, typename...Args > class Obje

    This function returns true iff the JSON value is a boolean.

    Returns
    true if type is boolean, false otherwise.
    Complexity
    Constant.
    -
    Example
    The following code exemplifies is_boolean for all JSON types.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON values
    -
    8  json j_null;
    -
    9  json j_boolean = true;
    -
    10  json j_number_integer = 17;
    -
    11  json j_number_float = 23.42;
    -
    12  json j_object = {{"one", 1}, {"two", 2}};
    -
    13  json j_array = {1, 2, 4, 8, 16};
    -
    14  json j_string = "Hello, world";
    -
    15 
    -
    16  // call is_boolean()
    -
    17  std::cout << std::boolalpha;
    -
    18  std::cout << j_null.is_boolean() << '\n';
    -
    19  std::cout << j_boolean.is_boolean() << '\n';
    -
    20  std::cout << j_number_integer.is_boolean() << '\n';
    -
    21  std::cout << j_number_float.is_boolean() << '\n';
    -
    22  std::cout << j_object.is_boolean() << '\n';
    -
    23  std::cout << j_array.is_boolean() << '\n';
    -
    24  std::cout << j_string.is_boolean() << '\n';
    -
    25 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    bool is_boolean() const noexcept
    return whether value is a boolean
    Definition: json.hpp:1976
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code exemplifies is_boolean for all JSON types.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON values
    8  json j_null;
    9  json j_boolean = true;
    10  json j_number_integer = 17;
    11  json j_number_float = 23.42;
    12  json j_object = {{"one", 1}, {"two", 2}};
    13  json j_array = {1, 2, 4, 8, 16};
    14  json j_string = "Hello, world";
    15 
    16  // call is_boolean()
    17  std::cout << std::boolalpha;
    18  std::cout << j_null.is_boolean() << '\n';
    19  std::cout << j_boolean.is_boolean() << '\n';
    20  std::cout << j_number_integer.is_boolean() << '\n';
    21  std::cout << j_number_float.is_boolean() << '\n';
    22  std::cout << j_object.is_boolean() << '\n';
    23  std::cout << j_array.is_boolean() << '\n';
    24  std::cout << j_string.is_boolean() << '\n';
    25 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    bool is_boolean() const noexcept
    return whether value is a boolean
    Definition: json.hpp:1987
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    false
     true
     false
    @@ -290,7 +265,7 @@ false
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/is_boolean.cpp -o is_boolean 
    Since
    version 1.0.0
    -

    Definition at line 1976 of file json.hpp.

    +

    Definition at line 1987 of file json.hpp.

    @@ -300,9 +275,9 @@ false diff --git a/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html b/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html index ba05fab29..8a600f4a1 100644 --- a/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html +++ b/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::at @@ -33,7 +33,7 @@ - + @@ -266,37 +266,15 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Constant.
    -
    Example
    The example below shows how array elements can be read using at.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON array
    -
    8  json array = {"first", "2nd", "third", "fourth"};
    -
    9 
    -
    10  // output element at index 2 (third element)
    -
    11  std::cout << array.at(2) << '\n';
    -
    12 
    -
    13  // try to read beyond the array limit
    -
    14  try
    -
    15  {
    -
    16  std::cout << array.at(5) << '\n';
    -
    17  }
    -
    18  catch (std::out_of_range)
    -
    19  {
    -
    20  std::cout << "out of range" << '\n';
    -
    21  }
    -
    22 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2620
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how array elements can be read using at.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON array
    8  json array = {"first", "2nd", "third", "fourth"};
    9 
    10  // output element at index 2 (third element)
    11  std::cout << array.at(2) << '\n';
    12 
    13  // try to read beyond the array limit
    14  try
    15  {
    16  std::cout << array.at(5) << '\n';
    17  }
    18  catch (std::out_of_range)
    19  {
    20  std::cout << "out of range" << '\n';
    21  }
    22 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2638
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    "third"
     out of range
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/at__size_type_const.cpp -o at__size_type_const 
    Since
    version 1.0.0
    -

    Definition at line 2663 of file json.hpp.

    +

    Definition at line 2682 of file json.hpp.

    @@ -306,9 +284,9 @@ out of range diff --git a/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html b/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html index fbf906799..5b1eb08e7 100644 --- a/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html +++ b/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator ValueType @@ -33,7 +33,7 @@ - + @@ -251,7 +251,7 @@ template<typename ValueType , typename std::enable_if<
    -

    Implict type conversion between the JSON value and a compatible value. The call is realized by calling get() const.

    +

    Implicit type conversion between the JSON value and a compatible value. The call is realized by calling get() const.

    Template Parameters
    @@ -266,57 +266,8 @@ template<typename ValueType , typename std::enable_if<
    Complexity
    Linear in the size of the JSON value.
    -
    Example
    The example below shows serveral conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard std::vector<short>, (3) A JSON object can be converted to C++ assiciative containers such as std::unordered_map<std::string, json>.
    1 #include <json.hpp>
    -
    2 #include <unordered_map>
    -
    3 
    -
    4 using namespace nlohmann;
    -
    5 
    -
    6 int main()
    -
    7 {
    -
    8  // create a JSON value with different types
    -
    9  json json_types =
    -
    10  {
    -
    11  {"boolean", true},
    -
    12  {
    -
    13  "number", {
    -
    14  {"integer", 42},
    -
    15  {"floating-point", 17.23}
    -
    16  }
    -
    17  },
    -
    18  {"string", "Hello, world!"},
    -
    19  {"array", {1, 2, 3, 4, 5}},
    -
    20  {"null", nullptr}
    -
    21  };
    -
    22 
    -
    23  // use implicit conversions
    -
    24  bool v1 = json_types["boolean"];
    -
    25  int v2 = json_types["number"]["integer"];
    -
    26  short v3 = json_types["number"]["integer"];
    -
    27  float v4 = json_types["number"]["floating-point"];
    -
    28  int v5 = json_types["number"]["floating-point"];
    -
    29  std::string v6 = json_types["string"];
    -
    30  std::vector<short> v7 = json_types["array"];
    -
    31  std::unordered_map<std::string, json> v8 = json_types;
    -
    32 
    -
    33  // print the conversion results
    -
    34  std::cout << v1 << '\n';
    -
    35  std::cout << v2 << ' ' << v3 << '\n';
    -
    36  std::cout << v4 << ' ' << v5 << '\n';
    -
    37  std::cout << v6 << '\n';
    -
    38 
    -
    39  for (auto i : v7)
    -
    40  {
    -
    41  std::cout << i << ' ';
    -
    42  }
    -
    43  std::cout << "\n\n";
    -
    44 
    -
    45  for (auto i : v8)
    -
    46  {
    -
    47  std::cout << i.first << ": " << i.second << '\n';
    -
    48  }
    -
    49 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers, (2) A JSON array can be converted to a standard std::vector<short>, (3) A JSON object can be converted to C++ associative containers such as std::unordered_map<std::string, json>.
    1 #include <json.hpp>
    2 #include <unordered_map>
    3 
    4 using namespace nlohmann;
    5 
    6 int main()
    7 {
    8  // create a JSON value with different types
    9  json json_types =
    10  {
    11  {"boolean", true},
    12  {
    13  "number", {
    14  {"integer", 42},
    15  {"floating-point", 17.23}
    16  }
    17  },
    18  {"string", "Hello, world!"},
    19  {"array", {1, 2, 3, 4, 5}},
    20  {"null", nullptr}
    21  };
    22 
    23  // use implicit conversions
    24  bool v1 = json_types["boolean"];
    25  int v2 = json_types["number"]["integer"];
    26  short v3 = json_types["number"]["integer"];
    27  float v4 = json_types["number"]["floating-point"];
    28  int v5 = json_types["number"]["floating-point"];
    29  std::string v6 = json_types["string"];
    30  std::vector<short> v7 = json_types["array"];
    31  std::unordered_map<std::string, json> v8 = json_types;
    32 
    33  // print the conversion results
    34  std::cout << v1 << '\n';
    35  std::cout << v2 << ' ' << v3 << '\n';
    36  std::cout << v4 << ' ' << v5 << '\n';
    37  std::cout << v6 << '\n';
    38 
    39  for (auto i : v7)
    40  {
    41  std::cout << i << ' ';
    42  }
    43  std::cout << "\n\n";
    44 
    45  for (auto i : v8)
    46  {
    47  std::cout << i.first << ": " << i.second << '\n';
    48  }
    49 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    1
     42 42
     17.23 17
    @@ -331,7 +282,7 @@ array: [1,2,3,4,5]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/operator__ValueType.cpp -o operator__ValueType 
    Since
    version 1.0.0
    -

    Definition at line 2582 of file json.hpp.

    +

    Definition at line 2600 of file json.hpp.

    @@ -341,9 +292,9 @@ array: [1,2,3,4,5] diff --git a/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html b/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html index 0e3a8c317..2c4750b2e 100644 --- a/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html +++ b/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::operator[] @@ -33,7 +33,7 @@
    ValueTypenon-pointer type compatible to the JSON value, for instance int for JSON integer numbers, bool for JSON booleans, or std::vector types for JSON arrays. The character type of string_t as well as an initializer list of this type is excluded to avoid ambiguities as these types implicitly convert to std::string.
    - + @@ -266,38 +266,8 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Logarithmic in the size of the container.
    -
    Example
    The example below shows how object elements can be read and written using the [] operator.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON object
    -
    8  json object =
    -
    9  {
    -
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    -
    11  };
    -
    12 
    -
    13  // output element with key "two"
    -
    14  std::cout << object["two"] << "\n\n";
    -
    15 
    -
    16  // change element with key "three"
    -
    17  object["three"] = 3;
    -
    18 
    -
    19  // output changed array
    -
    20  std::cout << std::setw(4) << object << "\n\n";
    -
    21 
    -
    22  // mention nonexisting key
    -
    23  object["four"];
    -
    24 
    -
    25  // write to nonexisting key
    -
    26  object["five"]["really"]["nested"] = true;
    -
    27 
    -
    28  // output changed object
    -
    29  std::cout << std::setw(4) << object << '\n';
    -
    30 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The example below shows how object elements can be read and written using the [] operator.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON object
    8  json object =
    9  {
    10  {"one", 1}, {"two", 2}, {"three", 2.9}
    11  };
    12 
    13  // output element with key "two"
    14  std::cout << object["two"] << "\n\n";
    15 
    16  // change element with key "three"
    17  object["three"] = 3;
    18 
    19  // output changed array
    20  std::cout << std::setw(4) << object << "\n\n";
    21 
    22  // mention nonexisting key
    23  object["four"];
    24 
    25  // write to nonexisting key
    26  object["five"]["really"]["nested"] = true;
    27 
    28  // output changed object
    29  std::cout << std::setw(4) << object << '\n';
    30 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    2
     
     {
    @@ -323,7 +293,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     value() for access by value with a default value
    Since
    version 1.0.0
    -

    Definition at line 2887 of file json.hpp.

    +

    Definition at line 2911 of file json.hpp.

    @@ -333,9 +303,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_af7d0adc984d04fc70c3d29fcd63e096a.html b/classnlohmann_1_1basic__json_af7d0adc984d04fc70c3d29fcd63e096a.html index 3de0fda7e..1a7f8af2f 100644 --- a/classnlohmann_1_1basic__json_af7d0adc984d04fc70c3d29fcd63e096a.html +++ b/classnlohmann_1_1basic__json_af7d0adc984d04fc70c3d29fcd63e096a.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::insert @@ -33,7 +33,7 @@ - + @@ -277,32 +277,16 @@ template<template< typename U, typename V, typename...Args > class Obje
    Complexity
    Constant plus linear in the distance between pos and end of the container.
    -
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create a JSON array
    -
    8  json v = {1, 2, 3, 4};
    -
    9 
    -
    10  // insert number 10 before number 3
    -
    11  auto new_pos = v.insert(v.begin() + 2, 10);
    -
    12 
    -
    13  // output new array and result of insert call
    -
    14  std::cout << *new_pos << '\n';
    -
    15  std::cout << v << '\n';
    -
    16 }
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3580
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4230
    +
    Example
    The example shows how insert is used.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create a JSON array
    8  json v = {1, 2, 3, 4};
    9 
    10  // insert number 10 before number 3
    11  auto new_pos = v.insert(v.begin() + 2, 10);
    12 
    13  // output new array and result of insert call
    14  std::cout << *new_pos << '\n';
    15  std::cout << v << '\n';
    16 }
    a class to store JSON values
    Definition: json.hpp:188
    +
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3619
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4281
    Output (play with this example online):
    10
     [1,2,10,3,4]
     
    The example code above can be translated with
    g++ -std=c++11 -Isrc doc/examples/insert.cpp -o insert 
    Since
    version 1.0.0
    -

    Definition at line 4230 of file json.hpp.

    +

    Definition at line 4281 of file json.hpp.

    @@ -312,9 +296,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html b/classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html index 8d18c9111..371f086e3 100644 --- a/classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html +++ b/classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::basic_json::array @@ -33,7 +33,7 @@ - + @@ -264,27 +264,9 @@ template<template< typename U, typename V, typename...Args > class Obje
    Returns
    JSON array value
    Complexity
    Linear in the size of init.
    -
    Example
    The following code shows an example for the array function.
    1 #include <json.hpp>
    -
    2 
    -
    3 using namespace nlohmann;
    -
    4 
    -
    5 int main()
    -
    6 {
    -
    7  // create JSON arrays
    -
    8  json j_no_init_list = json::array();
    -
    9  json j_empty_init_list = json::array({});
    -
    10  json j_nonempty_init_list = json::array({1, 2, 3, 4});
    -
    11  json j_list_of_pairs = json::array({ {"one", 1}, {"two", 2} });
    -
    12 
    -
    13  // serialize the JSON arrays
    -
    14  std::cout << j_no_init_list << '\n';
    -
    15  std::cout << j_empty_init_list << '\n';
    -
    16  std::cout << j_nonempty_init_list << '\n';
    -
    17  std::cout << j_list_of_pairs << '\n';
    -
    18 }
    -
    static basic_json array(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an array from an initializer list
    Definition: json.hpp:1467
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    +
    Example
    The following code shows an example for the array function.
    1 #include <json.hpp>
    2 
    3 using namespace nlohmann;
    4 
    5 int main()
    6 {
    7  // create JSON arrays
    8  json j_no_init_list = json::array();
    9  json j_empty_init_list = json::array({});
    10  json j_nonempty_init_list = json::array({1, 2, 3, 4});
    11  json j_list_of_pairs = json::array({ {"one", 1}, {"two", 2} });
    12 
    13  // serialize the JSON arrays
    14  std::cout << j_no_init_list << '\n';
    15  std::cout << j_empty_init_list << '\n';
    16  std::cout << j_nonempty_init_list << '\n';
    17  std::cout << j_list_of_pairs << '\n';
    18 }
    static basic_json array(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an array from an initializer list
    Definition: json.hpp:1470
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    Output (play with this example online):
    []
     []
     [1,2,3,4]
    @@ -295,7 +277,7 @@ template<template< typename U, typename V, typename...Args > class Obje
     object(std::initializer_list<basic_json>) – create a JSON object value from an initializer list
    Since
    version 1.0.0
    -

    Definition at line 1467 of file json.hpp.

    +

    Definition at line 1470 of file json.hpp.

    @@ -305,9 +287,9 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 2fed1246a..7b46765e0 100644 --- a/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: /Users/niels/Documents/Repositories/json/src Directory Reference @@ -33,7 +33,7 @@ - + @@ -92,9 +92,9 @@ Files diff --git a/doxygen.css b/doxygen.css index b2c94ac21..1425ec530 100644 --- a/doxygen.css +++ b/doxygen.css @@ -1,4 +1,4 @@ -/* The standard CSS for doxygen 1.8.10 */ +/* The standard CSS for doxygen 1.8.11 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; @@ -206,6 +206,11 @@ div.line { transition-duration: 0.5s; } +div.line:after { + content:"\000A"; + white-space: pre; +} + div.line.glow { background-color: cyan; box-shadow: 0 0 10px cyan; @@ -242,7 +247,7 @@ div.ah, span.ah { -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); - background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); } div.classindex ul { @@ -832,6 +837,10 @@ address { color: #2A3D61; } +table.doxtable caption { + caption-side: top; +} + table.doxtable { border-collapse:collapse; margin-top: 4px; @@ -997,6 +1006,18 @@ div.summary a white-space: nowrap; } +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + div.ingroups { font-size: 8pt; @@ -1196,7 +1217,7 @@ div.toc { border-radius: 7px 7px 7px 7px; float: right; height: auto; - margin: 0 20px 10px 10px; + margin: 0 8px 10px 10px; width: 200px; } diff --git a/functions.html b/functions.html index 9a2d1ccd7..584fe8343 100644 --- a/functions.html +++ b/functions.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -134,9 +134,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x7e.html b/functions_0x7e.html new file mode 100644 index 000000000..d8adbe063 --- /dev/null +++ b/functions_0x7e.html @@ -0,0 +1,133 @@ + + + + + + +JSON for Modern C++: Class Members + + + + + + + + + + + +
    +
    + + + + + + +
    +
    JSON for Modern C++ +  1.0.0 +
    +
    +
    + + + + + + + +
    + +
    +
    + + +
    + +
    + +
    +
    Here is a list of all class members with links to the classes they belong to:
    + +

    - ~ -

    +
    + + + + diff --git a/functions_b.html b/functions_b.html index 842385082..606d31459 100644 --- a/functions_b.html +++ b/functions_b.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -139,9 +139,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_c.html b/functions_c.html index 945d04820..da57d444c 100644 --- a/functions_c.html +++ b/functions_c.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -152,9 +152,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_d.html b/functions_d.html index 9488f9e6a..355216eb4 100644 --- a/functions_d.html +++ b/functions_d.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -129,9 +129,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_e.html b/functions_e.html index f3d8653bb..aa4416785 100644 --- a/functions_e.html +++ b/functions_e.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -131,9 +131,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_enum.html b/functions_enum.html index 1e237f878..fed8cddd9 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members - Enumerations @@ -33,7 +33,7 @@ - + @@ -103,9 +103,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_f.html b/functions_f.html index d31fe4999..2837aed66 100644 --- a/functions_f.html +++ b/functions_f.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -128,9 +128,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func.html b/functions_func.html index 991aa81b2..34b1f69af 100644 --- a/functions_func.html +++ b/functions_func.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members - Functions @@ -33,7 +33,7 @@ - + @@ -95,7 +95,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -405,7 +405,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); -

    - ~ -

      +

      - ~ -

      • ~basic_json() : nlohmann::basic_json
      • @@ -413,9 +413,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_g.html b/functions_g.html index b0a3162f9..6aa7e356f 100644 --- a/functions_g.html +++ b/functions_g.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
      • s
      • t
      • v
      • -
      • ~
      • +
      • ~
      @@ -131,9 +131,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_i.html b/functions_i.html index baa01076e..97685698b 100644 --- a/functions_i.html +++ b/functions_i.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    • s
    • t
    • v
    • -
    • ~
    • +
    • ~
    @@ -167,9 +167,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_j.html b/functions_j.html index 53ad3afdf..989b04584 100644 --- a/functions_j.html +++ b/functions_j.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -125,9 +125,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_k.html b/functions_k.html index 523c4255d..5d9243aa5 100644 --- a/functions_k.html +++ b/functions_k.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -126,9 +126,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_m.html b/functions_m.html index c99db8a30..bc7f7e0bc 100644 --- a/functions_m.html +++ b/functions_m.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -125,9 +125,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_n.html b/functions_n.html index d33ab2d4b..47e075622 100644 --- a/functions_n.html +++ b/functions_n.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -128,9 +128,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_o.html b/functions_o.html index c8995c663..4c2a52872 100644 --- a/functions_o.html +++ b/functions_o.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -216,9 +216,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_p.html b/functions_p.html index de0c3060b..ad2c165ab 100644 --- a/functions_p.html +++ b/functions_p.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -139,9 +139,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_r.html b/functions_r.html index 35f178ffe..fd0aeb7b8 100644 --- a/functions_r.html +++ b/functions_r.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -137,9 +137,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_rela.html b/functions_rela.html index a7795c2a3..2e6e626ed 100644 --- a/functions_rela.html +++ b/functions_rela.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members - Related Functions @@ -33,7 +33,7 @@ - + @@ -124,9 +124,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_s.html b/functions_s.html index 21aa6d454..d52c94251 100644 --- a/functions_s.html +++ b/functions_s.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -134,9 +134,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_t.html b/functions_t.html index 6952606b7..d1ef5eb42 100644 --- a/functions_t.html +++ b/functions_t.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -125,9 +125,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_type.html b/functions_type.html index fd37e6aa8..15e4cc841 100644 --- a/functions_type.html +++ b/functions_type.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members - Typedefs @@ -33,7 +33,7 @@ - + @@ -162,9 +162,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_v.html b/functions_v.html index 5a6762bdb..dc9ef9cb1 100644 --- a/functions_v.html +++ b/functions_v.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Members @@ -33,7 +33,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • s
  • t
  • v
  • -
  • ~
  • +
  • ~
  • @@ -135,9 +135,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/graph_legend.html b/graph_legend.html index f9b535df0..f6378393f 100644 --- a/graph_legend.html +++ b/graph_legend.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Graph Legend @@ -33,7 +33,7 @@ - + @@ -80,41 +80,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This page explains how to interpret the graphs that are generated by doxygen.

    -

    Consider the following example:

    1 /*! Invisible class because of truncation */
    -
    2 class Invisible { };
    -
    3 
    -
    4 /*! Truncated class, inheritance relation is hidden */
    -
    5 class Truncated : public Invisible { };
    -
    6 
    -
    7 /* Class not documented with doxygen comments */
    -
    8 class Undocumented { };
    -
    9 
    -
    10 /*! Class that is inherited using public inheritance */
    -
    11 class PublicBase : public Truncated { };
    -
    12 
    -
    13 /*! A template class */
    -
    14 template<class T> class Templ { };
    -
    15 
    -
    16 /*! Class that is inherited using protected inheritance */
    -
    17 class ProtectedBase { };
    -
    18 
    -
    19 /*! Class that is inherited using private inheritance */
    -
    20 class PrivateBase { };
    -
    21 
    -
    22 /*! Class that is used by the Inherited class */
    -
    23 class Used { };
    -
    24 
    -
    25 /*! Super class that inherits a number of other classes */
    -
    26 class Inherited : public PublicBase,
    -
    27  protected ProtectedBase,
    -
    28  private PrivateBase,
    -
    29  public Undocumented,
    -
    30  public Templ<int>
    -
    31 {
    -
    32  private:
    -
    33  Used *m_usedClass;
    -
    34 };
    -

    This will result in the following graph:

    +

    Consider the following example:

    1 /*! Invisible class because of truncation */
    2 class Invisible { };
    3 
    4 /*! Truncated class, inheritance relation is hidden */
    5 class Truncated : public Invisible { };
    6 
    7 /* Class not documented with doxygen comments */
    8 class Undocumented { };
    9 
    10 /*! Class that is inherited using public inheritance */
    11 class PublicBase : public Truncated { };
    12 
    13 /*! A template class */
    14 template<class T> class Templ { };
    15 
    16 /*! Class that is inherited using protected inheritance */
    17 class ProtectedBase { };
    18 
    19 /*! Class that is inherited using private inheritance */
    20 class PrivateBase { };
    21 
    22 /*! Class that is used by the Inherited class */
    23 class Used { };
    24 
    25 /*! Super class that inherits a number of other classes */
    26 class Inherited : public PublicBase,
    27  protected ProtectedBase,
    28  private PrivateBase,
    29  public Undocumented,
    30  public Templ<int>
    31 {
    32  private:
    33  Used *m_usedClass;
    34 };

    This will result in the following graph:

    The boxes in the above graph have the following meaning:

    • @@ -142,9 +108,9 @@ A yellow dashed arrow denotes a relation between a template instance and the tem
    diff --git a/hierarchy.html b/hierarchy.html index 9ae7cfd13..4e804a9f7 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Class Hierarchy @@ -33,7 +33,7 @@ - + @@ -101,9 +101,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/index.html b/index.html index 9f12467d4..e689ff639 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Main Page @@ -33,7 +33,7 @@ - + @@ -92,9 +92,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/json_8hpp_source.html b/json_8hpp_source.html index 71a923e99..f80c4ee62 100644 --- a/json_8hpp_source.html +++ b/json_8hpp_source.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: /Users/niels/Documents/Repositories/json/src/json.hpp Source File @@ -33,7 +33,7 @@ - + @@ -83,4841 +83,215 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    json.hpp
    -
    1 
    -
    38 #ifndef NLOHMANN_JSON_HPP
    -
    39 #define NLOHMANN_JSON_HPP
    -
    40 
    -
    41 #include <algorithm>
    -
    42 #include <array>
    -
    43 #include <ciso646>
    -
    44 #include <cmath>
    -
    45 #include <cstdio>
    -
    46 #include <functional>
    -
    47 #include <initializer_list>
    -
    48 #include <iomanip>
    -
    49 #include <iostream>
    -
    50 #include <iterator>
    -
    51 #include <limits>
    -
    52 #include <map>
    -
    53 #include <memory>
    -
    54 #include <sstream>
    -
    55 #include <string>
    -
    56 #include <type_traits>
    -
    57 #include <utility>
    -
    58 #include <vector>
    -
    59 
    -
    60 // enable ssize_t on MinGW
    -
    61 #ifdef __GNUC__
    -
    62  #ifdef __MINGW32__
    -
    63  #include <sys/types.h>
    -
    64  #endif
    -
    65 #endif
    -
    66 
    -
    67 // enable ssize_t for MSVC
    -
    68 #ifdef _MSC_VER
    -
    69  #include <basetsd.h>
    -
    70  using ssize_t = SSIZE_T;
    -
    71 #endif
    -
    72 
    -
    78 namespace nlohmann
    -
    79 {
    -
    80 
    -
    81 
    -
    86 namespace
    -
    87 {
    -
    92 template<typename T>
    -
    93 struct has_mapped_type
    -
    94 {
    -
    95  private:
    -
    96  template<typename C> static char test(typename C::mapped_type*);
    -
    97  template<typename C> static int test(...);
    -
    98  public:
    -
    99  enum { value = sizeof(test<T>(0)) == sizeof(char) };
    -
    100 };
    -
    101 
    -
    103 template<typename T>
    -
    104 static bool approx(const T a, const T b)
    -
    105 {
    -
    106  return not (a > b or a < b);
    -
    107 }
    -
    108 }
    -
    109 
    -
    178 template <
    -
    179  template<typename U, typename V, typename... Args> class ObjectType = std::map,
    -
    180  template<typename U, typename... Args> class ArrayType = std::vector,
    -
    181  class StringType = std::string,
    -
    182  class BooleanType = bool,
    -
    183  class NumberIntegerType = int64_t,
    -
    184  class NumberFloatType = double,
    -
    185  template<typename U> class AllocatorType = std::allocator
    -
    186  >
    - -
    188 {
    -
    189  private:
    -
    191  using basic_json_t = basic_json<ObjectType,
    -
    192  ArrayType,
    -
    193  StringType,
    -
    194  BooleanType,
    -
    195  NumberIntegerType,
    -
    196  NumberFloatType,
    -
    197  AllocatorType>;
    -
    198 
    -
    199  public:
    -
    200 
    -
    202  // container types //
    -
    204 
    -
    207 
    - -
    210 
    - -
    213 
    -
    215  using const_reference = const value_type&;
    -
    216 
    -
    218  using difference_type = std::ptrdiff_t;
    -
    219 
    -
    221  using size_type = std::size_t;
    -
    222 
    -
    224  using allocator_type = AllocatorType<basic_json>;
    -
    225 
    -
    227  using pointer = typename std::allocator_traits<allocator_type>::pointer;
    -
    229  using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer;
    -
    230 
    -
    231  // forward declaration
    -
    232  template<typename Base> class json_reverse_iterator;
    -
    233 
    -
    235  class iterator;
    -
    237  class const_iterator;
    - - -
    242 
    -
    244 
    -
    245 
    - -
    250  {
    -
    251  return allocator_type();
    -
    252  }
    -
    253 
    -
    254 
    -
    256  // JSON value data types //
    -
    258 
    -
    261 
    -
    336  using object_t = ObjectType<StringType,
    -
    337  basic_json,
    -
    338  std::less<StringType>,
    -
    339  AllocatorType<std::pair<const StringType,
    -
    340  basic_json>>>;
    -
    341 
    -
    386  using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
    -
    387 
    -
    433  using string_t = StringType;
    -
    434 
    -
    459  using boolean_t = BooleanType;
    -
    460 
    -
    527  using number_integer_t = NumberIntegerType;
    -
    528 
    -
    592  using number_float_t = NumberFloatType;
    -
    593 
    -
    595 
    -
    596 
    -
    598  // JSON type enumeration //
    -
    600 
    -
    611  enum class value_t : uint8_t
    -
    612  {
    -
    613  null,
    -
    614  object,
    -
    615  array,
    -
    616  string,
    -
    617  boolean,
    - -
    619  number_float,
    -
    620  discarded
    -
    621  };
    -
    622 
    -
    623 
    -
    624  private:
    -
    626  template<typename T, typename... Args>
    -
    627  static T* create(Args&& ... args)
    -
    628  {
    -
    629  AllocatorType<T> alloc;
    -
    630  auto deleter = [&](T * object)
    -
    631  {
    -
    632  alloc.deallocate(object, 1);
    -
    633  };
    -
    634  std::unique_ptr<T, decltype(deleter)> object(alloc.allocate(1), deleter);
    -
    635  alloc.construct(object.get(), std::forward<Args>(args)...);
    -
    636  return object.release();
    -
    637  }
    -
    638 
    -
    640  // JSON value storage //
    -
    642 
    -
    650  union json_value
    -
    651  {
    -
    653  object_t* object;
    -
    655  array_t* array;
    -
    657  string_t* string;
    -
    659  boolean_t boolean;
    -
    661  number_integer_t number_integer;
    -
    663  number_float_t number_float;
    -
    664 
    -
    666  json_value() noexcept = default;
    -
    668  json_value(boolean_t v) noexcept : boolean(v) {}
    -
    670  json_value(number_integer_t v) noexcept : number_integer(v) {}
    -
    672  json_value(number_float_t v) noexcept : number_float(v) {}
    -
    674  json_value(value_t t)
    -
    675  {
    -
    676  switch (t)
    -
    677  {
    -
    678  case value_t::object:
    -
    679  {
    -
    680  object = create<object_t>();
    -
    681  break;
    -
    682  }
    -
    683 
    -
    684  case value_t::array:
    -
    685  {
    -
    686  array = create<array_t>();
    -
    687  break;
    -
    688  }
    -
    689 
    -
    690  case value_t::string:
    -
    691  {
    -
    692  string = create<string_t>("");
    -
    693  break;
    -
    694  }
    -
    695 
    -
    696  case value_t::boolean:
    -
    697  {
    -
    698  boolean = boolean_t(false);
    -
    699  break;
    -
    700  }
    -
    701 
    - -
    703  {
    -
    704  number_integer = number_integer_t(0);
    -
    705  break;
    -
    706  }
    -
    707 
    - -
    709  {
    -
    710  number_float = number_float_t(0.0);
    -
    711  break;
    -
    712  }
    -
    713 
    -
    714  default:
    -
    715  {
    -
    716  break;
    -
    717  }
    -
    718  }
    -
    719  }
    -
    720 
    -
    722  json_value(const string_t& value)
    -
    723  {
    -
    724  string = create<string_t>(value);
    -
    725  }
    -
    726 
    -
    728  json_value(const object_t& value)
    -
    729  {
    -
    730  object = create<object_t>(value);
    -
    731  }
    -
    732 
    -
    734  json_value(const array_t& value)
    -
    735  {
    -
    736  array = create<array_t>(value);
    -
    737  }
    -
    738  };
    -
    739 
    -
    740 
    -
    741  public:
    -
    743  // JSON parser callback //
    -
    745 
    -
    754  enum class parse_event_t : uint8_t
    -
    755  {
    -
    757  object_start,
    -
    759  object_end,
    -
    761  array_start,
    -
    763  array_end,
    -
    765  key,
    -
    767  value
    -
    768  };
    -
    769 
    -
    819  using parser_callback_t = std::function<bool(int depth, parse_event_t event, basic_json& parsed)>;
    -
    820 
    -
    821 
    -
    823  // constructors //
    -
    825 
    -
    828 
    - -
    867  : m_type(value_type), m_value(value_type)
    -
    868  {}
    -
    869 
    -
    889  basic_json() noexcept = default;
    -
    890 
    -
    910  basic_json(std::nullptr_t) noexcept
    -
    911  : basic_json(value_t::null)
    -
    912  {}
    -
    913 
    -
    933  basic_json(const object_t& val)
    -
    934  : m_type(value_t::object), m_value(val)
    -
    935  {}
    -
    936 
    -
    960  template <class CompatibleObjectType, typename
    -
    961  std::enable_if<
    -
    962  std::is_constructible<typename object_t::key_type, typename CompatibleObjectType::key_type>::value and
    -
    963  std::is_constructible<basic_json, typename CompatibleObjectType::mapped_type>::value, int>::type
    -
    964  = 0>
    -
    965  basic_json(const CompatibleObjectType& val)
    -
    966  : m_type(value_t::object)
    -
    967  {
    -
    968  using std::begin;
    -
    969  using std::end;
    -
    970  m_value.object = create<object_t>(begin(val), end(val));
    -
    971  }
    -
    972 
    -
    992  basic_json(const array_t& val)
    -
    993  : m_type(value_t::array), m_value(val)
    -
    994  {}
    -
    995 
    -
    1019  template <class CompatibleArrayType, typename
    -
    1020  std::enable_if<
    -
    1021  not std::is_same<CompatibleArrayType, typename basic_json_t::iterator>::value and
    -
    1022  not std::is_same<CompatibleArrayType, typename basic_json_t::const_iterator>::value and
    -
    1023  not std::is_same<CompatibleArrayType, typename basic_json_t::reverse_iterator>::value and
    -
    1024  not std::is_same<CompatibleArrayType, typename basic_json_t::const_reverse_iterator>::value and
    -
    1025  not std::is_same<CompatibleArrayType, typename array_t::iterator>::value and
    -
    1026  not std::is_same<CompatibleArrayType, typename array_t::const_iterator>::value and
    -
    1027  std::is_constructible<basic_json, typename CompatibleArrayType::value_type>::value, int>::type
    -
    1028  = 0>
    -
    1029  basic_json(const CompatibleArrayType& val)
    -
    1030  : m_type(value_t::array)
    -
    1031  {
    -
    1032  using std::begin;
    -
    1033  using std::end;
    -
    1034  m_value.array = create<array_t>(begin(val), end(val));
    -
    1035  }
    -
    1036 
    -
    1058  basic_json(const string_t& val)
    -
    1059  : m_type(value_t::string), m_value(val)
    -
    1060  {}
    -
    1061 
    -
    1082  basic_json(const typename string_t::value_type* val)
    -
    1083  : basic_json(string_t(val))
    -
    1084  {}
    -
    1085 
    -
    1109  template <class CompatibleStringType, typename
    -
    1110  std::enable_if<
    -
    1111  std::is_constructible<string_t, CompatibleStringType>::value, int>::type
    -
    1112  = 0>
    -
    1113  basic_json(const CompatibleStringType& val)
    -
    1114  : basic_json(string_t(val))
    -
    1115  {}
    -
    1116 
    - -
    1132  : m_type(value_t::boolean), m_value(val)
    -
    1133  {}
    -
    1134 
    -
    1160  template<typename T,
    -
    1161  typename std::enable_if<
    -
    1162  not (std::is_same<T, int>::value)
    -
    1163  and std::is_same<T, number_integer_t>::value
    -
    1164  , int>::type = 0>
    -
    1165  basic_json(const number_integer_t val)
    -
    1166  : m_type(value_t::number_integer), m_value(val)
    -
    1167  {}
    -
    1168 
    -
    1194  basic_json(const int val)
    -
    1195  : m_type(value_t::number_integer),
    -
    1196  m_value(static_cast<number_integer_t>(val))
    -
    1197  {}
    -
    1198 
    -
    1224  template<typename CompatibleNumberIntegerType, typename
    -
    1225  std::enable_if<
    -
    1226  std::is_constructible<number_integer_t, CompatibleNumberIntegerType>::value and
    -
    1227  std::numeric_limits<CompatibleNumberIntegerType>::is_integer, CompatibleNumberIntegerType>::type
    -
    1228  = 0>
    -
    1229  basic_json(const CompatibleNumberIntegerType val) noexcept
    -
    1230  : m_type(value_t::number_integer),
    -
    1231  m_value(static_cast<number_integer_t>(val))
    -
    1232  {}
    -
    1233 
    - -
    1259  : m_type(value_t::number_float), m_value(val)
    -
    1260  {
    -
    1261  // replace infinity and NAN by null
    -
    1262  if (not std::isfinite(val))
    -
    1263  {
    -
    1264  m_type = value_t::null;
    -
    1265  m_value = json_value();
    -
    1266  }
    -
    1267  }
    -
    1268 
    -
    1299  template<typename CompatibleNumberFloatType, typename = typename
    -
    1300  std::enable_if<
    -
    1301  std::is_constructible<number_float_t, CompatibleNumberFloatType>::value and
    -
    1302  std::is_floating_point<CompatibleNumberFloatType>::value>::type
    -
    1303  >
    -
    1304  basic_json(const CompatibleNumberFloatType val) noexcept
    -
    1305  : basic_json(number_float_t(val))
    -
    1306  {}
    -
    1307 
    -
    1377  basic_json(std::initializer_list<basic_json> init,
    -
    1378  bool type_deduction = true,
    -
    1379  value_t manual_type = value_t::array)
    -
    1380  {
    -
    1381  // the initializer list could describe an object
    -
    1382  bool is_an_object = true;
    -
    1383 
    -
    1384  // check if each element is an array with two elements whose first
    -
    1385  // element is a string
    -
    1386  for (const auto& element : init)
    -
    1387  {
    -
    1388  if (not element.is_array() or element.size() != 2
    -
    1389  or not element[0].is_string())
    -
    1390  {
    -
    1391  // we found an element that makes it impossible to use the
    -
    1392  // initializer list as object
    -
    1393  is_an_object = false;
    -
    1394  break;
    -
    1395  }
    -
    1396  }
    -
    1397 
    -
    1398  // adjust type if type deduction is not wanted
    -
    1399  if (not type_deduction)
    -
    1400  {
    -
    1401  // if array is wanted, do not create an object though possible
    -
    1402  if (manual_type == value_t::array)
    -
    1403  {
    -
    1404  is_an_object = false;
    -
    1405  }
    -
    1406 
    -
    1407  // if object is wanted but impossible, throw an exception
    -
    1408  if (manual_type == value_t::object and not is_an_object)
    -
    1409  {
    -
    1410  throw std::domain_error("cannot create object from initializer list");
    -
    1411  }
    -
    1412  }
    -
    1413 
    -
    1414  if (is_an_object)
    -
    1415  {
    -
    1416  // the initializer list is a list of pairs -> create object
    -
    1417  m_type = value_t::object;
    -
    1418  m_value = value_t::object;
    -
    1419 
    -
    1420  for (auto& element : init)
    -
    1421  {
    -
    1422  m_value.object->emplace(std::move(*(element[0].m_value.string)), std::move(element[1]));
    -
    1423  }
    -
    1424  }
    -
    1425  else
    -
    1426  {
    -
    1427  // the initializer list describes an array -> create array
    -
    1428  m_type = value_t::array;
    -
    1429  m_value.array = create<array_t>(std::move(init));
    -
    1430  }
    -
    1431  }
    -
    1432 
    -
    1467  static basic_json array(std::initializer_list<basic_json> init =
    -
    1468  std::initializer_list<basic_json>())
    -
    1469  {
    -
    1470  return basic_json(init, false, value_t::array);
    -
    1471  }
    -
    1472 
    -
    1507  static basic_json object(std::initializer_list<basic_json> init =
    -
    1508  std::initializer_list<basic_json>())
    -
    1509  {
    -
    1510  return basic_json(init, false, value_t::object);
    -
    1511  }
    -
    1512 
    -
    1531  basic_json(size_type cnt, const basic_json& val)
    -
    1532  : m_type(value_t::array)
    -
    1533  {
    -
    1534  m_value.array = create<array_t>(cnt, val);
    -
    1535  }
    -
    1536 
    -
    1571  template <class InputIT, typename
    -
    1572  std::enable_if<
    -
    1573  std::is_same<InputIT, typename basic_json_t::iterator>::value or
    -
    1574  std::is_same<InputIT, typename basic_json_t::const_iterator>::value
    -
    1575  , int>::type
    -
    1576  = 0>
    -
    1577  basic_json(InputIT first, InputIT last) : m_type(first.m_object->m_type)
    -
    1578  {
    -
    1579  // make sure iterator fits the current value
    -
    1580  if (first.m_object != last.m_object)
    -
    1581  {
    -
    1582  throw std::domain_error("iterators are not compatible");
    -
    1583  }
    -
    1584 
    -
    1585  // check if iterator range is complete for primitive values
    -
    1586  switch (m_type)
    -
    1587  {
    -
    1588  case value_t::boolean:
    -
    1589  case value_t::number_float:
    - -
    1591  case value_t::string:
    -
    1592  {
    -
    1593  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
    -
    1594  {
    -
    1595  throw std::out_of_range("iterators out of range");
    -
    1596  }
    -
    1597  break;
    -
    1598  }
    -
    1599 
    -
    1600  default:
    -
    1601  {
    -
    1602  break;
    -
    1603  }
    -
    1604  }
    -
    1605 
    -
    1606  switch (m_type)
    -
    1607  {
    - -
    1609  {
    -
    1610  m_value.number_integer = first.m_object->m_value.number_integer;
    -
    1611  break;
    -
    1612  }
    -
    1613 
    -
    1614  case value_t::number_float:
    -
    1615  {
    -
    1616  m_value.number_float = first.m_object->m_value.number_float;
    -
    1617  break;
    -
    1618  }
    -
    1619 
    -
    1620  case value_t::boolean:
    -
    1621  {
    -
    1622  m_value.boolean = first.m_object->m_value.boolean;
    -
    1623  break;
    -
    1624  }
    -
    1625 
    -
    1626  case value_t::string:
    -
    1627  {
    -
    1628  m_value = *first.m_object->m_value.string;
    -
    1629  break;
    -
    1630  }
    -
    1631 
    -
    1632  case value_t::object:
    -
    1633  {
    -
    1634  m_value.object = create<object_t>(first.m_it.object_iterator, last.m_it.object_iterator);
    -
    1635  break;
    -
    1636  }
    -
    1637 
    -
    1638  case value_t::array:
    -
    1639  {
    -
    1640  m_value.array = create<array_t>(first.m_it.array_iterator, last.m_it.array_iterator);
    -
    1641  break;
    -
    1642  }
    -
    1643 
    -
    1644  default:
    -
    1645  {
    -
    1646  throw std::domain_error("cannot use construct with iterators from " + first.m_object->type_name());
    -
    1647  }
    -
    1648  }
    -
    1649  }
    -
    1650 
    -
    1652  // other constructors and destructor //
    -
    1654 
    -
    1675  basic_json(const basic_json& other)
    -
    1676  : m_type(other.m_type)
    -
    1677  {
    -
    1678  switch (m_type)
    -
    1679  {
    -
    1680  case value_t::object:
    -
    1681  {
    -
    1682  m_value = *other.m_value.object;
    -
    1683  break;
    -
    1684  }
    -
    1685 
    -
    1686  case value_t::array:
    -
    1687  {
    -
    1688  m_value = *other.m_value.array;
    -
    1689  break;
    -
    1690  }
    -
    1691 
    -
    1692  case value_t::string:
    -
    1693  {
    -
    1694  m_value = *other.m_value.string;
    -
    1695  break;
    -
    1696  }
    -
    1697 
    -
    1698  case value_t::boolean:
    -
    1699  {
    -
    1700  m_value = other.m_value.boolean;
    -
    1701  break;
    -
    1702  }
    -
    1703 
    - -
    1705  {
    -
    1706  m_value = other.m_value.number_integer;
    -
    1707  break;
    -
    1708  }
    -
    1709 
    -
    1710  case value_t::number_float:
    -
    1711  {
    -
    1712  m_value = other.m_value.number_float;
    -
    1713  break;
    -
    1714  }
    -
    1715 
    -
    1716  default:
    -
    1717  {
    -
    1718  break;
    -
    1719  }
    -
    1720  }
    -
    1721  }
    -
    1722 
    -
    1741  basic_json(basic_json&& other) noexcept
    -
    1742  : m_type(std::move(other.m_type)),
    -
    1743  m_value(std::move(other.m_value))
    -
    1744  {
    -
    1745  // invalidate payload
    -
    1746  other.m_type = value_t::null;
    -
    1747  other.m_value = {};
    -
    1748  }
    -
    1749 
    -
    1771  reference& operator=(basic_json other) noexcept (
    -
    1772  std::is_nothrow_move_constructible<value_t>::value and
    -
    1773  std::is_nothrow_move_assignable<value_t>::value and
    -
    1774  std::is_nothrow_move_constructible<json_value>::value and
    -
    1775  std::is_nothrow_move_assignable<json_value>::value
    -
    1776  )
    -
    1777  {
    -
    1778  using std::swap;
    -
    1779  swap(m_type, other.m_type);
    -
    1780  swap(m_value, other.m_value);
    -
    1781  return *this;
    -
    1782  }
    -
    1783 
    - -
    1798  {
    -
    1799  switch (m_type)
    -
    1800  {
    -
    1801  case value_t::object:
    -
    1802  {
    -
    1803  AllocatorType<object_t> alloc;
    -
    1804  alloc.destroy(m_value.object);
    -
    1805  alloc.deallocate(m_value.object, 1);
    -
    1806  break;
    -
    1807  }
    -
    1808 
    -
    1809  case value_t::array:
    -
    1810  {
    -
    1811  AllocatorType<array_t> alloc;
    -
    1812  alloc.destroy(m_value.array);
    -
    1813  alloc.deallocate(m_value.array, 1);
    -
    1814  break;
    -
    1815  }
    -
    1816 
    -
    1817  case value_t::string:
    -
    1818  {
    -
    1819  AllocatorType<string_t> alloc;
    -
    1820  alloc.destroy(m_value.string);
    -
    1821  alloc.deallocate(m_value.string, 1);
    -
    1822  break;
    -
    1823  }
    -
    1824 
    -
    1825  default:
    -
    1826  {
    -
    1827  // all other types need no specific destructor
    -
    1828  break;
    -
    1829  }
    -
    1830  }
    -
    1831  }
    -
    1832 
    -
    1834 
    -
    1835  public:
    -
    1837  // object inspection //
    -
    1839 
    -
    1842 
    -
    1866  string_t dump(const int indent = -1) const
    -
    1867  {
    -
    1868  std::stringstream ss;
    -
    1869 
    -
    1870  if (indent >= 0)
    -
    1871  {
    -
    1872  dump(ss, true, static_cast<unsigned int>(indent));
    -
    1873  }
    -
    1874  else
    -
    1875  {
    -
    1876  dump(ss, false, 0);
    -
    1877  }
    -
    1878 
    -
    1879  return ss.str();
    -
    1880  }
    -
    1881 
    -
    1897  value_t type() const noexcept
    -
    1898  {
    -
    1899  return m_type;
    -
    1900  }
    -
    1901 
    -
    1918  bool is_primitive() const noexcept
    -
    1919  {
    -
    1920  return is_null() or is_string() or is_boolean() or is_number();
    -
    1921  }
    -
    1922 
    -
    1938  bool is_structured() const noexcept
    -
    1939  {
    -
    1940  return is_array() or is_object();
    -
    1941  }
    -
    1942 
    -
    1957  bool is_null() const noexcept
    -
    1958  {
    -
    1959  return m_type == value_t::null;
    -
    1960  }
    -
    1961 
    -
    1976  bool is_boolean() const noexcept
    -
    1977  {
    -
    1978  return m_type == value_t::boolean;
    -
    1979  }
    -
    1980 
    -
    2000  bool is_number() const noexcept
    -
    2001  {
    -
    2002  return is_number_integer() or is_number_float();
    -
    2003  }
    -
    2004 
    -
    2023  bool is_number_integer() const noexcept
    -
    2024  {
    -
    2025  return m_type == value_t::number_integer;
    -
    2026  }
    -
    2027 
    -
    2046  bool is_number_float() const noexcept
    -
    2047  {
    -
    2048  return m_type == value_t::number_float;
    -
    2049  }
    -
    2050 
    -
    2065  bool is_object() const noexcept
    -
    2066  {
    -
    2067  return m_type == value_t::object;
    -
    2068  }
    -
    2069 
    -
    2084  bool is_array() const noexcept
    -
    2085  {
    -
    2086  return m_type == value_t::array;
    -
    2087  }
    -
    2088 
    -
    2103  bool is_string() const noexcept
    -
    2104  {
    -
    2105  return m_type == value_t::string;
    -
    2106  }
    -
    2107 
    -
    2127  bool is_discarded() const noexcept
    -
    2128  {
    -
    2129  return m_type == value_t::discarded;
    -
    2130  }
    -
    2131 
    -
    2147  operator value_t() const noexcept
    -
    2148  {
    -
    2149  return m_type;
    -
    2150  }
    -
    2151 
    -
    2153 
    -
    2154  private:
    -
    2156  // value access //
    -
    2158 
    -
    2160  template <class T, typename
    -
    2161  std::enable_if<
    -
    2162  std::is_convertible<typename object_t::key_type, typename T::key_type>::value and
    -
    2163  std::is_convertible<basic_json_t, typename T::mapped_type>::value
    -
    2164  , int>::type = 0>
    -
    2165  T get_impl(T*) const
    -
    2166  {
    -
    2167  if (is_object())
    -
    2168  {
    -
    2169  return T(m_value.object->begin(), m_value.object->end());
    -
    2170  }
    -
    2171  else
    -
    2172  {
    -
    2173  throw std::domain_error("type must be object, but is " + type_name());
    -
    2174  }
    -
    2175  }
    -
    2176 
    -
    2178  object_t get_impl(object_t*) const
    -
    2179  {
    -
    2180  if (is_object())
    -
    2181  {
    -
    2182  return *(m_value.object);
    -
    2183  }
    -
    2184  else
    -
    2185  {
    -
    2186  throw std::domain_error("type must be object, but is " + type_name());
    -
    2187  }
    -
    2188  }
    -
    2189 
    -
    2191  template <class T, typename
    -
    2192  std::enable_if<
    -
    2193  std::is_convertible<basic_json_t, typename T::value_type>::value and
    -
    2194  not std::is_same<basic_json_t, typename T::value_type>::value and
    -
    2195  not std::is_arithmetic<T>::value and
    -
    2196  not std::is_convertible<std::string, T>::value and
    -
    2197  not has_mapped_type<T>::value
    -
    2198  , int>::type = 0>
    -
    2199  T get_impl(T*) const
    -
    2200  {
    -
    2201  if (is_array())
    -
    2202  {
    -
    2203  T to_vector;
    -
    2204  std::transform(m_value.array->begin(), m_value.array->end(),
    -
    2205  std::inserter(to_vector, to_vector.end()), [](basic_json i)
    -
    2206  {
    -
    2207  return i.get<typename T::value_type>();
    -
    2208  });
    -
    2209  return to_vector;
    -
    2210  }
    -
    2211  else
    -
    2212  {
    -
    2213  throw std::domain_error("type must be array, but is " + type_name());
    -
    2214  }
    -
    2215  }
    -
    2216 
    -
    2218  template <class T, typename
    -
    2219  std::enable_if<
    -
    2220  std::is_convertible<basic_json_t, T>::value and
    -
    2221  not std::is_same<basic_json_t, T>::value
    -
    2222  , int>::type = 0>
    -
    2223  std::vector<T> get_impl(std::vector<T>*) const
    -
    2224  {
    -
    2225  if (is_array())
    -
    2226  {
    -
    2227  std::vector<T> to_vector;
    -
    2228  to_vector.reserve(m_value.array->size());
    -
    2229  std::transform(m_value.array->begin(), m_value.array->end(),
    -
    2230  std::inserter(to_vector, to_vector.end()), [](basic_json i)
    -
    2231  {
    -
    2232  return i.get<T>();
    -
    2233  });
    -
    2234  return to_vector;
    -
    2235  }
    -
    2236  else
    -
    2237  {
    -
    2238  throw std::domain_error("type must be array, but is " + type_name());
    -
    2239  }
    -
    2240  }
    -
    2241 
    -
    2243  template <class T, typename
    -
    2244  std::enable_if<
    -
    2245  std::is_same<basic_json, typename T::value_type>::value and
    -
    2246  not has_mapped_type<T>::value
    -
    2247  , int>::type = 0>
    -
    2248  T get_impl(T*) const
    -
    2249  {
    -
    2250  if (is_array())
    -
    2251  {
    -
    2252  return T(m_value.array->begin(), m_value.array->end());
    -
    2253  }
    -
    2254  else
    -
    2255  {
    -
    2256  throw std::domain_error("type must be array, but is " + type_name());
    -
    2257  }
    -
    2258  }
    -
    2259 
    -
    2261  array_t get_impl(array_t*) const
    -
    2262  {
    -
    2263  if (is_array())
    -
    2264  {
    -
    2265  return *(m_value.array);
    -
    2266  }
    -
    2267  else
    -
    2268  {
    -
    2269  throw std::domain_error("type must be array, but is " + type_name());
    -
    2270  }
    -
    2271  }
    -
    2272 
    -
    2274  template <typename T, typename
    -
    2275  std::enable_if<
    -
    2276  std::is_convertible<string_t, T>::value
    -
    2277  , int>::type = 0>
    -
    2278  T get_impl(T*) const
    -
    2279  {
    -
    2280  if (is_string())
    -
    2281  {
    -
    2282  return *m_value.string;
    -
    2283  }
    -
    2284  else
    -
    2285  {
    -
    2286  throw std::domain_error("type must be string, but is " + type_name());
    -
    2287  }
    -
    2288  }
    -
    2289 
    -
    2291  template<typename T, typename
    -
    2292  std::enable_if<
    -
    2293  std::is_arithmetic<T>::value
    -
    2294  , int>::type = 0>
    -
    2295  T get_impl(T*) const
    -
    2296  {
    -
    2297  switch (m_type)
    -
    2298  {
    - -
    2300  {
    -
    2301  return static_cast<T>(m_value.number_integer);
    -
    2302  }
    -
    2303 
    -
    2304  case value_t::number_float:
    -
    2305  {
    -
    2306  return static_cast<T>(m_value.number_float);
    -
    2307  }
    -
    2308 
    -
    2309  default:
    -
    2310  {
    -
    2311  throw std::domain_error("type must be number, but is " + type_name());
    -
    2312  }
    -
    2313  }
    -
    2314  }
    -
    2315 
    -
    2317  boolean_t get_impl(boolean_t*) const
    -
    2318  {
    -
    2319  if (is_boolean())
    -
    2320  {
    -
    2321  return m_value.boolean;
    -
    2322  }
    -
    2323  else
    -
    2324  {
    -
    2325  throw std::domain_error("type must be boolean, but is " + type_name());
    -
    2326  }
    -
    2327  }
    -
    2328 
    -
    2330  object_t* get_impl_ptr(object_t*) noexcept
    -
    2331  {
    -
    2332  return is_object() ? m_value.object : nullptr;
    -
    2333  }
    -
    2334 
    -
    2336  const object_t* get_impl_ptr(const object_t*) const noexcept
    -
    2337  {
    -
    2338  return is_object() ? m_value.object : nullptr;
    -
    2339  }
    -
    2340 
    -
    2342  array_t* get_impl_ptr(array_t*) noexcept
    -
    2343  {
    -
    2344  return is_array() ? m_value.array : nullptr;
    -
    2345  }
    -
    2346 
    -
    2348  const array_t* get_impl_ptr(const array_t*) const noexcept
    -
    2349  {
    -
    2350  return is_array() ? m_value.array : nullptr;
    -
    2351  }
    -
    2352 
    -
    2354  string_t* get_impl_ptr(string_t*) noexcept
    -
    2355  {
    -
    2356  return is_string() ? m_value.string : nullptr;
    -
    2357  }
    -
    2358 
    -
    2360  const string_t* get_impl_ptr(const string_t*) const noexcept
    -
    2361  {
    -
    2362  return is_string() ? m_value.string : nullptr;
    -
    2363  }
    -
    2364 
    -
    2366  boolean_t* get_impl_ptr(boolean_t*) noexcept
    -
    2367  {
    -
    2368  return is_boolean() ? &m_value.boolean : nullptr;
    -
    2369  }
    -
    2370 
    -
    2372  const boolean_t* get_impl_ptr(const boolean_t*) const noexcept
    -
    2373  {
    -
    2374  return is_boolean() ? &m_value.boolean : nullptr;
    -
    2375  }
    -
    2376 
    -
    2378  number_integer_t* get_impl_ptr(number_integer_t*) noexcept
    -
    2379  {
    -
    2380  return is_number_integer() ? &m_value.number_integer : nullptr;
    -
    2381  }
    -
    2382 
    -
    2384  const number_integer_t* get_impl_ptr(const number_integer_t*) const noexcept
    -
    2385  {
    -
    2386  return is_number_integer() ? &m_value.number_integer : nullptr;
    -
    2387  }
    -
    2388 
    -
    2390  number_float_t* get_impl_ptr(number_float_t*) noexcept
    -
    2391  {
    -
    2392  return is_number_float() ? &m_value.number_float : nullptr;
    -
    2393  }
    -
    2394 
    -
    2396  const number_float_t* get_impl_ptr(const number_float_t*) const noexcept
    -
    2397  {
    -
    2398  return is_number_float() ? &m_value.number_float : nullptr;
    -
    2399  }
    -
    2400 
    -
    2401  public:
    -
    2402 
    -
    2405 
    -
    2439  template<typename ValueType, typename
    -
    2440  std::enable_if<
    -
    2441  not std::is_pointer<ValueType>::value
    -
    2442  , int>::type = 0>
    -
    2443  ValueType get() const
    -
    2444  {
    -
    2445  return get_impl(static_cast<ValueType*>(nullptr));
    -
    2446  }
    -
    2447 
    -
    2474  template<typename PointerType, typename
    -
    2475  std::enable_if<
    -
    2476  std::is_pointer<PointerType>::value
    -
    2477  , int>::type = 0>
    -
    2478  PointerType get() noexcept
    -
    2479  {
    -
    2480  // delegate the call to get_ptr
    -
    2481  return get_ptr<PointerType>();
    -
    2482  }
    -
    2483 
    -
    2488  template<typename PointerType, typename
    -
    2489  std::enable_if<
    -
    2490  std::is_pointer<PointerType>::value
    -
    2491  , int>::type = 0>
    -
    2492  const PointerType get() const noexcept
    -
    2493  {
    -
    2494  // delegate the call to get_ptr
    -
    2495  return get_ptr<PointerType>();
    -
    2496  }
    -
    2497 
    -
    2523  template<typename PointerType, typename
    -
    2524  std::enable_if<
    -
    2525  std::is_pointer<PointerType>::value
    -
    2526  , int>::type = 0>
    -
    2527  PointerType get_ptr() noexcept
    -
    2528  {
    -
    2529  // delegate the call to get_impl_ptr<>()
    -
    2530  return get_impl_ptr(static_cast<PointerType>(nullptr));
    -
    2531  }
    -
    2532 
    -
    2537  template<typename PointerType, typename
    -
    2538  std::enable_if<
    -
    2539  std::is_pointer<PointerType>::value
    -
    2540  and std::is_const<typename std::remove_pointer<PointerType>::type>::value
    -
    2541  , int>::type = 0>
    -
    2542  const PointerType get_ptr() const noexcept
    -
    2543  {
    -
    2544  // delegate the call to get_impl_ptr<>() const
    -
    2545  return get_impl_ptr(static_cast<const PointerType>(nullptr));
    -
    2546  }
    -
    2547 
    -
    2576  template<typename ValueType, typename
    -
    2577  std::enable_if<
    -
    2578  not std::is_pointer<ValueType>::value
    -
    2579  and not std::is_same<ValueType, typename string_t::value_type>::value
    -
    2580  and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
    -
    2581  , int>::type = 0>
    -
    2582  operator ValueType() const
    -
    2583  {
    -
    2584  // delegate the call to get<>() const
    -
    2585  return get<ValueType>();
    -
    2586  }
    -
    2587 
    -
    2589 
    -
    2590 
    -
    2592  // element access //
    -
    2594 
    -
    2597 
    - -
    2621  {
    -
    2622  // at only works for arrays
    -
    2623  if (is_array())
    -
    2624  {
    -
    2625  try
    -
    2626  {
    -
    2627  return m_value.array->at(idx);
    -
    2628  }
    -
    2629  catch (std::out_of_range& e)
    -
    2630  {
    -
    2631  // create better exception explanation
    -
    2632  throw std::out_of_range("array index " + std::to_string(idx) + " is out of range");
    -
    2633  }
    -
    2634  }
    -
    2635  else
    -
    2636  {
    -
    2637  throw std::domain_error("cannot use at() with " + type_name());
    -
    2638  }
    -
    2639  }
    -
    2640 
    - -
    2664  {
    -
    2665  // at only works for arrays
    -
    2666  if (is_array())
    -
    2667  {
    -
    2668  try
    -
    2669  {
    -
    2670  return m_value.array->at(idx);
    -
    2671  }
    -
    2672  catch (std::out_of_range& e)
    -
    2673  {
    -
    2674  // create better exception explanation
    -
    2675  throw std::out_of_range("array index " + std::to_string(idx) + " is out of range");
    -
    2676  }
    -
    2677  }
    -
    2678  else
    -
    2679  {
    -
    2680  throw std::domain_error("cannot use at() with " + type_name());
    -
    2681  }
    -
    2682  }
    -
    2683 
    -
    2710  reference at(const typename object_t::key_type& key)
    -
    2711  {
    -
    2712  // at only works for objects
    -
    2713  if (is_object())
    -
    2714  {
    -
    2715  try
    -
    2716  {
    -
    2717  return m_value.object->at(key);
    -
    2718  }
    -
    2719  catch (std::out_of_range& e)
    -
    2720  {
    -
    2721  // create better exception explanation
    -
    2722  throw std::out_of_range("key '" + key + "' not found");
    -
    2723  }
    -
    2724  }
    -
    2725  else
    -
    2726  {
    -
    2727  throw std::domain_error("cannot use at() with " + type_name());
    -
    2728  }
    -
    2729  }
    -
    2730 
    -
    2757  const_reference at(const typename object_t::key_type& key) const
    -
    2758  {
    -
    2759  // at only works for objects
    -
    2760  if (is_object())
    -
    2761  {
    -
    2762  try
    -
    2763  {
    -
    2764  return m_value.object->at(key);
    -
    2765  }
    -
    2766  catch (std::out_of_range& e)
    -
    2767  {
    -
    2768  // create better exception explanation
    -
    2769  throw std::out_of_range("key '" + key + "' not found");
    -
    2770  }
    -
    2771  }
    -
    2772  else
    -
    2773  {
    -
    2774  throw std::domain_error("cannot use at() with " + type_name());
    -
    2775  }
    -
    2776  }
    -
    2777 
    - -
    2804  {
    -
    2805  // implicitly convert null to object
    -
    2806  if (is_null())
    -
    2807  {
    -
    2808  m_type = value_t::array;
    -
    2809  m_value.array = create<array_t>();
    -
    2810  }
    -
    2811 
    -
    2812  // [] only works for arrays
    -
    2813  if (is_array())
    -
    2814  {
    -
    2815  for (size_t i = m_value.array->size(); i <= idx; ++i)
    -
    2816  {
    -
    2817  m_value.array->push_back(basic_json());
    -
    2818  }
    -
    2819 
    -
    2820  return m_value.array->operator[](idx);
    -
    2821  }
    -
    2822  else
    -
    2823  {
    -
    2824  throw std::domain_error("cannot use operator[] with " + type_name());
    -
    2825  }
    -
    2826  }
    -
    2827 
    - -
    2848  {
    -
    2849  // at only works for arrays
    -
    2850  if (is_array())
    -
    2851  {
    -
    2852  return m_value.array->operator[](idx);
    -
    2853  }
    -
    2854  else
    -
    2855  {
    -
    2856  throw std::domain_error("cannot use operator[] with " + type_name());
    -
    2857  }
    -
    2858  }
    -
    2859 
    -
    2887  reference operator[](const typename object_t::key_type& key)
    -
    2888  {
    -
    2889  // implicitly convert null to object
    -
    2890  if (is_null())
    -
    2891  {
    -
    2892  m_type = value_t::object;
    -
    2893  m_value.object = create<object_t>();
    -
    2894  }
    -
    2895 
    -
    2896  // [] only works for objects
    -
    2897  if (is_object())
    -
    2898  {
    -
    2899  return m_value.object->operator[](key);
    -
    2900  }
    -
    2901  else
    -
    2902  {
    -
    2903  throw std::domain_error("cannot use operator[] with " + type_name());
    -
    2904  }
    -
    2905  }
    -
    2906 
    -
    2934  const_reference operator[](const typename object_t::key_type& key) const
    -
    2935  {
    -
    2936  // [] only works for objects
    -
    2937  if (is_object())
    -
    2938  {
    -
    2939  return m_value.object->find(key)->second;
    -
    2940  }
    -
    2941  else
    -
    2942  {
    -
    2943  throw std::domain_error("cannot use operator[] with " + type_name());
    -
    2944  }
    -
    2945  }
    -
    2946 
    -
    2976  template<typename T, std::size_t n>
    -
    2977  reference operator[](const T (&key)[n])
    -
    2978  {
    -
    2979  // implicitly convert null to object
    -
    2980  if (is_null())
    -
    2981  {
    -
    2982  m_type = value_t::object;
    -
    2983  m_value = value_t::object;
    -
    2984  }
    -
    2985 
    -
    2986  // at only works for objects
    -
    2987  if (is_object())
    -
    2988  {
    -
    2989  return m_value.object->operator[](key);
    -
    2990  }
    -
    2991  else
    -
    2992  {
    -
    2993  throw std::domain_error("cannot use operator[] with " + type_name());
    -
    2994  }
    -
    2995  }
    -
    2996 
    -
    3026  template<typename T, std::size_t n>
    -
    3027  const_reference operator[](const T (&key)[n]) const
    -
    3028  {
    -
    3029  // at only works for objects
    -
    3030  if (is_object())
    -
    3031  {
    -
    3032  return m_value.object->find(key)->second;
    -
    3033  }
    -
    3034  else
    -
    3035  {
    -
    3036  throw std::domain_error("cannot use operator[] with " + type_name());
    -
    3037  }
    -
    3038  }
    -
    3039 
    -
    3088  template <class ValueType, typename
    -
    3089  std::enable_if<
    -
    3090  std::is_convertible<basic_json_t, ValueType>::value
    -
    3091  , int>::type = 0>
    -
    3092  ValueType value(const typename object_t::key_type& key, ValueType default_value) const
    -
    3093  {
    -
    3094  // at only works for objects
    -
    3095  if (is_object())
    -
    3096  {
    -
    3097  // if key is found, return value and given default value otherwise
    -
    3098  const auto it = find(key);
    -
    3099  if (it != end())
    -
    3100  {
    -
    3101  return *it;
    -
    3102  }
    -
    3103  else
    -
    3104  {
    -
    3105  return default_value;
    -
    3106  }
    -
    3107  }
    -
    3108  else
    -
    3109  {
    -
    3110  throw std::domain_error("cannot use value() with " + type_name());
    -
    3111  }
    -
    3112  }
    -
    3113 
    -
    3118  string_t value(const typename object_t::key_type& key, const char* default_value) const
    -
    3119  {
    -
    3120  return value(key, string_t(default_value));
    -
    3121  }
    -
    3122 
    - -
    3144  {
    -
    3145  return *begin();
    -
    3146  }
    -
    3147 
    - -
    3152  {
    -
    3153  return *cbegin();
    -
    3154  }
    -
    3155 
    - -
    3178  {
    -
    3179  auto tmp = end();
    -
    3180  --tmp;
    -
    3181  return *tmp;
    -
    3182  }
    -
    3183 
    - -
    3188  {
    -
    3189  auto tmp = cend();
    -
    3190  --tmp;
    -
    3191  return *tmp;
    -
    3192  }
    -
    3193 
    -
    3238  template <class InteratorType, typename
    -
    3239  std::enable_if<
    -
    3240  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
    -
    3241  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
    -
    3242  , int>::type
    -
    3243  = 0>
    -
    3244  InteratorType erase(InteratorType pos)
    -
    3245  {
    -
    3246  // make sure iterator fits the current value
    -
    3247  if (this != pos.m_object)
    -
    3248  {
    -
    3249  throw std::domain_error("iterator does not fit current value");
    -
    3250  }
    -
    3251 
    -
    3252  InteratorType result = end();
    -
    3253 
    -
    3254  switch (m_type)
    -
    3255  {
    -
    3256  case value_t::boolean:
    -
    3257  case value_t::number_float:
    - -
    3259  case value_t::string:
    -
    3260  {
    -
    3261  if (not pos.m_it.primitive_iterator.is_begin())
    -
    3262  {
    -
    3263  throw std::out_of_range("iterator out of range");
    -
    3264  }
    -
    3265 
    -
    3266  if (is_string())
    -
    3267  {
    -
    3268  delete m_value.string;
    -
    3269  m_value.string = nullptr;
    -
    3270  }
    -
    3271 
    -
    3272  m_type = value_t::null;
    -
    3273  break;
    -
    3274  }
    -
    3275 
    -
    3276  case value_t::object:
    -
    3277  {
    -
    3278  result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
    -
    3279  break;
    -
    3280  }
    -
    3281 
    -
    3282  case value_t::array:
    -
    3283  {
    -
    3284  result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
    -
    3285  break;
    -
    3286  }
    -
    3287 
    -
    3288  default:
    -
    3289  {
    -
    3290  throw std::domain_error("cannot use erase() with " + type_name());
    -
    3291  }
    -
    3292  }
    -
    3293 
    -
    3294  return result;
    -
    3295  }
    -
    3296 
    -
    3341  template <class InteratorType, typename
    -
    3342  std::enable_if<
    -
    3343  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
    -
    3344  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
    -
    3345  , int>::type
    -
    3346  = 0>
    -
    3347  InteratorType erase(InteratorType first, InteratorType last)
    -
    3348  {
    -
    3349  // make sure iterator fits the current value
    -
    3350  if (this != first.m_object or this != last.m_object)
    -
    3351  {
    -
    3352  throw std::domain_error("iterators do not fit current value");
    -
    3353  }
    -
    3354 
    -
    3355  InteratorType result = end();
    -
    3356 
    -
    3357  switch (m_type)
    -
    3358  {
    -
    3359  case value_t::boolean:
    -
    3360  case value_t::number_float:
    - -
    3362  case value_t::string:
    -
    3363  {
    -
    3364  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
    -
    3365  {
    -
    3366  throw std::out_of_range("iterators out of range");
    -
    3367  }
    -
    3368 
    -
    3369  if (is_string())
    -
    3370  {
    -
    3371  delete m_value.string;
    -
    3372  m_value.string = nullptr;
    -
    3373  }
    -
    3374 
    -
    3375  m_type = value_t::null;
    -
    3376  break;
    -
    3377  }
    -
    3378 
    -
    3379  case value_t::object:
    -
    3380  {
    -
    3381  result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
    -
    3382  last.m_it.object_iterator);
    -
    3383  break;
    -
    3384  }
    -
    3385 
    -
    3386  case value_t::array:
    -
    3387  {
    -
    3388  result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,
    -
    3389  last.m_it.array_iterator);
    -
    3390  break;
    -
    3391  }
    -
    3392 
    -
    3393  default:
    -
    3394  {
    -
    3395  throw std::domain_error("cannot use erase() with " + type_name());
    -
    3396  }
    -
    3397  }
    -
    3398 
    -
    3399  return result;
    -
    3400  }
    -
    3401 
    -
    3428  size_type erase(const typename object_t::key_type& key)
    -
    3429  {
    -
    3430  // this erase only works for objects
    -
    3431  if (is_object())
    -
    3432  {
    -
    3433  return m_value.object->erase(key);
    -
    3434  }
    -
    3435  else
    -
    3436  {
    -
    3437  throw std::domain_error("cannot use erase() with " + type_name());
    -
    3438  }
    -
    3439  }
    -
    3440 
    -
    3465  void erase(const size_type idx)
    -
    3466  {
    -
    3467  // this erase only works for arrays
    -
    3468  if (is_array())
    -
    3469  {
    -
    3470  if (idx >= size())
    -
    3471  {
    -
    3472  throw std::out_of_range("index out of range");
    -
    3473  }
    -
    3474 
    -
    3475  m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));
    -
    3476  }
    -
    3477  else
    -
    3478  {
    -
    3479  throw std::domain_error("cannot use erase() with " + type_name());
    -
    3480  }
    -
    3481  }
    -
    3482 
    -
    3500  iterator find(typename object_t::key_type key)
    -
    3501  {
    -
    3502  auto result = end();
    -
    3503 
    -
    3504  if (is_object())
    -
    3505  {
    -
    3506  result.m_it.object_iterator = m_value.object->find(key);
    -
    3507  }
    -
    3508 
    -
    3509  return result;
    -
    3510  }
    -
    3511 
    -
    3516  const_iterator find(typename object_t::key_type key) const
    -
    3517  {
    -
    3518  auto result = cend();
    -
    3519 
    -
    3520  if (is_object())
    -
    3521  {
    -
    3522  result.m_it.object_iterator = m_value.object->find(key);
    -
    3523  }
    -
    3524 
    -
    3525  return result;
    -
    3526  }
    -
    3527 
    -
    3546  size_type count(typename object_t::key_type key) const
    -
    3547  {
    -
    3548  // return 0 for all nonobject types
    -
    3549  return is_object() ? m_value.object->count(key) : 0;
    -
    3550  }
    -
    3551 
    -
    3553 
    -
    3554 
    -
    3556  // iterators //
    -
    3558 
    -
    3561 
    - -
    3581  {
    -
    3582  iterator result(this);
    -
    3583  result.set_begin();
    -
    3584  return result;
    -
    3585  }
    -
    3586 
    - -
    3591  {
    -
    3592  return cbegin();
    -
    3593  }
    -
    3594 
    - -
    3615  {
    -
    3616  const_iterator result(this);
    -
    3617  result.set_begin();
    -
    3618  return result;
    -
    3619  }
    -
    3620 
    - -
    3640  {
    -
    3641  iterator result(this);
    -
    3642  result.set_end();
    -
    3643  return result;
    -
    3644  }
    -
    3645 
    - -
    3650  {
    -
    3651  return cend();
    -
    3652  }
    -
    3653 
    - -
    3674  {
    -
    3675  const_iterator result(this);
    -
    3676  result.set_end();
    -
    3677  return result;
    -
    3678  }
    -
    3679 
    - -
    3698  {
    -
    3699  return reverse_iterator(end());
    -
    3700  }
    -
    3701 
    - -
    3706  {
    -
    3707  return crbegin();
    -
    3708  }
    -
    3709 
    - -
    3729  {
    -
    3730  return reverse_iterator(begin());
    -
    3731  }
    -
    3732 
    - -
    3737  {
    -
    3738  return crend();
    -
    3739  }
    -
    3740 
    - -
    3760  {
    -
    3761  return const_reverse_iterator(cend());
    -
    3762  }
    -
    3763 
    - -
    3783  {
    -
    3784  return const_reverse_iterator(cbegin());
    -
    3785  }
    -
    3786 
    -
    3787  private:
    -
    3788  // forward declaration
    -
    3789  template<typename IteratorType> class iteration_proxy;
    -
    3790 
    -
    3791  public:
    -
    3803  static iteration_proxy<iterator> iterator_wrapper(reference cont)
    -
    3804  {
    -
    3805  return iteration_proxy<iterator>(cont);
    -
    3806  }
    -
    3807 
    -
    3811  static iteration_proxy<const_iterator> iterator_wrapper(const_reference cont)
    -
    3812  {
    -
    3813  return iteration_proxy<const_iterator>(cont);
    -
    3814  }
    -
    3815 
    -
    3817 
    -
    3818 
    -
    3820  // capacity //
    -
    3822 
    -
    3825 
    -
    3855  bool empty() const noexcept
    -
    3856  {
    -
    3857  switch (m_type)
    -
    3858  {
    -
    3859  case value_t::null:
    -
    3860  {
    -
    3861  // null values are empty
    -
    3862  return true;
    -
    3863  }
    -
    3864 
    -
    3865  case value_t::array:
    -
    3866  {
    -
    3867  return m_value.array->empty();
    -
    3868  }
    -
    3869 
    -
    3870  case value_t::object:
    -
    3871  {
    -
    3872  return m_value.object->empty();
    -
    3873  }
    -
    3874 
    -
    3875  default:
    -
    3876  {
    -
    3877  // all other types are nonempty
    -
    3878  return false;
    -
    3879  }
    -
    3880  }
    -
    3881  }
    -
    3882 
    -
    3911  size_type size() const noexcept
    -
    3912  {
    -
    3913  switch (m_type)
    -
    3914  {
    -
    3915  case value_t::null:
    -
    3916  {
    -
    3917  // null values are empty
    -
    3918  return 0;
    -
    3919  }
    -
    3920 
    -
    3921  case value_t::array:
    -
    3922  {
    -
    3923  return m_value.array->size();
    -
    3924  }
    -
    3925 
    -
    3926  case value_t::object:
    -
    3927  {
    -
    3928  return m_value.object->size();
    -
    3929  }
    -
    3930 
    -
    3931  default:
    -
    3932  {
    -
    3933  // all other types have size 1
    -
    3934  return 1;
    -
    3935  }
    -
    3936  }
    -
    3937  }
    -
    3938 
    -
    3971  size_type max_size() const noexcept
    -
    3972  {
    -
    3973  switch (m_type)
    -
    3974  {
    -
    3975  case value_t::array:
    -
    3976  {
    -
    3977  return m_value.array->max_size();
    -
    3978  }
    -
    3979 
    -
    3980  case value_t::object:
    -
    3981  {
    -
    3982  return m_value.object->max_size();
    -
    3983  }
    -
    3984 
    -
    3985  default:
    -
    3986  {
    -
    3987  // all other types have max_size() == size()
    -
    3988  return size();
    -
    3989  }
    -
    3990  }
    -
    3991  }
    -
    3992 
    -
    3994 
    -
    3995 
    -
    3997  // modifiers //
    -
    3999 
    -
    4002 
    -
    4028  void clear() noexcept
    -
    4029  {
    -
    4030  switch (m_type)
    -
    4031  {
    - -
    4033  {
    -
    4034  m_value.number_integer = 0;
    -
    4035  break;
    -
    4036  }
    -
    4037 
    -
    4038  case value_t::number_float:
    -
    4039  {
    -
    4040  m_value.number_float = 0.0;
    -
    4041  break;
    -
    4042  }
    -
    4043 
    -
    4044  case value_t::boolean:
    -
    4045  {
    -
    4046  m_value.boolean = false;
    -
    4047  break;
    -
    4048  }
    -
    4049 
    -
    4050  case value_t::string:
    -
    4051  {
    -
    4052  m_value.string->clear();
    -
    4053  break;
    -
    4054  }
    -
    4055 
    -
    4056  case value_t::array:
    -
    4057  {
    -
    4058  m_value.array->clear();
    -
    4059  break;
    -
    4060  }
    -
    4061 
    -
    4062  case value_t::object:
    -
    4063  {
    -
    4064  m_value.object->clear();
    -
    4065  break;
    -
    4066  }
    -
    4067 
    -
    4068  default:
    -
    4069  {
    -
    4070  break;
    -
    4071  }
    -
    4072  }
    -
    4073  }
    -
    4074 
    -
    4095  void push_back(basic_json&& val)
    -
    4096  {
    -
    4097  // push_back only works for null objects or arrays
    -
    4098  if (not(is_null() or is_array()))
    -
    4099  {
    -
    4100  throw std::domain_error("cannot use push_back() with " + type_name());
    -
    4101  }
    -
    4102 
    -
    4103  // transform null object into an array
    -
    4104  if (is_null())
    -
    4105  {
    -
    4106  m_type = value_t::array;
    -
    4107  m_value = value_t::array;
    -
    4108  }
    -
    4109 
    -
    4110  // add element to array (move semantics)
    -
    4111  m_value.array->push_back(std::move(val));
    -
    4112  // invalidate object
    -
    4113  val.m_type = value_t::null;
    -
    4114  }
    -
    4115 
    -
    4120  reference operator+=(basic_json&& val)
    -
    4121  {
    -
    4122  push_back(std::move(val));
    -
    4123  return *this;
    -
    4124  }
    -
    4125 
    -
    4130  void push_back(const basic_json& val)
    -
    4131  {
    -
    4132  // push_back only works for null objects or arrays
    -
    4133  if (not(is_null() or is_array()))
    -
    4134  {
    -
    4135  throw std::domain_error("cannot use push_back() with " + type_name());
    -
    4136  }
    -
    4137 
    -
    4138  // transform null object into an array
    -
    4139  if (is_null())
    -
    4140  {
    -
    4141  m_type = value_t::array;
    -
    4142  m_value = value_t::array;
    -
    4143  }
    -
    4144 
    -
    4145  // add element to array
    -
    4146  m_value.array->push_back(val);
    -
    4147  }
    -
    4148 
    -
    4153  reference operator+=(const basic_json& val)
    -
    4154  {
    -
    4155  push_back(val);
    -
    4156  return *this;
    -
    4157  }
    -
    4158 
    -
    4179  void push_back(const typename object_t::value_type& val)
    -
    4180  {
    -
    4181  // push_back only works for null objects or objects
    -
    4182  if (not(is_null() or is_object()))
    -
    4183  {
    -
    4184  throw std::domain_error("cannot use push_back() with " + type_name());
    -
    4185  }
    -
    4186 
    -
    4187  // transform null object into an object
    -
    4188  if (is_null())
    -
    4189  {
    -
    4190  m_type = value_t::object;
    -
    4191  m_value = value_t::object;
    -
    4192  }
    -
    4193 
    -
    4194  // add element to array
    -
    4195  m_value.object->insert(val);
    -
    4196  }
    -
    4197 
    -
    4202  reference operator+=(const typename object_t::value_type& val)
    -
    4203  {
    -
    4204  push_back(val);
    -
    4205  return operator[](val.first);
    -
    4206  }
    -
    4207 
    -
    4230  iterator insert(const_iterator pos, const basic_json& val)
    -
    4231  {
    -
    4232  // insert only works for arrays
    -
    4233  if (is_array())
    -
    4234  {
    -
    4235  // check if iterator pos fits to this JSON value
    -
    4236  if (pos.m_object != this)
    -
    4237  {
    -
    4238  throw std::domain_error("iterator does not fit current value");
    -
    4239  }
    -
    4240 
    -
    4241  // insert to array and return iterator
    -
    4242  iterator result(this);
    -
    4243  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, val);
    -
    4244  return result;
    -
    4245  }
    -
    4246  else
    -
    4247  {
    -
    4248  throw std::domain_error("cannot use insert() with " + type_name());
    -
    4249  }
    -
    4250  }
    -
    4251 
    -
    4256  iterator insert(const_iterator pos, basic_json&& val)
    -
    4257  {
    -
    4258  return insert(pos, val);
    -
    4259  }
    -
    4260 
    -
    4285  iterator insert(const_iterator pos, size_type cnt, const basic_json& val)
    -
    4286  {
    -
    4287  // insert only works for arrays
    -
    4288  if (is_array())
    -
    4289  {
    -
    4290  // check if iterator pos fits to this JSON value
    -
    4291  if (pos.m_object != this)
    -
    4292  {
    -
    4293  throw std::domain_error("iterator does not fit current value");
    -
    4294  }
    -
    4295 
    -
    4296  // insert to array and return iterator
    -
    4297  iterator result(this);
    -
    4298  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
    -
    4299  return result;
    -
    4300  }
    -
    4301  else
    -
    4302  {
    -
    4303  throw std::domain_error("cannot use insert() with " + type_name());
    -
    4304  }
    -
    4305  }
    -
    4306 
    - -
    4338  {
    -
    4339  // insert only works for arrays
    -
    4340  if (not is_array())
    -
    4341  {
    -
    4342  throw std::domain_error("cannot use insert() with " + type_name());
    -
    4343  }
    -
    4344 
    -
    4345  // check if iterator pos fits to this JSON value
    -
    4346  if (pos.m_object != this)
    -
    4347  {
    -
    4348  throw std::domain_error("iterator does not fit current value");
    -
    4349  }
    -
    4350 
    -
    4351  if (first.m_object != last.m_object)
    -
    4352  {
    -
    4353  throw std::domain_error("iterators do not fit");
    -
    4354  }
    -
    4355 
    -
    4356  if (first.m_object == this or last.m_object == this)
    -
    4357  {
    -
    4358  throw std::domain_error("passed iterators may not belong to container");
    -
    4359  }
    -
    4360 
    -
    4361  // insert to array and return iterator
    -
    4362  iterator result(this);
    -
    4363  result.m_it.array_iterator = m_value.array->insert(
    -
    4364  pos.m_it.array_iterator,
    -
    4365  first.m_it.array_iterator,
    -
    4366  last.m_it.array_iterator);
    -
    4367  return result;
    -
    4368  }
    -
    4369 
    -
    4394  iterator insert(const_iterator pos, std::initializer_list<basic_json> ilist)
    -
    4395  {
    -
    4396  // insert only works for arrays
    -
    4397  if (not is_array())
    -
    4398  {
    -
    4399  throw std::domain_error("cannot use insert() with " + type_name());
    -
    4400  }
    -
    4401 
    -
    4402  // check if iterator pos fits to this JSON value
    -
    4403  if (pos.m_object != this)
    -
    4404  {
    -
    4405  throw std::domain_error("iterator does not fit current value");
    -
    4406  }
    -
    4407 
    -
    4408  // insert to array and return iterator
    -
    4409  iterator result(this);
    -
    4410  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
    -
    4411  return result;
    -
    4412  }
    -
    4413 
    -
    4431  void swap(reference other) noexcept (
    -
    4432  std::is_nothrow_move_constructible<value_t>::value and
    -
    4433  std::is_nothrow_move_assignable<value_t>::value and
    -
    4434  std::is_nothrow_move_constructible<json_value>::value and
    -
    4435  std::is_nothrow_move_assignable<json_value>::value
    -
    4436  )
    -
    4437  {
    -
    4438  std::swap(m_type, other.m_type);
    -
    4439  std::swap(m_value, other.m_value);
    -
    4440  }
    -
    4441 
    -
    4462  void swap(array_t& other)
    -
    4463  {
    -
    4464  // swap only works for arrays
    -
    4465  if (is_array())
    -
    4466  {
    -
    4467  std::swap(*(m_value.array), other);
    -
    4468  }
    -
    4469  else
    -
    4470  {
    -
    4471  throw std::domain_error("cannot use swap() with " + type_name());
    -
    4472  }
    -
    4473  }
    -
    4474 
    -
    4495  void swap(object_t& other)
    -
    4496  {
    -
    4497  // swap only works for objects
    -
    4498  if (is_object())
    -
    4499  {
    -
    4500  std::swap(*(m_value.object), other);
    -
    4501  }
    -
    4502  else
    -
    4503  {
    -
    4504  throw std::domain_error("cannot use swap() with " + type_name());
    -
    4505  }
    -
    4506  }
    -
    4507 
    -
    4528  void swap(string_t& other)
    -
    4529  {
    -
    4530  // swap only works for strings
    -
    4531  if (is_string())
    -
    4532  {
    -
    4533  std::swap(*(m_value.string), other);
    -
    4534  }
    -
    4535  else
    -
    4536  {
    -
    4537  throw std::domain_error("cannot use swap() with " + type_name());
    -
    4538  }
    -
    4539  }
    -
    4540 
    -
    4542 
    -
    4543 
    -
    4545  // lexicographical comparison operators //
    -
    4547 
    -
    4550 
    -
    4551  private:
    -
    4561  friend bool operator<(const value_t lhs, const value_t rhs)
    -
    4562  {
    -
    4563  static constexpr std::array<uint8_t, 7> order = {{
    -
    4564  0, // null
    -
    4565  3, // object
    -
    4566  4, // array
    -
    4567  5, // string
    -
    4568  1, // boolean
    -
    4569  2, // integer
    -
    4570  2 // float
    -
    4571  }
    -
    4572  };
    -
    4573 
    -
    4574  // discarded values are not comparable
    -
    4575  if (lhs == value_t::discarded or rhs == value_t::discarded)
    -
    4576  {
    -
    4577  return false;
    -
    4578  }
    -
    4579 
    -
    4580  return order[static_cast<std::size_t>(lhs)] < order[static_cast<std::size_t>(rhs)];
    -
    4581  }
    -
    4582 
    -
    4583  public:
    -
    4607  friend bool operator==(const_reference lhs, const_reference rhs) noexcept
    -
    4608  {
    -
    4609  const auto lhs_type = lhs.type();
    -
    4610  const auto rhs_type = rhs.type();
    -
    4611 
    -
    4612  if (lhs_type == rhs_type)
    -
    4613  {
    -
    4614  switch (lhs_type)
    -
    4615  {
    -
    4616  case value_t::array:
    -
    4617  return *lhs.m_value.array == *rhs.m_value.array;
    -
    4618  case value_t::object:
    -
    4619  return *lhs.m_value.object == *rhs.m_value.object;
    -
    4620  case value_t::null:
    -
    4621  return true;
    -
    4622  case value_t::string:
    -
    4623  return *lhs.m_value.string == *rhs.m_value.string;
    -
    4624  case value_t::boolean:
    -
    4625  return lhs.m_value.boolean == rhs.m_value.boolean;
    - -
    4627  return lhs.m_value.number_integer == rhs.m_value.number_integer;
    -
    4628  case value_t::number_float:
    -
    4629  return approx(lhs.m_value.number_float, rhs.m_value.number_float);
    -
    4630  default:
    -
    4631  return false;
    -
    4632  }
    -
    4633  }
    -
    4634  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
    -
    4635  {
    -
    4636  return approx(static_cast<number_float_t>(lhs.m_value.number_integer),
    -
    4637  rhs.m_value.number_float);
    -
    4638  }
    -
    4639  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
    -
    4640  {
    -
    4641  return approx(lhs.m_value.number_float,
    -
    4642  static_cast<number_float_t>(rhs.m_value.number_integer));
    -
    4643  }
    -
    4644  return false;
    -
    4645  }
    -
    4646 
    -
    4665  friend bool operator==(const_reference v, std::nullptr_t) noexcept
    -
    4666  {
    -
    4667  return v.is_null();
    -
    4668  }
    -
    4669 
    -
    4674  friend bool operator==(std::nullptr_t, const_reference v) noexcept
    -
    4675  {
    -
    4676  return v.is_null();
    -
    4677  }
    -
    4678 
    -
    4695  friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
    -
    4696  {
    -
    4697  return not (lhs == rhs);
    -
    4698  }
    -
    4699 
    -
    4718  friend bool operator!=(const_reference v, std::nullptr_t) noexcept
    -
    4719  {
    -
    4720  return not v.is_null();
    -
    4721  }
    -
    4722 
    -
    4727  friend bool operator!=(std::nullptr_t, const_reference v) noexcept
    -
    4728  {
    -
    4729  return not v.is_null();
    -
    4730  }
    -
    4731 
    -
    4756  friend bool operator<(const_reference lhs, const_reference rhs) noexcept
    -
    4757  {
    -
    4758  const auto lhs_type = lhs.type();
    -
    4759  const auto rhs_type = rhs.type();
    -
    4760 
    -
    4761  if (lhs_type == rhs_type)
    -
    4762  {
    -
    4763  switch (lhs_type)
    -
    4764  {
    -
    4765  case value_t::array:
    -
    4766  return *lhs.m_value.array < *rhs.m_value.array;
    -
    4767  case value_t::object:
    -
    4768  return *lhs.m_value.object < *rhs.m_value.object;
    -
    4769  case value_t::null:
    -
    4770  return false;
    -
    4771  case value_t::string:
    -
    4772  return *lhs.m_value.string < *rhs.m_value.string;
    -
    4773  case value_t::boolean:
    -
    4774  return lhs.m_value.boolean < rhs.m_value.boolean;
    - -
    4776  return lhs.m_value.number_integer < rhs.m_value.number_integer;
    -
    4777  case value_t::number_float:
    -
    4778  return lhs.m_value.number_float < rhs.m_value.number_float;
    -
    4779  default:
    -
    4780  return false;
    -
    4781  }
    -
    4782  }
    -
    4783  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
    -
    4784  {
    -
    4785  return static_cast<number_float_t>(lhs.m_value.number_integer) <
    -
    4786  rhs.m_value.number_float;
    -
    4787  }
    -
    4788  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
    -
    4789  {
    -
    4790  return lhs.m_value.number_float <
    -
    4791  static_cast<number_float_t>(rhs.m_value.number_integer);
    -
    4792  }
    -
    4793 
    -
    4794  // We only reach this line if we cannot compare values. In that case,
    -
    4795  // we compare types. Note we have to call the operator explicitly,
    -
    4796  // because MSVC has problems otherwise.
    -
    4797  return operator<(lhs_type, rhs_type);
    -
    4798  }
    -
    4799 
    -
    4817  friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
    -
    4818  {
    -
    4819  return not (rhs < lhs);
    -
    4820  }
    -
    4821 
    -
    4839  friend bool operator>(const_reference lhs, const_reference rhs) noexcept
    -
    4840  {
    -
    4841  return not (lhs <= rhs);
    -
    4842  }
    -
    4843 
    -
    4861  friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
    -
    4862  {
    -
    4863  return not (lhs < rhs);
    -
    4864  }
    -
    4865 
    -
    4867 
    -
    4868 
    -
    4870  // serialization //
    -
    4872 
    -
    4875 
    -
    4898  friend std::ostream& operator<<(std::ostream& o, const basic_json& j)
    -
    4899  {
    -
    4900  // read width member and use it as indentation parameter if nonzero
    -
    4901  const bool pretty_print = (o.width() > 0);
    -
    4902  const auto indentation = (pretty_print ? o.width() : 0);
    -
    4903 
    -
    4904  // reset width to 0 for subsequent calls to this stream
    -
    4905  o.width(0);
    -
    4906 
    -
    4907  // do the actual serialization
    -
    4908  j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
    -
    4909  return o;
    -
    4910  }
    -
    4911 
    -
    4916  friend std::ostream& operator>>(const basic_json& j, std::ostream& o)
    -
    4917  {
    -
    4918  return o << j;
    -
    4919  }
    -
    4920 
    -
    4922 
    -
    4923 
    -
    4925  // deserialization //
    -
    4927 
    -
    4930 
    -
    4955  static basic_json parse(const string_t& s, parser_callback_t cb = nullptr)
    -
    4956  {
    -
    4957  return parser(s, cb).parse();
    -
    4958  }
    -
    4959 
    -
    4984  static basic_json parse(std::istream& i, parser_callback_t cb = nullptr)
    -
    4985  {
    -
    4986  return parser(i, cb).parse();
    -
    4987  }
    -
    4988 
    -
    4992  static basic_json parse(std::istream&& i, parser_callback_t cb = nullptr)
    -
    4993  {
    -
    4994  return parser(i, cb).parse();
    -
    4995  }
    -
    4996 
    -
    5020  friend std::istream& operator<<(basic_json& j, std::istream& i)
    -
    5021  {
    -
    5022  j = parser(i).parse();
    -
    5023  return i;
    -
    5024  }
    -
    5025 
    -
    5030  friend std::istream& operator>>(std::istream& i, basic_json& j)
    -
    5031  {
    -
    5032  j = parser(i).parse();
    -
    5033  return i;
    -
    5034  }
    -
    5035 
    -
    5037 
    -
    5038 
    -
    5039  private:
    -
    5041  // convenience functions //
    -
    5043 
    -
    5045  string_t type_name() const
    -
    5046  {
    -
    5047  switch (m_type)
    -
    5048  {
    -
    5049  case value_t::null:
    -
    5050  return "null";
    -
    5051  case value_t::object:
    -
    5052  return "object";
    -
    5053  case value_t::array:
    -
    5054  return "array";
    -
    5055  case value_t::string:
    -
    5056  return "string";
    -
    5057  case value_t::boolean:
    -
    5058  return "boolean";
    -
    5059  case value_t::discarded:
    -
    5060  return "discarded";
    -
    5061  default:
    -
    5062  return "number";
    -
    5063  }
    -
    5064  }
    -
    5065 
    -
    5074  static std::size_t extra_space(const string_t& s) noexcept
    -
    5075  {
    -
    5076  std::size_t result = 0;
    -
    5077 
    -
    5078  for (const auto& c : s)
    -
    5079  {
    -
    5080  switch (c)
    -
    5081  {
    -
    5082  case '"':
    -
    5083  case '\\':
    -
    5084  case '\b':
    -
    5085  case '\f':
    -
    5086  case '\n':
    -
    5087  case '\r':
    -
    5088  case '\t':
    -
    5089  {
    -
    5090  // from c (1 byte) to \x (2 bytes)
    -
    5091  result += 1;
    -
    5092  break;
    -
    5093  }
    -
    5094 
    -
    5095  default:
    -
    5096  {
    -
    5097  if (c >= 0x00 and c <= 0x1f)
    -
    5098  {
    -
    5099  // from c (1 byte) to \uxxxx (6 bytes)
    -
    5100  result += 5;
    -
    5101  }
    -
    5102  break;
    -
    5103  }
    -
    5104  }
    -
    5105  }
    -
    5106 
    -
    5107  return result;
    -
    5108  }
    -
    5109 
    -
    5123  static string_t escape_string(const string_t& s) noexcept
    -
    5124  {
    -
    5125  const auto space = extra_space(s);
    -
    5126  if (space == 0)
    -
    5127  {
    -
    5128  return s;
    -
    5129  }
    -
    5130 
    -
    5131  // create a result string of necessary size
    -
    5132  string_t result(s.size() + space, '\\');
    -
    5133  std::size_t pos = 0;
    -
    5134 
    -
    5135  for (const auto& c : s)
    -
    5136  {
    -
    5137  switch (c)
    -
    5138  {
    -
    5139  // quotation mark (0x22)
    -
    5140  case '"':
    -
    5141  {
    -
    5142  result[pos + 1] = '"';
    -
    5143  pos += 2;
    -
    5144  break;
    -
    5145  }
    -
    5146 
    -
    5147  // reverse solidus (0x5c)
    -
    5148  case '\\':
    -
    5149  {
    -
    5150  // nothing to change
    -
    5151  pos += 2;
    -
    5152  break;
    -
    5153  }
    -
    5154 
    -
    5155  // backspace (0x08)
    -
    5156  case '\b':
    -
    5157  {
    -
    5158  result[pos + 1] = 'b';
    -
    5159  pos += 2;
    -
    5160  break;
    -
    5161  }
    -
    5162 
    -
    5163  // formfeed (0x0c)
    -
    5164  case '\f':
    -
    5165  {
    -
    5166  result[pos + 1] = 'f';
    -
    5167  pos += 2;
    -
    5168  break;
    -
    5169  }
    -
    5170 
    -
    5171  // newline (0x0a)
    -
    5172  case '\n':
    -
    5173  {
    -
    5174  result[pos + 1] = 'n';
    -
    5175  pos += 2;
    -
    5176  break;
    -
    5177  }
    -
    5178 
    -
    5179  // carriage return (0x0d)
    -
    5180  case '\r':
    -
    5181  {
    -
    5182  result[pos + 1] = 'r';
    -
    5183  pos += 2;
    -
    5184  break;
    -
    5185  }
    -
    5186 
    -
    5187  // horizontal tab (0x09)
    -
    5188  case '\t':
    -
    5189  {
    -
    5190  result[pos + 1] = 't';
    -
    5191  pos += 2;
    -
    5192  break;
    -
    5193  }
    -
    5194 
    -
    5195  default:
    -
    5196  {
    -
    5197  if (c >= 0x00 and c <= 0x1f)
    -
    5198  {
    -
    5199  // convert a number 0..15 to its hex representation (0..f)
    -
    5200  auto hexify = [](const char v) -> char
    -
    5201  {
    -
    5202  return (v < 10) ? ('0' + v) : ('a' + v - 10);
    -
    5203  };
    -
    5204 
    -
    5205  // print character c as \uxxxx
    -
    5206  for (const char m :
    -
    5207  { 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f)
    -
    5208  })
    -
    5209  {
    -
    5210  result[++pos] = m;
    -
    5211  }
    -
    5212 
    -
    5213  ++pos;
    -
    5214  }
    -
    5215  else
    -
    5216  {
    -
    5217  // all other characters are added as-is
    -
    5218  result[pos++] = c;
    -
    5219  }
    -
    5220  break;
    -
    5221  }
    -
    5222  }
    -
    5223  }
    -
    5224 
    -
    5225  return result;
    -
    5226  }
    -
    5227 
    -
    5245  void dump(std::ostream& o,
    -
    5246  const bool pretty_print,
    -
    5247  const unsigned int indent_step,
    -
    5248  const unsigned int current_indent = 0) const
    -
    5249  {
    -
    5250  // variable to hold indentation for recursive calls
    -
    5251  unsigned int new_indent = current_indent;
    -
    5252 
    -
    5253  switch (m_type)
    -
    5254  {
    -
    5255  case value_t::object:
    -
    5256  {
    -
    5257  if (m_value.object->empty())
    -
    5258  {
    -
    5259  o << "{}";
    -
    5260  return;
    -
    5261  }
    -
    5262 
    -
    5263  o << "{";
    -
    5264 
    -
    5265  // increase indentation
    -
    5266  if (pretty_print)
    -
    5267  {
    -
    5268  new_indent += indent_step;
    -
    5269  o << "\n";
    -
    5270  }
    -
    5271 
    -
    5272  for (auto i = m_value.object->cbegin(); i != m_value.object->cend(); ++i)
    -
    5273  {
    -
    5274  if (i != m_value.object->cbegin())
    -
    5275  {
    -
    5276  o << (pretty_print ? ",\n" : ",");
    -
    5277  }
    -
    5278  o << string_t(new_indent, ' ') << "\""
    -
    5279  << escape_string(i->first) << "\":"
    -
    5280  << (pretty_print ? " " : "");
    -
    5281  i->second.dump(o, pretty_print, indent_step, new_indent);
    -
    5282  }
    -
    5283 
    -
    5284  // decrease indentation
    -
    5285  if (pretty_print)
    -
    5286  {
    -
    5287  new_indent -= indent_step;
    -
    5288  o << "\n";
    -
    5289  }
    -
    5290 
    -
    5291  o << string_t(new_indent, ' ') + "}";
    -
    5292  return;
    -
    5293  }
    -
    5294 
    -
    5295  case value_t::array:
    -
    5296  {
    -
    5297  if (m_value.array->empty())
    -
    5298  {
    -
    5299  o << "[]";
    -
    5300  return;
    -
    5301  }
    -
    5302 
    -
    5303  o << "[";
    -
    5304 
    -
    5305  // increase indentation
    -
    5306  if (pretty_print)
    -
    5307  {
    -
    5308  new_indent += indent_step;
    -
    5309  o << "\n";
    -
    5310  }
    -
    5311 
    -
    5312  for (auto i = m_value.array->cbegin(); i != m_value.array->cend(); ++i)
    -
    5313  {
    -
    5314  if (i != m_value.array->cbegin())
    -
    5315  {
    -
    5316  o << (pretty_print ? ",\n" : ",");
    -
    5317  }
    -
    5318  o << string_t(new_indent, ' ');
    -
    5319  i->dump(o, pretty_print, indent_step, new_indent);
    -
    5320  }
    -
    5321 
    -
    5322  // decrease indentation
    -
    5323  if (pretty_print)
    -
    5324  {
    -
    5325  new_indent -= indent_step;
    -
    5326  o << "\n";
    -
    5327  }
    -
    5328 
    -
    5329  o << string_t(new_indent, ' ') << "]";
    -
    5330  return;
    -
    5331  }
    -
    5332 
    -
    5333  case value_t::string:
    -
    5334  {
    -
    5335  o << string_t("\"") << escape_string(*m_value.string) << "\"";
    -
    5336  return;
    -
    5337  }
    -
    5338 
    -
    5339  case value_t::boolean:
    -
    5340  {
    -
    5341  o << (m_value.boolean ? "true" : "false");
    -
    5342  return;
    -
    5343  }
    -
    5344 
    - -
    5346  {
    -
    5347  o << m_value.number_integer;
    -
    5348  return;
    -
    5349  }
    -
    5350 
    -
    5351  case value_t::number_float:
    -
    5352  {
    -
    5353  // 15 digits of precision allows round-trip IEEE 754
    -
    5354  // string->double->string; to be safe, we read this value from
    -
    5355  // std::numeric_limits<number_float_t>::digits10
    -
    5356  o << std::setprecision(std::numeric_limits<number_float_t>::digits10) << m_value.number_float;
    -
    5357  return;
    -
    5358  }
    -
    5359 
    -
    5360  case value_t::discarded:
    -
    5361  {
    -
    5362  o << "<discarded>";
    -
    5363  return;
    -
    5364  }
    -
    5365 
    -
    5366  case value_t::null:
    -
    5367  {
    -
    5368  o << "null";
    -
    5369  return;
    -
    5370  }
    -
    5371  }
    -
    5372  }
    -
    5373 
    -
    5374  private:
    -
    5376  // member variables //
    -
    5378 
    -
    5380  value_t m_type = value_t::null;
    -
    5381 
    -
    5383  json_value m_value = {};
    -
    5384 
    -
    5385 
    -
    5386  private:
    -
    5388  // iterators //
    -
    5390 
    -
    5400  class primitive_iterator_t
    -
    5401  {
    -
    5402  public:
    -
    5404  void set_begin()
    -
    5405  {
    -
    5406  m_it = begin_value;
    -
    5407  }
    -
    5408 
    -
    5410  void set_end()
    -
    5411  {
    -
    5412  m_it = end_value;
    -
    5413  }
    -
    5414 
    -
    5416  bool is_begin() const
    -
    5417  {
    -
    5418  return (m_it == begin_value);
    -
    5419  }
    -
    5420 
    -
    5422  bool is_end() const
    -
    5423  {
    -
    5424  return (m_it == end_value);
    -
    5425  }
    -
    5426 
    -
    5428  operator difference_type& ()
    -
    5429  {
    -
    5430  return m_it;
    -
    5431  }
    -
    5432 
    -
    5434  operator difference_type () const
    -
    5435  {
    -
    5436  return m_it;
    -
    5437  }
    -
    5438 
    -
    5439  private:
    -
    5440  static constexpr difference_type begin_value = 0;
    -
    5441  static constexpr difference_type end_value = begin_value + 1;
    -
    5442 
    -
    5444  difference_type m_it = std::numeric_limits<std::ptrdiff_t>::denorm_min();
    -
    5445  };
    -
    5446 
    -
    5454  struct internal_iterator
    -
    5455  {
    -
    5457  typename object_t::iterator object_iterator;
    -
    5459  typename array_t::iterator array_iterator;
    -
    5461  primitive_iterator_t primitive_iterator;
    -
    5462 
    -
    5464  internal_iterator()
    -
    5465  : object_iterator(), array_iterator(), primitive_iterator()
    -
    5466  {}
    -
    5467  };
    -
    5468 
    -
    5470  template<typename IteratorType>
    -
    5471  class iteration_proxy
    -
    5472  {
    -
    5473  private:
    -
    5475  class iteration_proxy_internal
    -
    5476  {
    -
    5477  private:
    -
    5479  IteratorType anchor;
    -
    5481  size_t array_index = 0;
    -
    5482 
    -
    5483  public:
    -
    5484  iteration_proxy_internal(IteratorType it)
    -
    5485  : anchor(it)
    -
    5486  {}
    -
    5487 
    -
    5489  iteration_proxy_internal& operator*()
    -
    5490  {
    -
    5491  return *this;
    -
    5492  }
    -
    5493 
    -
    5495  iteration_proxy_internal& operator++()
    -
    5496  {
    -
    5497  ++anchor;
    -
    5498  ++array_index;
    -
    5499 
    -
    5500  return *this;
    -
    5501  }
    -
    5502 
    -
    5504  bool operator!= (const iteration_proxy_internal& o) const
    -
    5505  {
    -
    5506  return anchor != o.anchor;
    -
    5507  }
    -
    5508 
    -
    5510  typename basic_json::string_t key() const
    -
    5511  {
    -
    5512  switch (anchor.m_object->type())
    -
    5513  {
    -
    5514  // use integer array index as key
    -
    5515  case value_t::array:
    -
    5516  {
    -
    5517  return std::to_string(array_index);
    -
    5518  }
    -
    5519 
    -
    5520  // use key from the object
    -
    5521  case value_t::object:
    -
    5522  {
    -
    5523  return anchor.key();
    -
    5524  }
    -
    5525 
    -
    5526  // use an empty key for all primitive types
    -
    5527  default:
    -
    5528  {
    -
    5529  return "";
    -
    5530  }
    -
    5531  }
    -
    5532  }
    -
    5533 
    -
    5535  typename IteratorType::reference value() const
    -
    5536  {
    -
    5537  return anchor.value();
    -
    5538  }
    -
    5539  };
    -
    5540 
    -
    5542  typename IteratorType::reference container;
    -
    5543 
    -
    5544  public:
    -
    5546  iteration_proxy(typename IteratorType::reference cont)
    -
    5547  : container(cont)
    -
    5548  {}
    -
    5549 
    -
    5551  iteration_proxy_internal begin()
    -
    5552  {
    -
    5553  return iteration_proxy_internal(container.begin());
    -
    5554  }
    -
    5555 
    -
    5557  iteration_proxy_internal end()
    -
    5558  {
    -
    5559  return iteration_proxy_internal(container.end());
    -
    5560  }
    -
    5561  };
    -
    5562 
    -
    5563  public:
    -
    5577  class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
    -
    5578  {
    -
    5580  friend class basic_json;
    -
    5581 
    -
    5582  public:
    - - - - -
    5592  using iterator_category = std::bidirectional_iterator_tag;
    -
    5593 
    -
    5595  const_iterator() = default;
    -
    5596 
    -
    5598  const_iterator(pointer object) : m_object(object)
    -
    5599  {
    -
    5600  switch (m_object->m_type)
    -
    5601  {
    - -
    5603  {
    -
    5604  m_it.object_iterator = typename object_t::iterator();
    -
    5605  break;
    -
    5606  }
    -
    5607 
    - -
    5609  {
    -
    5610  m_it.array_iterator = typename array_t::iterator();
    -
    5611  break;
    -
    5612  }
    -
    5613 
    -
    5614  default:
    -
    5615  {
    -
    5616  m_it.primitive_iterator = primitive_iterator_t();
    -
    5617  break;
    -
    5618  }
    -
    5619  }
    -
    5620  }
    -
    5621 
    -
    5623  const_iterator(const iterator& other) : m_object(other.m_object)
    -
    5624  {
    -
    5625  switch (m_object->m_type)
    -
    5626  {
    - -
    5628  {
    -
    5629  m_it.object_iterator = other.m_it.object_iterator;
    -
    5630  break;
    -
    5631  }
    -
    5632 
    - -
    5634  {
    -
    5635  m_it.array_iterator = other.m_it.array_iterator;
    -
    5636  break;
    -
    5637  }
    -
    5638 
    -
    5639  default:
    -
    5640  {
    -
    5641  m_it.primitive_iterator = other.m_it.primitive_iterator;
    -
    5642  break;
    -
    5643  }
    -
    5644  }
    -
    5645  }
    -
    5646 
    -
    5648  const_iterator(const const_iterator& other) noexcept
    -
    5649  : m_object(other.m_object), m_it(other.m_it)
    -
    5650  {}
    -
    5651 
    - -
    5654  std::is_nothrow_move_constructible<pointer>::value and
    -
    5655  std::is_nothrow_move_assignable<pointer>::value and
    -
    5656  std::is_nothrow_move_constructible<internal_iterator>::value and
    -
    5657  std::is_nothrow_move_assignable<internal_iterator>::value
    -
    5658  )
    -
    5659  {
    -
    5660  std::swap(m_object, other.m_object);
    -
    5661  std::swap(m_it, other.m_it);
    -
    5662  return *this;
    -
    5663  }
    -
    5664 
    -
    5665  private:
    -
    5667  void set_begin()
    -
    5668  {
    -
    5669  switch (m_object->m_type)
    -
    5670  {
    - -
    5672  {
    -
    5673  m_it.object_iterator = m_object->m_value.object->begin();
    -
    5674  break;
    -
    5675  }
    -
    5676 
    - -
    5678  {
    -
    5679  m_it.array_iterator = m_object->m_value.array->begin();
    -
    5680  break;
    -
    5681  }
    -
    5682 
    - -
    5684  {
    -
    5685  // set to end so begin()==end() is true: null is empty
    -
    5686  m_it.primitive_iterator.set_end();
    -
    5687  break;
    -
    5688  }
    -
    5689 
    -
    5690  default:
    -
    5691  {
    -
    5692  m_it.primitive_iterator.set_begin();
    -
    5693  break;
    -
    5694  }
    -
    5695  }
    -
    5696  }
    -
    5697 
    -
    5699  void set_end()
    -
    5700  {
    -
    5701  switch (m_object->m_type)
    -
    5702  {
    - -
    5704  {
    -
    5705  m_it.object_iterator = m_object->m_value.object->end();
    -
    5706  break;
    -
    5707  }
    -
    5708 
    - -
    5710  {
    -
    5711  m_it.array_iterator = m_object->m_value.array->end();
    -
    5712  break;
    -
    5713  }
    -
    5714 
    -
    5715  default:
    -
    5716  {
    -
    5717  m_it.primitive_iterator.set_end();
    -
    5718  break;
    -
    5719  }
    -
    5720  }
    -
    5721  }
    -
    5722 
    -
    5723  public:
    - -
    5726  {
    -
    5727  switch (m_object->m_type)
    -
    5728  {
    - -
    5730  {
    -
    5731  return m_it.object_iterator->second;
    -
    5732  }
    -
    5733 
    - -
    5735  {
    -
    5736  return *m_it.array_iterator;
    -
    5737  }
    -
    5738 
    - -
    5740  {
    -
    5741  throw std::out_of_range("cannot get value");
    -
    5742  }
    -
    5743 
    -
    5744  default:
    -
    5745  {
    -
    5746  if (m_it.primitive_iterator.is_begin())
    -
    5747  {
    -
    5748  return *m_object;
    -
    5749  }
    -
    5750  else
    -
    5751  {
    -
    5752  throw std::out_of_range("cannot get value");
    -
    5753  }
    -
    5754  }
    -
    5755  }
    -
    5756  }
    -
    5757 
    - -
    5760  {
    -
    5761  switch (m_object->m_type)
    -
    5762  {
    - -
    5764  {
    -
    5765  return &(m_it.object_iterator->second);
    -
    5766  }
    -
    5767 
    - -
    5769  {
    -
    5770  return &*m_it.array_iterator;
    -
    5771  }
    -
    5772 
    -
    5773  default:
    -
    5774  {
    -
    5775  if (m_it.primitive_iterator.is_begin())
    -
    5776  {
    -
    5777  return m_object;
    -
    5778  }
    -
    5779  else
    -
    5780  {
    -
    5781  throw std::out_of_range("cannot get value");
    -
    5782  }
    -
    5783  }
    -
    5784  }
    -
    5785  }
    -
    5786 
    - -
    5789  {
    -
    5790  auto result = *this;
    -
    5791  ++(*this);
    -
    5792  return result;
    -
    5793  }
    -
    5794 
    - -
    5797  {
    -
    5798  switch (m_object->m_type)
    -
    5799  {
    - -
    5801  {
    -
    5802  ++m_it.object_iterator;
    -
    5803  break;
    -
    5804  }
    -
    5805 
    - -
    5807  {
    -
    5808  ++m_it.array_iterator;
    -
    5809  break;
    -
    5810  }
    -
    5811 
    -
    5812  default:
    -
    5813  {
    -
    5814  ++m_it.primitive_iterator;
    -
    5815  break;
    -
    5816  }
    -
    5817  }
    -
    5818 
    -
    5819  return *this;
    -
    5820  }
    -
    5821 
    - -
    5824  {
    -
    5825  auto result = *this;
    -
    5826  --(*this);
    -
    5827  return result;
    -
    5828  }
    -
    5829 
    - -
    5832  {
    -
    5833  switch (m_object->m_type)
    -
    5834  {
    - -
    5836  {
    -
    5837  --m_it.object_iterator;
    -
    5838  break;
    -
    5839  }
    -
    5840 
    - -
    5842  {
    -
    5843  --m_it.array_iterator;
    -
    5844  break;
    -
    5845  }
    -
    5846 
    -
    5847  default:
    -
    5848  {
    -
    5849  --m_it.primitive_iterator;
    -
    5850  break;
    -
    5851  }
    -
    5852  }
    -
    5853 
    -
    5854  return *this;
    -
    5855  }
    -
    5856 
    -
    5858  bool operator==(const const_iterator& other) const
    -
    5859  {
    -
    5860  // if objects are not the same, the comparison is undefined
    -
    5861  if (m_object != other.m_object)
    -
    5862  {
    -
    5863  throw std::domain_error("cannot compare iterators of different containers");
    -
    5864  }
    -
    5865 
    -
    5866  switch (m_object->m_type)
    -
    5867  {
    - -
    5869  {
    -
    5870  return (m_it.object_iterator == other.m_it.object_iterator);
    -
    5871  }
    -
    5872 
    - -
    5874  {
    -
    5875  return (m_it.array_iterator == other.m_it.array_iterator);
    -
    5876  }
    -
    5877 
    -
    5878  default:
    -
    5879  {
    -
    5880  return (m_it.primitive_iterator == other.m_it.primitive_iterator);
    -
    5881  }
    -
    5882  }
    -
    5883  }
    -
    5884 
    -
    5886  bool operator!=(const const_iterator& other) const
    -
    5887  {
    -
    5888  return not operator==(other);
    -
    5889  }
    -
    5890 
    -
    5892  bool operator<(const const_iterator& other) const
    -
    5893  {
    -
    5894  // if objects are not the same, the comparison is undefined
    -
    5895  if (m_object != other.m_object)
    -
    5896  {
    -
    5897  throw std::domain_error("cannot compare iterators of different containers");
    -
    5898  }
    -
    5899 
    -
    5900  switch (m_object->m_type)
    -
    5901  {
    - -
    5903  {
    -
    5904  throw std::domain_error("cannot compare order of object iterators");
    -
    5905  }
    -
    5906 
    - -
    5908  {
    -
    5909  return (m_it.array_iterator < other.m_it.array_iterator);
    -
    5910  }
    -
    5911 
    -
    5912  default:
    -
    5913  {
    -
    5914  return (m_it.primitive_iterator < other.m_it.primitive_iterator);
    -
    5915  }
    -
    5916  }
    -
    5917  }
    -
    5918 
    -
    5920  bool operator<=(const const_iterator& other) const
    -
    5921  {
    -
    5922  return not other.operator < (*this);
    -
    5923  }
    -
    5924 
    -
    5926  bool operator>(const const_iterator& other) const
    -
    5927  {
    -
    5928  return not operator<=(other);
    -
    5929  }
    -
    5930 
    -
    5932  bool operator>=(const const_iterator& other) const
    -
    5933  {
    -
    5934  return not operator<(other);
    -
    5935  }
    -
    5936 
    - -
    5939  {
    -
    5940  switch (m_object->m_type)
    -
    5941  {
    - -
    5943  {
    -
    5944  throw std::domain_error("cannot use offsets with object iterators");
    -
    5945  }
    -
    5946 
    - -
    5948  {
    -
    5949  m_it.array_iterator += i;
    -
    5950  break;
    -
    5951  }
    -
    5952 
    -
    5953  default:
    -
    5954  {
    -
    5955  m_it.primitive_iterator += i;
    -
    5956  break;
    -
    5957  }
    -
    5958  }
    -
    5959 
    -
    5960  return *this;
    -
    5961  }
    -
    5962 
    - -
    5965  {
    -
    5966  return operator+=(-i);
    -
    5967  }
    -
    5968 
    - -
    5971  {
    -
    5972  auto result = *this;
    -
    5973  result += i;
    -
    5974  return result;
    -
    5975  }
    -
    5976 
    - -
    5979  {
    -
    5980  auto result = *this;
    -
    5981  result -= i;
    -
    5982  return result;
    -
    5983  }
    -
    5984 
    - -
    5987  {
    -
    5988  switch (m_object->m_type)
    -
    5989  {
    - -
    5991  {
    -
    5992  throw std::domain_error("cannot use offsets with object iterators");
    -
    5993  }
    -
    5994 
    - -
    5996  {
    -
    5997  return m_it.array_iterator - other.m_it.array_iterator;
    -
    5998  }
    -
    5999 
    -
    6000  default:
    -
    6001  {
    -
    6002  return m_it.primitive_iterator - other.m_it.primitive_iterator;
    -
    6003  }
    -
    6004  }
    -
    6005  }
    -
    6006 
    - -
    6009  {
    -
    6010  switch (m_object->m_type)
    -
    6011  {
    - -
    6013  {
    -
    6014  throw std::domain_error("cannot use operator[] for object iterators");
    -
    6015  }
    -
    6016 
    - -
    6018  {
    -
    6019  return *(m_it.array_iterator + n);
    -
    6020  }
    -
    6021 
    - -
    6023  {
    -
    6024  throw std::out_of_range("cannot get value");
    -
    6025  }
    -
    6026 
    -
    6027  default:
    -
    6028  {
    -
    6029  if (m_it.primitive_iterator == -n)
    -
    6030  {
    -
    6031  return *m_object;
    -
    6032  }
    -
    6033  else
    -
    6034  {
    -
    6035  throw std::out_of_range("cannot get value");
    -
    6036  }
    -
    6037  }
    -
    6038  }
    -
    6039  }
    -
    6040 
    -
    6042  typename object_t::key_type key() const
    -
    6043  {
    -
    6044  if (m_object->is_object())
    -
    6045  {
    -
    6046  return m_it.object_iterator->first;
    -
    6047  }
    -
    6048  else
    -
    6049  {
    -
    6050  throw std::domain_error("cannot use key() for non-object iterators");
    -
    6051  }
    -
    6052  }
    -
    6053 
    - -
    6056  {
    -
    6057  return operator*();
    -
    6058  }
    -
    6059 
    -
    6060  private:
    -
    6062  pointer m_object = nullptr;
    -
    6064  internal_iterator m_it = internal_iterator();
    -
    6065  };
    -
    6066 
    -
    6079  class iterator : public const_iterator
    -
    6080  {
    -
    6081  public:
    - -
    6083  using pointer = typename basic_json::pointer;
    - -
    6085 
    -
    6087  iterator() = default;
    -
    6088 
    -
    6090  iterator(pointer object) noexcept
    -
    6091  : base_iterator(object)
    -
    6092  {}
    -
    6093 
    -
    6095  iterator(const iterator& other) noexcept
    -
    6096  : base_iterator(other)
    -
    6097  {}
    -
    6098 
    -
    6100  iterator& operator=(iterator other) noexcept(
    -
    6101  std::is_nothrow_move_constructible<pointer>::value and
    -
    6102  std::is_nothrow_move_assignable<pointer>::value and
    -
    6103  std::is_nothrow_move_constructible<internal_iterator>::value and
    -
    6104  std::is_nothrow_move_assignable<internal_iterator>::value
    -
    6105  )
    -
    6106  {
    -
    6107  base_iterator::operator=(other);
    -
    6108  return *this;
    -
    6109  }
    -
    6110 
    - -
    6113  {
    -
    6114  return const_cast<reference>(base_iterator::operator*());
    -
    6115  }
    -
    6116 
    - -
    6119  {
    -
    6120  return const_cast<pointer>(base_iterator::operator->());
    -
    6121  }
    -
    6122 
    - -
    6125  {
    -
    6126  iterator result = *this;
    - -
    6128  return result;
    -
    6129  }
    -
    6130 
    - -
    6133  {
    - -
    6135  return *this;
    -
    6136  }
    -
    6137 
    - -
    6140  {
    -
    6141  iterator result = *this;
    - -
    6143  return result;
    -
    6144  }
    -
    6145 
    - -
    6148  {
    - -
    6150  return *this;
    -
    6151  }
    -
    6152 
    - -
    6155  {
    - -
    6157  return *this;
    -
    6158  }
    -
    6159 
    - -
    6162  {
    - -
    6164  return *this;
    -
    6165  }
    -
    6166 
    - -
    6169  {
    -
    6170  auto result = *this;
    -
    6171  result += i;
    -
    6172  return result;
    -
    6173  }
    -
    6174 
    - -
    6177  {
    -
    6178  auto result = *this;
    -
    6179  result -= i;
    -
    6180  return result;
    -
    6181  }
    -
    6182 
    -
    6183  difference_type operator-(const iterator& other) const
    -
    6184  {
    -
    6185  return base_iterator::operator-(other);
    -
    6186  }
    -
    6187 
    - -
    6190  {
    -
    6191  return const_cast<reference>(base_iterator::operator[](n));
    -
    6192  }
    -
    6193 
    - -
    6196  {
    -
    6197  return const_cast<reference>(base_iterator::value());
    -
    6198  }
    -
    6199  };
    -
    6200 
    -
    6218  template<typename Base>
    -
    6219  class json_reverse_iterator : public std::reverse_iterator<Base>
    -
    6220  {
    -
    6221  public:
    -
    6223  using base_iterator = std::reverse_iterator<Base>;
    -
    6225  using reference = typename Base::reference;
    -
    6226 
    -
    6228  json_reverse_iterator(const typename base_iterator::iterator_type& it)
    -
    6229  : base_iterator(it)
    -
    6230  {}
    -
    6231 
    - -
    6234  : base_iterator(it)
    -
    6235  {}
    -
    6236 
    - -
    6239  {
    -
    6240  return base_iterator::operator++(1);
    -
    6241  }
    -
    6242 
    - -
    6245  {
    -
    6246  base_iterator::operator++();
    -
    6247  return *this;
    -
    6248  }
    -
    6249 
    - -
    6252  {
    -
    6253  return base_iterator::operator--(1);
    -
    6254  }
    -
    6255 
    - -
    6258  {
    -
    6259  base_iterator::operator--();
    -
    6260  return *this;
    -
    6261  }
    -
    6262 
    - -
    6265  {
    -
    6266  base_iterator::operator+=(i);
    -
    6267  return *this;
    -
    6268  }
    -
    6269 
    - -
    6272  {
    -
    6273  auto result = *this;
    -
    6274  result += i;
    -
    6275  return result;
    -
    6276  }
    -
    6277 
    - -
    6280  {
    -
    6281  auto result = *this;
    -
    6282  result -= i;
    -
    6283  return result;
    -
    6284  }
    -
    6285 
    - -
    6288  {
    -
    6289  return this->base() - other.base();
    -
    6290  }
    -
    6291 
    - -
    6294  {
    -
    6295  return *(this->operator+(n));
    -
    6296  }
    -
    6297 
    -
    6299  typename object_t::key_type key() const
    -
    6300  {
    -
    6301  auto it = --this->base();
    -
    6302  return it.key();
    -
    6303  }
    -
    6304 
    - -
    6307  {
    -
    6308  auto it = --this->base();
    -
    6309  return it.operator * ();
    -
    6310  }
    -
    6311  };
    -
    6312 
    -
    6313 
    -
    6314  private:
    -
    6316  // lexer and parser //
    -
    6318 
    -
    6326  class lexer
    -
    6327  {
    -
    6328  public:
    -
    6330  enum class token_type
    -
    6331  {
    -
    6332  uninitialized,
    -
    6333  literal_true,
    -
    6334  literal_false,
    -
    6335  literal_null,
    -
    6336  value_string,
    -
    6337  value_number,
    -
    6338  begin_array,
    -
    6339  begin_object,
    -
    6340  end_array,
    -
    6341  end_object,
    -
    6342  name_separator,
    -
    6343  value_separator,
    -
    6344  parse_error,
    -
    6345  end_of_input
    -
    6346  };
    -
    6347 
    -
    6349  using lexer_char_t = unsigned char;
    -
    6350 
    -
    6352  explicit lexer(const string_t& s) noexcept
    -
    6353  : m_stream(nullptr), m_buffer(s)
    -
    6354  {
    -
    6355  m_content = reinterpret_cast<const lexer_char_t*>(s.c_str());
    -
    6356  m_start = m_cursor = m_content;
    -
    6357  m_limit = m_content + s.size();
    -
    6358  }
    -
    6359 
    -
    6361  explicit lexer(std::istream* s) noexcept
    -
    6362  : m_stream(s), m_buffer()
    -
    6363  {
    -
    6364  getline(*m_stream, m_buffer);
    -
    6365  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
    -
    6366  m_start = m_cursor = m_content;
    -
    6367  m_limit = m_content + m_buffer.size();
    -
    6368  }
    -
    6369 
    -
    6371  lexer() = default;
    -
    6372 
    -
    6373  // switch off unwanted functions
    -
    6374  lexer(const lexer&) = delete;
    -
    6375  lexer operator=(const lexer&) = delete;
    -
    6376 
    -
    6392  static string_t to_unicode(const std::size_t codepoint1,
    -
    6393  const std::size_t codepoint2 = 0)
    -
    6394  {
    -
    6395  string_t result;
    -
    6396 
    -
    6397  // calculate the codepoint from the given code points
    -
    6398  std::size_t codepoint = codepoint1;
    -
    6399 
    -
    6400  // check if codepoint1 is a high surrogate
    -
    6401  if (codepoint1 >= 0xD800 and codepoint1 <= 0xDBFF)
    -
    6402  {
    -
    6403  // check if codepoint2 is a low surrogate
    -
    6404  if (codepoint2 >= 0xDC00 and codepoint2 <= 0xDFFF)
    -
    6405  {
    -
    6406  codepoint =
    -
    6407  // high surrogate occupies the most significant 22 bits
    -
    6408  (codepoint1 << 10)
    -
    6409  // low surrogate occupies the least significant 15 bits
    -
    6410  + codepoint2
    -
    6411  // there is still the 0xD800, 0xDC00 and 0x10000 noise
    -
    6412  // in the result so we have to substract with:
    -
    6413  // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
    -
    6414  - 0x35FDC00;
    -
    6415  }
    -
    6416  else
    -
    6417  {
    -
    6418  throw std::invalid_argument("missing or wrong low surrogate");
    -
    6419  }
    -
    6420  }
    -
    6421 
    -
    6422  if (codepoint < 0x80)
    -
    6423  {
    -
    6424  // 1-byte characters: 0xxxxxxx (ASCII)
    -
    6425  result.append(1, static_cast<typename string_t::value_type>(codepoint));
    -
    6426  }
    -
    6427  else if (codepoint <= 0x7ff)
    -
    6428  {
    -
    6429  // 2-byte characters: 110xxxxx 10xxxxxx
    -
    6430  result.append(1, static_cast<typename string_t::value_type>(0xC0 | ((codepoint >> 6) & 0x1F)));
    -
    6431  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
    -
    6432  }
    -
    6433  else if (codepoint <= 0xffff)
    -
    6434  {
    -
    6435  // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
    -
    6436  result.append(1, static_cast<typename string_t::value_type>(0xE0 | ((codepoint >> 12) & 0x0F)));
    -
    6437  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
    -
    6438  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
    -
    6439  }
    -
    6440  else if (codepoint <= 0x10ffff)
    -
    6441  {
    -
    6442  // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
    -
    6443  result.append(1, static_cast<typename string_t::value_type>(0xF0 | ((codepoint >> 18) & 0x07)));
    -
    6444  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 12) & 0x3F)));
    -
    6445  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
    -
    6446  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
    -
    6447  }
    -
    6448  else
    -
    6449  {
    -
    6450  throw std::out_of_range("code points above 0x10FFFF are invalid");
    -
    6451  }
    -
    6452 
    -
    6453  return result;
    -
    6454  }
    -
    6455 
    -
    6457  static std::string token_type_name(token_type t)
    -
    6458  {
    -
    6459  switch (t)
    -
    6460  {
    -
    6461  case token_type::uninitialized:
    -
    6462  return "<uninitialized>";
    -
    6463  case token_type::literal_true:
    -
    6464  return "true literal";
    -
    6465  case token_type::literal_false:
    -
    6466  return "false literal";
    -
    6467  case token_type::literal_null:
    -
    6468  return "null literal";
    -
    6469  case token_type::value_string:
    -
    6470  return "string literal";
    -
    6471  case token_type::value_number:
    -
    6472  return "number literal";
    -
    6473  case token_type::begin_array:
    -
    6474  return "'['";
    -
    6475  case token_type::begin_object:
    -
    6476  return "'{'";
    -
    6477  case token_type::end_array:
    -
    6478  return "']'";
    -
    6479  case token_type::end_object:
    -
    6480  return "'}'";
    -
    6481  case token_type::name_separator:
    -
    6482  return "':'";
    -
    6483  case token_type::value_separator:
    -
    6484  return "','";
    -
    6485  case token_type::parse_error:
    -
    6486  return "<parse error>";
    -
    6487  case token_type::end_of_input:
    -
    6488  return "end of input";
    -
    6489  default:
    -
    6490  {
    -
    6491  // catch non-enum values
    -
    6492  return "unknown token"; // LCOV_EXCL_LINE
    -
    6493  }
    -
    6494  }
    -
    6495  }
    -
    6496 
    -
    6507  token_type scan() noexcept
    -
    6508  {
    -
    6509  // pointer for backtracking information
    -
    6510  m_marker = nullptr;
    -
    6511 
    -
    6512  // remember the begin of the token
    -
    6513  m_start = m_cursor;
    -
    6514 
    -
    6515 
    -
    6516  {
    -
    6517  lexer_char_t yych;
    -
    6518  unsigned int yyaccept = 0;
    -
    6519  static const unsigned char yybm[] =
    -
    6520  {
    -
    6521  0, 0, 0, 0, 0, 0, 0, 0,
    -
    6522  0, 32, 32, 0, 0, 32, 0, 0,
    -
    6523  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6524  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6525  96, 64, 0, 64, 64, 64, 64, 64,
    -
    6526  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6527  192, 192, 192, 192, 192, 192, 192, 192,
    -
    6528  192, 192, 64, 64, 64, 64, 64, 64,
    -
    6529  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6530  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6531  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6532  64, 64, 64, 64, 0, 64, 64, 64,
    -
    6533  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6534  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6535  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6536  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6537  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6538  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6539  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6540  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6541  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6542  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6543  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6544  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6545  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6546  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6547  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6548  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6549  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6550  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6551  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6552  64, 64, 64, 64, 64, 64, 64, 64,
    -
    6553  };
    -
    6554  if ((m_limit - m_cursor) < 5)
    -
    6555  {
    -
    6556  yyfill(); // LCOV_EXCL_LINE;
    -
    6557  }
    -
    6558  yych = *m_cursor;
    -
    6559  if (yych <= ':')
    -
    6560  {
    -
    6561  if (yych <= ' ')
    -
    6562  {
    -
    6563  if (yych <= '\n')
    -
    6564  {
    -
    6565  if (yych <= 0x00)
    -
    6566  {
    -
    6567  goto basic_json_parser_28;
    -
    6568  }
    -
    6569  if (yych <= 0x08)
    -
    6570  {
    -
    6571  goto basic_json_parser_30;
    -
    6572  }
    -
    6573  if (yych >= '\n')
    -
    6574  {
    -
    6575  goto basic_json_parser_4;
    -
    6576  }
    -
    6577  }
    -
    6578  else
    -
    6579  {
    -
    6580  if (yych == '\r')
    -
    6581  {
    -
    6582  goto basic_json_parser_2;
    -
    6583  }
    -
    6584  if (yych <= 0x1F)
    -
    6585  {
    -
    6586  goto basic_json_parser_30;
    -
    6587  }
    -
    6588  }
    -
    6589  }
    -
    6590  else
    -
    6591  {
    -
    6592  if (yych <= ',')
    -
    6593  {
    -
    6594  if (yych == '"')
    -
    6595  {
    -
    6596  goto basic_json_parser_27;
    -
    6597  }
    -
    6598  if (yych <= '+')
    -
    6599  {
    -
    6600  goto basic_json_parser_30;
    -
    6601  }
    -
    6602  goto basic_json_parser_16;
    -
    6603  }
    -
    6604  else
    -
    6605  {
    -
    6606  if (yych <= '/')
    -
    6607  {
    -
    6608  if (yych <= '-')
    -
    6609  {
    -
    6610  goto basic_json_parser_23;
    -
    6611  }
    -
    6612  goto basic_json_parser_30;
    -
    6613  }
    -
    6614  else
    -
    6615  {
    -
    6616  if (yych <= '0')
    -
    6617  {
    -
    6618  goto basic_json_parser_24;
    -
    6619  }
    -
    6620  if (yych <= '9')
    -
    6621  {
    -
    6622  goto basic_json_parser_26;
    -
    6623  }
    -
    6624  goto basic_json_parser_18;
    -
    6625  }
    -
    6626  }
    -
    6627  }
    -
    6628  }
    -
    6629  else
    -
    6630  {
    -
    6631  if (yych <= 'n')
    -
    6632  {
    -
    6633  if (yych <= ']')
    -
    6634  {
    -
    6635  if (yych == '[')
    -
    6636  {
    -
    6637  goto basic_json_parser_8;
    -
    6638  }
    -
    6639  if (yych <= '\\')
    -
    6640  {
    -
    6641  goto basic_json_parser_30;
    -
    6642  }
    -
    6643  goto basic_json_parser_10;
    -
    6644  }
    -
    6645  else
    -
    6646  {
    -
    6647  if (yych == 'f')
    -
    6648  {
    -
    6649  goto basic_json_parser_22;
    -
    6650  }
    -
    6651  if (yych <= 'm')
    -
    6652  {
    -
    6653  goto basic_json_parser_30;
    -
    6654  }
    -
    6655  goto basic_json_parser_20;
    -
    6656  }
    -
    6657  }
    -
    6658  else
    -
    6659  {
    -
    6660  if (yych <= '{')
    -
    6661  {
    -
    6662  if (yych == 't')
    -
    6663  {
    -
    6664  goto basic_json_parser_21;
    -
    6665  }
    -
    6666  if (yych <= 'z')
    -
    6667  {
    -
    6668  goto basic_json_parser_30;
    -
    6669  }
    -
    6670  goto basic_json_parser_12;
    -
    6671  }
    -
    6672  else
    -
    6673  {
    -
    6674  if (yych <= '}')
    -
    6675  {
    -
    6676  if (yych <= '|')
    -
    6677  {
    -
    6678  goto basic_json_parser_30;
    -
    6679  }
    -
    6680  goto basic_json_parser_14;
    -
    6681  }
    -
    6682  else
    -
    6683  {
    -
    6684  if (yych == 0xEF)
    -
    6685  {
    -
    6686  goto basic_json_parser_6;
    -
    6687  }
    -
    6688  goto basic_json_parser_30;
    -
    6689  }
    -
    6690  }
    -
    6691  }
    -
    6692  }
    -
    6693 basic_json_parser_2:
    -
    6694  ++m_cursor;
    -
    6695  yych = *m_cursor;
    -
    6696  goto basic_json_parser_5;
    -
    6697 basic_json_parser_3:
    -
    6698  {
    -
    6699  return scan();
    -
    6700  }
    -
    6701 basic_json_parser_4:
    -
    6702  ++m_cursor;
    -
    6703  if (m_limit <= m_cursor)
    -
    6704  {
    -
    6705  yyfill(); // LCOV_EXCL_LINE;
    -
    6706  }
    -
    6707  yych = *m_cursor;
    -
    6708 basic_json_parser_5:
    -
    6709  if (yybm[0 + yych] & 32)
    -
    6710  {
    -
    6711  goto basic_json_parser_4;
    -
    6712  }
    -
    6713  goto basic_json_parser_3;
    -
    6714 basic_json_parser_6:
    -
    6715  yyaccept = 0;
    -
    6716  yych = *(m_marker = ++m_cursor);
    -
    6717  if (yych == 0xBB)
    -
    6718  {
    -
    6719  goto basic_json_parser_64;
    -
    6720  }
    -
    6721 basic_json_parser_7:
    -
    6722  {
    -
    6723  return token_type::parse_error;
    -
    6724  }
    -
    6725 basic_json_parser_8:
    -
    6726  ++m_cursor;
    -
    6727  {
    -
    6728  return token_type::begin_array;
    -
    6729  }
    -
    6730 basic_json_parser_10:
    -
    6731  ++m_cursor;
    -
    6732  {
    -
    6733  return token_type::end_array;
    -
    6734  }
    -
    6735 basic_json_parser_12:
    -
    6736  ++m_cursor;
    -
    6737  {
    -
    6738  return token_type::begin_object;
    -
    6739  }
    -
    6740 basic_json_parser_14:
    -
    6741  ++m_cursor;
    -
    6742  {
    -
    6743  return token_type::end_object;
    -
    6744  }
    -
    6745 basic_json_parser_16:
    -
    6746  ++m_cursor;
    -
    6747  {
    -
    6748  return token_type::value_separator;
    -
    6749  }
    -
    6750 basic_json_parser_18:
    -
    6751  ++m_cursor;
    -
    6752  {
    -
    6753  return token_type::name_separator;
    -
    6754  }
    -
    6755 basic_json_parser_20:
    -
    6756  yyaccept = 0;
    -
    6757  yych = *(m_marker = ++m_cursor);
    -
    6758  if (yych == 'u')
    -
    6759  {
    -
    6760  goto basic_json_parser_60;
    -
    6761  }
    -
    6762  goto basic_json_parser_7;
    -
    6763 basic_json_parser_21:
    -
    6764  yyaccept = 0;
    -
    6765  yych = *(m_marker = ++m_cursor);
    -
    6766  if (yych == 'r')
    -
    6767  {
    -
    6768  goto basic_json_parser_56;
    -
    6769  }
    -
    6770  goto basic_json_parser_7;
    -
    6771 basic_json_parser_22:
    -
    6772  yyaccept = 0;
    -
    6773  yych = *(m_marker = ++m_cursor);
    -
    6774  if (yych == 'a')
    -
    6775  {
    -
    6776  goto basic_json_parser_51;
    -
    6777  }
    -
    6778  goto basic_json_parser_7;
    -
    6779 basic_json_parser_23:
    -
    6780  yych = *++m_cursor;
    -
    6781  if (yych <= '/')
    -
    6782  {
    -
    6783  goto basic_json_parser_7;
    -
    6784  }
    -
    6785  if (yych <= '0')
    -
    6786  {
    -
    6787  goto basic_json_parser_50;
    -
    6788  }
    -
    6789  if (yych <= '9')
    -
    6790  {
    -
    6791  goto basic_json_parser_41;
    -
    6792  }
    -
    6793  goto basic_json_parser_7;
    -
    6794 basic_json_parser_24:
    -
    6795  yyaccept = 1;
    -
    6796  yych = *(m_marker = ++m_cursor);
    -
    6797  if (yych <= 'D')
    -
    6798  {
    -
    6799  if (yych == '.')
    -
    6800  {
    -
    6801  goto basic_json_parser_43;
    -
    6802  }
    -
    6803  }
    -
    6804  else
    -
    6805  {
    -
    6806  if (yych <= 'E')
    -
    6807  {
    -
    6808  goto basic_json_parser_44;
    -
    6809  }
    -
    6810  if (yych == 'e')
    -
    6811  {
    -
    6812  goto basic_json_parser_44;
    -
    6813  }
    -
    6814  }
    -
    6815 basic_json_parser_25:
    -
    6816  {
    -
    6817  return token_type::value_number;
    -
    6818  }
    -
    6819 basic_json_parser_26:
    -
    6820  yyaccept = 1;
    -
    6821  yych = *(m_marker = ++m_cursor);
    -
    6822  goto basic_json_parser_42;
    -
    6823 basic_json_parser_27:
    -
    6824  yyaccept = 0;
    -
    6825  yych = *(m_marker = ++m_cursor);
    -
    6826  if (yych <= 0x0F)
    -
    6827  {
    -
    6828  goto basic_json_parser_7;
    -
    6829  }
    -
    6830  goto basic_json_parser_32;
    -
    6831 basic_json_parser_28:
    -
    6832  ++m_cursor;
    -
    6833  {
    -
    6834  return token_type::end_of_input;
    -
    6835  }
    -
    6836 basic_json_parser_30:
    -
    6837  yych = *++m_cursor;
    -
    6838  goto basic_json_parser_7;
    -
    6839 basic_json_parser_31:
    -
    6840  ++m_cursor;
    -
    6841  if (m_limit <= m_cursor)
    -
    6842  {
    -
    6843  yyfill(); // LCOV_EXCL_LINE;
    -
    6844  }
    -
    6845  yych = *m_cursor;
    -
    6846 basic_json_parser_32:
    -
    6847  if (yybm[0 + yych] & 64)
    -
    6848  {
    -
    6849  goto basic_json_parser_31;
    -
    6850  }
    -
    6851  if (yych <= 0x0F)
    -
    6852  {
    -
    6853  goto basic_json_parser_33;
    -
    6854  }
    -
    6855  if (yych <= '"')
    -
    6856  {
    -
    6857  goto basic_json_parser_35;
    -
    6858  }
    -
    6859  goto basic_json_parser_34;
    -
    6860 basic_json_parser_33:
    -
    6861  m_cursor = m_marker;
    -
    6862  if (yyaccept == 0)
    -
    6863  {
    -
    6864  goto basic_json_parser_7;
    -
    6865  }
    -
    6866  else
    -
    6867  {
    -
    6868  goto basic_json_parser_25;
    -
    6869  }
    -
    6870 basic_json_parser_34:
    -
    6871  ++m_cursor;
    -
    6872  if (m_limit <= m_cursor)
    -
    6873  {
    -
    6874  yyfill(); // LCOV_EXCL_LINE;
    -
    6875  }
    -
    6876  yych = *m_cursor;
    -
    6877  if (yych <= 'e')
    -
    6878  {
    -
    6879  if (yych <= '/')
    -
    6880  {
    -
    6881  if (yych == '"')
    -
    6882  {
    -
    6883  goto basic_json_parser_31;
    -
    6884  }
    -
    6885  if (yych <= '.')
    -
    6886  {
    -
    6887  goto basic_json_parser_33;
    -
    6888  }
    -
    6889  goto basic_json_parser_31;
    -
    6890  }
    -
    6891  else
    -
    6892  {
    -
    6893  if (yych <= '\\')
    -
    6894  {
    -
    6895  if (yych <= '[')
    -
    6896  {
    -
    6897  goto basic_json_parser_33;
    -
    6898  }
    -
    6899  goto basic_json_parser_31;
    -
    6900  }
    -
    6901  else
    -
    6902  {
    -
    6903  if (yych == 'b')
    -
    6904  {
    -
    6905  goto basic_json_parser_31;
    -
    6906  }
    -
    6907  goto basic_json_parser_33;
    -
    6908  }
    -
    6909  }
    -
    6910  }
    -
    6911  else
    -
    6912  {
    -
    6913  if (yych <= 'q')
    -
    6914  {
    -
    6915  if (yych <= 'f')
    -
    6916  {
    -
    6917  goto basic_json_parser_31;
    -
    6918  }
    -
    6919  if (yych == 'n')
    -
    6920  {
    -
    6921  goto basic_json_parser_31;
    -
    6922  }
    -
    6923  goto basic_json_parser_33;
    -
    6924  }
    -
    6925  else
    -
    6926  {
    -
    6927  if (yych <= 's')
    -
    6928  {
    -
    6929  if (yych <= 'r')
    -
    6930  {
    -
    6931  goto basic_json_parser_31;
    -
    6932  }
    -
    6933  goto basic_json_parser_33;
    -
    6934  }
    -
    6935  else
    -
    6936  {
    -
    6937  if (yych <= 't')
    -
    6938  {
    -
    6939  goto basic_json_parser_31;
    -
    6940  }
    -
    6941  if (yych <= 'u')
    -
    6942  {
    -
    6943  goto basic_json_parser_37;
    -
    6944  }
    -
    6945  goto basic_json_parser_33;
    -
    6946  }
    -
    6947  }
    -
    6948  }
    -
    6949 basic_json_parser_35:
    -
    6950  ++m_cursor;
    -
    6951  {
    -
    6952  return token_type::value_string;
    -
    6953  }
    -
    6954 basic_json_parser_37:
    -
    6955  ++m_cursor;
    -
    6956  if (m_limit <= m_cursor)
    -
    6957  {
    -
    6958  yyfill(); // LCOV_EXCL_LINE;
    -
    6959  }
    -
    6960  yych = *m_cursor;
    -
    6961  if (yych <= '@')
    -
    6962  {
    -
    6963  if (yych <= '/')
    -
    6964  {
    -
    6965  goto basic_json_parser_33;
    -
    6966  }
    -
    6967  if (yych >= ':')
    -
    6968  {
    -
    6969  goto basic_json_parser_33;
    -
    6970  }
    -
    6971  }
    -
    6972  else
    -
    6973  {
    -
    6974  if (yych <= 'F')
    -
    6975  {
    -
    6976  goto basic_json_parser_38;
    -
    6977  }
    -
    6978  if (yych <= '`')
    -
    6979  {
    -
    6980  goto basic_json_parser_33;
    -
    6981  }
    -
    6982  if (yych >= 'g')
    -
    6983  {
    -
    6984  goto basic_json_parser_33;
    -
    6985  }
    -
    6986  }
    -
    6987 basic_json_parser_38:
    -
    6988  ++m_cursor;
    -
    6989  if (m_limit <= m_cursor)
    -
    6990  {
    -
    6991  yyfill(); // LCOV_EXCL_LINE;
    -
    6992  }
    -
    6993  yych = *m_cursor;
    -
    6994  if (yych <= '@')
    -
    6995  {
    -
    6996  if (yych <= '/')
    -
    6997  {
    -
    6998  goto basic_json_parser_33;
    -
    6999  }
    -
    7000  if (yych >= ':')
    -
    7001  {
    -
    7002  goto basic_json_parser_33;
    -
    7003  }
    -
    7004  }
    -
    7005  else
    -
    7006  {
    -
    7007  if (yych <= 'F')
    -
    7008  {
    -
    7009  goto basic_json_parser_39;
    -
    7010  }
    -
    7011  if (yych <= '`')
    -
    7012  {
    -
    7013  goto basic_json_parser_33;
    -
    7014  }
    -
    7015  if (yych >= 'g')
    -
    7016  {
    -
    7017  goto basic_json_parser_33;
    -
    7018  }
    -
    7019  }
    -
    7020 basic_json_parser_39:
    -
    7021  ++m_cursor;
    -
    7022  if (m_limit <= m_cursor)
    -
    7023  {
    -
    7024  yyfill(); // LCOV_EXCL_LINE;
    -
    7025  }
    -
    7026  yych = *m_cursor;
    -
    7027  if (yych <= '@')
    -
    7028  {
    -
    7029  if (yych <= '/')
    -
    7030  {
    -
    7031  goto basic_json_parser_33;
    -
    7032  }
    -
    7033  if (yych >= ':')
    -
    7034  {
    -
    7035  goto basic_json_parser_33;
    -
    7036  }
    -
    7037  }
    -
    7038  else
    -
    7039  {
    -
    7040  if (yych <= 'F')
    -
    7041  {
    -
    7042  goto basic_json_parser_40;
    -
    7043  }
    -
    7044  if (yych <= '`')
    -
    7045  {
    -
    7046  goto basic_json_parser_33;
    -
    7047  }
    -
    7048  if (yych >= 'g')
    -
    7049  {
    -
    7050  goto basic_json_parser_33;
    -
    7051  }
    -
    7052  }
    -
    7053 basic_json_parser_40:
    -
    7054  ++m_cursor;
    -
    7055  if (m_limit <= m_cursor)
    -
    7056  {
    -
    7057  yyfill(); // LCOV_EXCL_LINE;
    -
    7058  }
    -
    7059  yych = *m_cursor;
    -
    7060  if (yych <= '@')
    -
    7061  {
    -
    7062  if (yych <= '/')
    -
    7063  {
    -
    7064  goto basic_json_parser_33;
    -
    7065  }
    -
    7066  if (yych <= '9')
    -
    7067  {
    -
    7068  goto basic_json_parser_31;
    -
    7069  }
    -
    7070  goto basic_json_parser_33;
    -
    7071  }
    -
    7072  else
    -
    7073  {
    -
    7074  if (yych <= 'F')
    -
    7075  {
    -
    7076  goto basic_json_parser_31;
    -
    7077  }
    -
    7078  if (yych <= '`')
    -
    7079  {
    -
    7080  goto basic_json_parser_33;
    -
    7081  }
    -
    7082  if (yych <= 'f')
    -
    7083  {
    -
    7084  goto basic_json_parser_31;
    -
    7085  }
    -
    7086  goto basic_json_parser_33;
    -
    7087  }
    -
    7088 basic_json_parser_41:
    -
    7089  yyaccept = 1;
    -
    7090  m_marker = ++m_cursor;
    -
    7091  if ((m_limit - m_cursor) < 3)
    -
    7092  {
    -
    7093  yyfill(); // LCOV_EXCL_LINE;
    -
    7094  }
    -
    7095  yych = *m_cursor;
    -
    7096 basic_json_parser_42:
    -
    7097  if (yybm[0 + yych] & 128)
    -
    7098  {
    -
    7099  goto basic_json_parser_41;
    -
    7100  }
    -
    7101  if (yych <= 'D')
    -
    7102  {
    -
    7103  if (yych != '.')
    -
    7104  {
    -
    7105  goto basic_json_parser_25;
    -
    7106  }
    -
    7107  }
    -
    7108  else
    -
    7109  {
    -
    7110  if (yych <= 'E')
    -
    7111  {
    -
    7112  goto basic_json_parser_44;
    -
    7113  }
    -
    7114  if (yych == 'e')
    -
    7115  {
    -
    7116  goto basic_json_parser_44;
    -
    7117  }
    -
    7118  goto basic_json_parser_25;
    -
    7119  }
    -
    7120 basic_json_parser_43:
    -
    7121  yych = *++m_cursor;
    -
    7122  if (yych <= '/')
    -
    7123  {
    -
    7124  goto basic_json_parser_33;
    -
    7125  }
    -
    7126  if (yych <= '9')
    -
    7127  {
    -
    7128  goto basic_json_parser_48;
    -
    7129  }
    -
    7130  goto basic_json_parser_33;
    -
    7131 basic_json_parser_44:
    -
    7132  yych = *++m_cursor;
    -
    7133  if (yych <= ',')
    -
    7134  {
    -
    7135  if (yych != '+')
    -
    7136  {
    -
    7137  goto basic_json_parser_33;
    -
    7138  }
    -
    7139  }
    -
    7140  else
    -
    7141  {
    -
    7142  if (yych <= '-')
    -
    7143  {
    -
    7144  goto basic_json_parser_45;
    -
    7145  }
    -
    7146  if (yych <= '/')
    -
    7147  {
    -
    7148  goto basic_json_parser_33;
    -
    7149  }
    -
    7150  if (yych <= '9')
    -
    7151  {
    -
    7152  goto basic_json_parser_46;
    -
    7153  }
    -
    7154  goto basic_json_parser_33;
    -
    7155  }
    -
    7156 basic_json_parser_45:
    -
    7157  yych = *++m_cursor;
    -
    7158  if (yych <= '/')
    -
    7159  {
    -
    7160  goto basic_json_parser_33;
    -
    7161  }
    -
    7162  if (yych >= ':')
    -
    7163  {
    -
    7164  goto basic_json_parser_33;
    -
    7165  }
    -
    7166 basic_json_parser_46:
    -
    7167  ++m_cursor;
    -
    7168  if (m_limit <= m_cursor)
    -
    7169  {
    -
    7170  yyfill(); // LCOV_EXCL_LINE;
    -
    7171  }
    -
    7172  yych = *m_cursor;
    -
    7173  if (yych <= '/')
    -
    7174  {
    -
    7175  goto basic_json_parser_25;
    -
    7176  }
    -
    7177  if (yych <= '9')
    -
    7178  {
    -
    7179  goto basic_json_parser_46;
    -
    7180  }
    -
    7181  goto basic_json_parser_25;
    -
    7182 basic_json_parser_48:
    -
    7183  yyaccept = 1;
    -
    7184  m_marker = ++m_cursor;
    -
    7185  if ((m_limit - m_cursor) < 3)
    -
    7186  {
    -
    7187  yyfill(); // LCOV_EXCL_LINE;
    -
    7188  }
    -
    7189  yych = *m_cursor;
    -
    7190  if (yych <= 'D')
    -
    7191  {
    -
    7192  if (yych <= '/')
    -
    7193  {
    -
    7194  goto basic_json_parser_25;
    -
    7195  }
    -
    7196  if (yych <= '9')
    -
    7197  {
    -
    7198  goto basic_json_parser_48;
    -
    7199  }
    -
    7200  goto basic_json_parser_25;
    -
    7201  }
    -
    7202  else
    -
    7203  {
    -
    7204  if (yych <= 'E')
    -
    7205  {
    -
    7206  goto basic_json_parser_44;
    -
    7207  }
    -
    7208  if (yych == 'e')
    -
    7209  {
    -
    7210  goto basic_json_parser_44;
    -
    7211  }
    -
    7212  goto basic_json_parser_25;
    -
    7213  }
    -
    7214 basic_json_parser_50:
    -
    7215  yyaccept = 1;
    -
    7216  yych = *(m_marker = ++m_cursor);
    -
    7217  if (yych <= 'D')
    -
    7218  {
    -
    7219  if (yych == '.')
    -
    7220  {
    -
    7221  goto basic_json_parser_43;
    -
    7222  }
    -
    7223  goto basic_json_parser_25;
    -
    7224  }
    -
    7225  else
    -
    7226  {
    -
    7227  if (yych <= 'E')
    -
    7228  {
    -
    7229  goto basic_json_parser_44;
    -
    7230  }
    -
    7231  if (yych == 'e')
    -
    7232  {
    -
    7233  goto basic_json_parser_44;
    -
    7234  }
    -
    7235  goto basic_json_parser_25;
    -
    7236  }
    -
    7237 basic_json_parser_51:
    -
    7238  yych = *++m_cursor;
    -
    7239  if (yych != 'l')
    -
    7240  {
    -
    7241  goto basic_json_parser_33;
    -
    7242  }
    -
    7243  yych = *++m_cursor;
    -
    7244  if (yych != 's')
    -
    7245  {
    -
    7246  goto basic_json_parser_33;
    -
    7247  }
    -
    7248  yych = *++m_cursor;
    -
    7249  if (yych != 'e')
    -
    7250  {
    -
    7251  goto basic_json_parser_33;
    -
    7252  }
    -
    7253  ++m_cursor;
    -
    7254  {
    -
    7255  return token_type::literal_false;
    -
    7256  }
    -
    7257 basic_json_parser_56:
    -
    7258  yych = *++m_cursor;
    -
    7259  if (yych != 'u')
    -
    7260  {
    -
    7261  goto basic_json_parser_33;
    -
    7262  }
    -
    7263  yych = *++m_cursor;
    -
    7264  if (yych != 'e')
    -
    7265  {
    -
    7266  goto basic_json_parser_33;
    -
    7267  }
    -
    7268  ++m_cursor;
    -
    7269  {
    -
    7270  return token_type::literal_true;
    -
    7271  }
    -
    7272 basic_json_parser_60:
    -
    7273  yych = *++m_cursor;
    -
    7274  if (yych != 'l')
    -
    7275  {
    -
    7276  goto basic_json_parser_33;
    -
    7277  }
    -
    7278  yych = *++m_cursor;
    -
    7279  if (yych != 'l')
    -
    7280  {
    -
    7281  goto basic_json_parser_33;
    -
    7282  }
    -
    7283  ++m_cursor;
    -
    7284  {
    -
    7285  return token_type::literal_null;
    -
    7286  }
    -
    7287 basic_json_parser_64:
    -
    7288  yych = *++m_cursor;
    -
    7289  if (yych != 0xBF)
    -
    7290  {
    -
    7291  goto basic_json_parser_33;
    -
    7292  }
    -
    7293  ++m_cursor;
    -
    7294  {
    -
    7295  return scan();
    -
    7296  }
    -
    7297  }
    -
    7298 
    -
    7299 
    -
    7300  }
    -
    7301 
    -
    7303  void yyfill() noexcept
    -
    7304  {
    -
    7305  if (not m_stream or not * m_stream)
    -
    7306  {
    -
    7307  return;
    -
    7308  }
    -
    7309 
    -
    7310  const ssize_t offset_start = m_start - m_content;
    -
    7311  const ssize_t offset_marker = m_marker - m_start;
    -
    7312  const ssize_t offset_cursor = m_cursor - m_start;
    -
    7313 
    -
    7314  m_buffer.erase(0, static_cast<size_t>(offset_start));
    -
    7315  std::string line;
    -
    7316  std::getline(*m_stream, line);
    -
    7317  m_buffer += "\n" + line; // add line with newline symbol
    -
    7318 
    -
    7319  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
    -
    7320  m_start = m_content;
    -
    7321  m_marker = m_start + offset_marker;
    -
    7322  m_cursor = m_start + offset_cursor;
    -
    7323  m_limit = m_start + m_buffer.size() - 1;
    -
    7324  }
    -
    7325 
    -
    7327  string_t get_token() const noexcept
    -
    7328  {
    -
    7329  return string_t(reinterpret_cast<typename string_t::const_pointer>(m_start),
    -
    7330  static_cast<size_t>(m_cursor - m_start));
    -
    7331  }
    -
    7332 
    -
    7354  string_t get_string() const
    -
    7355  {
    -
    7356  string_t result;
    -
    7357  result.reserve(static_cast<size_t>(m_cursor - m_start - 2));
    -
    7358 
    -
    7359  // iterate the result between the quotes
    -
    7360  for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i)
    -
    7361  {
    -
    7362  // process escaped characters
    -
    7363  if (*i == '\\')
    -
    7364  {
    -
    7365  // read next character
    -
    7366  ++i;
    -
    7367 
    -
    7368  switch (*i)
    -
    7369  {
    -
    7370  // the default escapes
    -
    7371  case 't':
    -
    7372  {
    -
    7373  result += "\t";
    -
    7374  break;
    -
    7375  }
    -
    7376  case 'b':
    -
    7377  {
    -
    7378  result += "\b";
    -
    7379  break;
    -
    7380  }
    -
    7381  case 'f':
    -
    7382  {
    -
    7383  result += "\f";
    -
    7384  break;
    -
    7385  }
    -
    7386  case 'n':
    -
    7387  {
    -
    7388  result += "\n";
    -
    7389  break;
    -
    7390  }
    -
    7391  case 'r':
    -
    7392  {
    -
    7393  result += "\r";
    -
    7394  break;
    -
    7395  }
    -
    7396  case '\\':
    -
    7397  {
    -
    7398  result += "\\";
    -
    7399  break;
    -
    7400  }
    -
    7401  case '/':
    -
    7402  {
    -
    7403  result += "/";
    -
    7404  break;
    -
    7405  }
    -
    7406  case '"':
    -
    7407  {
    -
    7408  result += "\"";
    -
    7409  break;
    -
    7410  }
    -
    7411 
    -
    7412  // unicode
    -
    7413  case 'u':
    -
    7414  {
    -
    7415  // get code xxxx from uxxxx
    -
    7416  auto codepoint = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>(i + 1),
    -
    7417  4).c_str(), nullptr, 16);
    -
    7418 
    -
    7419  // check if codepoint is a high surrogate
    -
    7420  if (codepoint >= 0xD800 and codepoint <= 0xDBFF)
    -
    7421  {
    -
    7422  // make sure there is a subsequent unicode
    -
    7423  if ((i + 6 >= m_limit) or * (i + 5) != '\\' or * (i + 6) != 'u')
    -
    7424  {
    -
    7425  throw std::invalid_argument("missing low surrogate");
    -
    7426  }
    -
    7427 
    -
    7428  // get code yyyy from uxxxx\uyyyy
    -
    7429  auto codepoint2 = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>
    -
    7430  (i + 7), 4).c_str(), nullptr, 16);
    -
    7431  result += to_unicode(codepoint, codepoint2);
    -
    7432  // skip the next 10 characters (xxxx\uyyyy)
    -
    7433  i += 10;
    -
    7434  }
    -
    7435  else
    -
    7436  {
    -
    7437  // add unicode character(s)
    -
    7438  result += to_unicode(codepoint);
    -
    7439  // skip the next four characters (xxxx)
    -
    7440  i += 4;
    -
    7441  }
    -
    7442  break;
    -
    7443  }
    -
    7444  }
    -
    7445  }
    -
    7446  else
    -
    7447  {
    -
    7448  // all other characters are just copied to the end of the
    -
    7449  // string
    -
    7450  result.append(1, static_cast<typename string_t::value_type>(*i));
    -
    7451  }
    -
    7452  }
    -
    7453 
    -
    7454  return result;
    -
    7455  }
    -
    7456 
    -
    7474  long double get_number() const
    -
    7475  {
    -
    7476  // conversion
    -
    7477  typename string_t::value_type* endptr;
    -
    7478  const auto float_val = std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start),
    -
    7479  &endptr);
    -
    7480 
    -
    7481  // return float_val if the whole number was translated and NAN
    -
    7482  // otherwise
    -
    7483  return (reinterpret_cast<lexer_char_t*>(endptr) == m_cursor) ? float_val : NAN;
    -
    7484  }
    -
    7485 
    -
    7486  private:
    -
    7488  std::istream* m_stream;
    -
    7490  string_t m_buffer;
    -
    7492  const lexer_char_t* m_content = nullptr;
    -
    7494  const lexer_char_t* m_start = nullptr;
    -
    7496  const lexer_char_t* m_marker = nullptr;
    -
    7498  const lexer_char_t* m_cursor = nullptr;
    -
    7500  const lexer_char_t* m_limit = nullptr;
    -
    7501  };
    -
    7502 
    -
    7508  class parser
    -
    7509  {
    -
    7510  public:
    -
    7512  parser(const string_t& s, parser_callback_t cb = nullptr)
    -
    7513  : callback(cb), m_lexer(s)
    -
    7514  {
    -
    7515  // read first token
    -
    7516  get_token();
    -
    7517  }
    -
    7518 
    -
    7520  parser(std::istream& _is, parser_callback_t cb = nullptr)
    -
    7521  : callback(cb), m_lexer(&_is)
    -
    7522  {
    -
    7523  // read first token
    -
    7524  get_token();
    -
    7525  }
    -
    7526 
    -
    7528  basic_json parse()
    -
    7529  {
    -
    7530  basic_json result = parse_internal(true);
    -
    7531 
    -
    7532  expect(lexer::token_type::end_of_input);
    -
    7533 
    -
    7534  // return parser result and replace it with null in case the
    -
    7535  // top-level value was discarded by the callback function
    -
    7536  return result.is_discarded() ? basic_json() : result;
    -
    7537  }
    -
    7538 
    -
    7539  private:
    -
    7541  basic_json parse_internal(bool keep)
    -
    7542  {
    -
    7543  auto result = basic_json(value_t::discarded);
    -
    7544 
    -
    7545  switch (last_token)
    -
    7546  {
    -
    7547  case lexer::token_type::begin_object:
    -
    7548  {
    -
    7549  if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))
    -
    7550  {
    -
    7551  // explicitly set result to object to cope with {}
    -
    7552  result.m_type = value_t::object;
    -
    7553  result.m_value = json_value(value_t::object);
    -
    7554  }
    -
    7555 
    -
    7556  // read next token
    -
    7557  get_token();
    -
    7558 
    -
    7559  // closing } -> we are done
    -
    7560  if (last_token == lexer::token_type::end_object)
    -
    7561  {
    -
    7562  get_token();
    -
    7563  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
    -
    7564  {
    -
    7565  result = basic_json(value_t::discarded);
    -
    7566  }
    -
    7567  return result;
    -
    7568  }
    -
    7569 
    -
    7570  // no comma is expected here
    -
    7571  unexpect(lexer::token_type::value_separator);
    -
    7572 
    -
    7573  // otherwise: parse key-value pairs
    -
    7574  do
    -
    7575  {
    -
    7576  // ugly, but could be fixed with loop reorganization
    -
    7577  if (last_token == lexer::token_type::value_separator)
    -
    7578  {
    -
    7579  get_token();
    -
    7580  }
    -
    7581 
    -
    7582  // store key
    -
    7583  expect(lexer::token_type::value_string);
    -
    7584  const auto key = m_lexer.get_string();
    -
    7585 
    -
    7586  bool keep_tag = false;
    -
    7587  if (keep)
    -
    7588  {
    -
    7589  if (callback)
    -
    7590  {
    -
    7591  basic_json k(key);
    -
    7592  keep_tag = callback(depth, parse_event_t::key, k);
    -
    7593  }
    -
    7594  else
    -
    7595  {
    -
    7596  keep_tag = true;
    -
    7597  }
    -
    7598  }
    -
    7599 
    -
    7600  // parse separator (:)
    -
    7601  get_token();
    -
    7602  expect(lexer::token_type::name_separator);
    -
    7603 
    -
    7604  // parse and add value
    -
    7605  get_token();
    -
    7606  auto value = parse_internal(keep);
    -
    7607  if (keep and keep_tag and not value.is_discarded())
    -
    7608  {
    -
    7609  result[key] = std::move(value);
    -
    7610  }
    -
    7611  }
    -
    7612  while (last_token == lexer::token_type::value_separator);
    -
    7613 
    -
    7614  // closing }
    -
    7615  expect(lexer::token_type::end_object);
    -
    7616  get_token();
    -
    7617  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
    -
    7618  {
    -
    7619  result = basic_json(value_t::discarded);
    -
    7620  }
    -
    7621 
    -
    7622  return result;
    -
    7623  }
    -
    7624 
    -
    7625  case lexer::token_type::begin_array:
    -
    7626  {
    -
    7627  if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))
    -
    7628  {
    -
    7629  // explicitly set result to object to cope with []
    -
    7630  result.m_type = value_t::array;
    -
    7631  result.m_value = json_value(value_t::array);
    -
    7632  }
    -
    7633 
    -
    7634  // read next token
    -
    7635  get_token();
    -
    7636 
    -
    7637  // closing ] -> we are done
    -
    7638  if (last_token == lexer::token_type::end_array)
    -
    7639  {
    -
    7640  get_token();
    -
    7641  if (callback and not callback(--depth, parse_event_t::array_end, result))
    -
    7642  {
    -
    7643  result = basic_json(value_t::discarded);
    -
    7644  }
    -
    7645  return result;
    -
    7646  }
    -
    7647 
    -
    7648  // no comma is expected here
    -
    7649  unexpect(lexer::token_type::value_separator);
    -
    7650 
    -
    7651  // otherwise: parse values
    -
    7652  do
    -
    7653  {
    -
    7654  // ugly, but could be fixed with loop reorganization
    -
    7655  if (last_token == lexer::token_type::value_separator)
    -
    7656  {
    -
    7657  get_token();
    -
    7658  }
    -
    7659 
    -
    7660  // parse value
    -
    7661  auto value = parse_internal(keep);
    -
    7662  if (keep and not value.is_discarded())
    -
    7663  {
    -
    7664  result.push_back(std::move(value));
    -
    7665  }
    -
    7666  }
    -
    7667  while (last_token == lexer::token_type::value_separator);
    -
    7668 
    -
    7669  // closing ]
    -
    7670  expect(lexer::token_type::end_array);
    -
    7671  get_token();
    -
    7672  if (keep and callback and not callback(--depth, parse_event_t::array_end, result))
    -
    7673  {
    -
    7674  result = basic_json(value_t::discarded);
    -
    7675  }
    -
    7676 
    -
    7677  return result;
    -
    7678  }
    -
    7679 
    -
    7680  case lexer::token_type::literal_null:
    -
    7681  {
    -
    7682  get_token();
    -
    7683  result.m_type = value_t::null;
    -
    7684  break;
    -
    7685  }
    -
    7686 
    -
    7687  case lexer::token_type::value_string:
    -
    7688  {
    -
    7689  const auto s = m_lexer.get_string();
    -
    7690  get_token();
    -
    7691  result = basic_json(s);
    -
    7692  break;
    -
    7693  }
    -
    7694 
    -
    7695  case lexer::token_type::literal_true:
    -
    7696  {
    -
    7697  get_token();
    -
    7698  result.m_type = value_t::boolean;
    -
    7699  result.m_value = true;
    -
    7700  break;
    -
    7701  }
    -
    7702 
    -
    7703  case lexer::token_type::literal_false:
    -
    7704  {
    -
    7705  get_token();
    -
    7706  result.m_type = value_t::boolean;
    -
    7707  result.m_value = false;
    -
    7708  break;
    -
    7709  }
    -
    7710 
    -
    7711  case lexer::token_type::value_number:
    -
    7712  {
    -
    7713  auto float_val = m_lexer.get_number();
    -
    7714 
    -
    7715  // NAN is returned if token could not be translated
    -
    7716  // completely
    -
    7717  if (std::isnan(float_val))
    -
    7718  {
    -
    7719  throw std::invalid_argument(std::string("parse error - ") +
    -
    7720  m_lexer.get_token() + " is not a number");
    -
    7721  }
    -
    7722 
    -
    7723  get_token();
    -
    7724 
    -
    7725  // check if conversion loses precision
    -
    7726  const auto int_val = static_cast<number_integer_t>(float_val);
    -
    7727  if (approx(float_val, static_cast<long double>(int_val)))
    -
    7728  {
    -
    7729  // we would not lose precision -> return int
    -
    7730  result.m_type = value_t::number_integer;
    -
    7731  result.m_value = int_val;
    -
    7732  }
    -
    7733  else
    -
    7734  {
    -
    7735  // we would lose precision -> return float
    -
    7736  result.m_type = value_t::number_float;
    -
    7737  result.m_value = static_cast<number_float_t>(float_val);
    -
    7738  }
    -
    7739  break;
    -
    7740  }
    -
    7741 
    -
    7742  default:
    -
    7743  {
    -
    7744  // the last token was unexpected
    -
    7745  unexpect(last_token);
    -
    7746  }
    -
    7747  }
    -
    7748 
    -
    7749  if (keep and callback and not callback(depth, parse_event_t::value, result))
    -
    7750  {
    -
    7751  result = basic_json(value_t::discarded);
    -
    7752  }
    -
    7753  return result;
    -
    7754  }
    -
    7755 
    -
    7757  typename lexer::token_type get_token()
    -
    7758  {
    -
    7759  last_token = m_lexer.scan();
    -
    7760  return last_token;
    -
    7761  }
    -
    7762 
    -
    7763  void expect(typename lexer::token_type t) const
    -
    7764  {
    -
    7765  if (t != last_token)
    -
    7766  {
    -
    7767  std::string error_msg = "parse error - unexpected ";
    -
    7768  error_msg += (last_token == lexer::token_type::parse_error ? ("'" + m_lexer.get_token() + "'") :
    -
    7769  lexer::token_type_name(last_token));
    -
    7770  error_msg += "; expected " + lexer::token_type_name(t);
    -
    7771  throw std::invalid_argument(error_msg);
    -
    7772  }
    -
    7773  }
    -
    7774 
    -
    7775  void unexpect(typename lexer::token_type t) const
    -
    7776  {
    -
    7777  if (t == last_token)
    -
    7778  {
    -
    7779  std::string error_msg = "parse error - unexpected ";
    -
    7780  error_msg += (last_token == lexer::token_type::parse_error ? ("'" + m_lexer.get_token() + "'") :
    -
    7781  lexer::token_type_name(last_token));
    -
    7782  throw std::invalid_argument(error_msg);
    -
    7783  }
    -
    7784  }
    -
    7785 
    -
    7786  private:
    -
    7788  int depth = 0;
    -
    7790  parser_callback_t callback;
    -
    7792  typename lexer::token_type last_token = lexer::token_type::uninitialized;
    -
    7794  lexer m_lexer;
    -
    7795  };
    -
    7796 };
    -
    7797 
    -
    7798 
    -
    7800 // presets //
    -
    7802 
    - -
    7812 }
    -
    7813 
    -
    7814 
    -
    7816 // nonmember functions //
    -
    7818 
    -
    7819 // specialization of std::swap, and std::hash
    -
    7820 namespace std
    -
    7821 {
    -
    7827 template <>
    -
    7828 inline void swap(nlohmann::json& j1,
    -
    7829  nlohmann::json& j2) noexcept(
    -
    7830  is_nothrow_move_constructible<nlohmann::json>::value and
    -
    7831  is_nothrow_move_assignable<nlohmann::json>::value
    -
    7832  )
    -
    7833 {
    -
    7834  j1.swap(j2);
    -
    7835 }
    -
    7836 
    -
    7838 template <>
    -
    7839 struct hash<nlohmann::json>
    -
    7840 {
    -
    7846  std::size_t operator()(const nlohmann::json& j) const
    -
    7847  {
    -
    7848  // a naive hashing via the string representation
    -
    7849  const auto& h = hash<nlohmann::json::string_t>();
    -
    7850  return h(j.dump());
    -
    7851  }
    -
    7852 };
    -
    7853 }
    -
    7854 
    -
    7867 inline nlohmann::json operator "" _json(const char* s, std::size_t)
    -
    7868 {
    -
    7869  return nlohmann::json::parse(reinterpret_cast<nlohmann::json::string_t::value_type*>
    -
    7870  (const_cast<char*>(s)));
    -
    7871 }
    -
    7872 
    -
    7873 #endif
    -
    json_reverse_iterator< typename basic_json::iterator > reverse_iterator
    a reverse iterator for a basic_json container
    Definition: json.hpp:239
    -
    bool operator!=(const const_iterator &other) const
    comparison: not equal
    Definition: json.hpp:5886
    -
    iterator insert(const_iterator pos, basic_json &&val)
    inserts element
    Definition: json.hpp:4256
    -
    iterator operator++(int)
    post-increment (it++)
    Definition: json.hpp:6124
    -
    friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
    comparison: less than or equal
    Definition: json.hpp:4817
    -
    typename std::allocator_traits< allocator_type >::pointer pointer
    the type of an element pointer
    Definition: json.hpp:227
    -
    json_reverse_iterator operator-(difference_type i) const
    subtract from iterator
    Definition: json.hpp:6279
    -
    static basic_json object(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an object from an initializer list
    Definition: json.hpp:1507
    -
    const_reference operator[](size_type idx) const
    access specified array element
    Definition: json.hpp:2847
    -
    reference operator[](const T(&key)[n])
    access specified object element
    Definition: json.hpp:2977
    -
    typename basic_json::const_pointer pointer
    defines a pointer to the type iterated over (value_type)
    Definition: json.hpp:5588
    -
    static iteration_proxy< iterator > iterator_wrapper(reference cont)
    wrapper to access iterator member functions in range-based for
    Definition: json.hpp:3803
    -
    const_iterator & operator--()
    pre-decrement (–it)
    Definition: json.hpp:5831
    -
    friend std::istream & operator>>(std::istream &i, basic_json &j)
    deserialize from stream
    Definition: json.hpp:5030
    -
    const_iterator & operator=(const_iterator other) noexcept( std::is_nothrow_move_constructible< pointer >::value and std::is_nothrow_move_assignable< pointer >::value and std::is_nothrow_move_constructible< internal_iterator >::value and std::is_nothrow_move_assignable< internal_iterator >::value )
    copy assignment
    Definition: json.hpp:5653
    -
    typename basic_json::value_type value_type
    the type of the values when the iterator is dereferenced
    Definition: json.hpp:5584
    -
    reference & operator=(basic_json other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    copy assignment
    Definition: json.hpp:1771
    -
    iterator insert(const_iterator pos, const_iterator first, const_iterator last)
    inserts elements
    Definition: json.hpp:4337
    -
    iterator insert(const_iterator pos, size_type cnt, const basic_json &val)
    inserts elements
    Definition: json.hpp:4285
    -
    json_reverse_iterator operator--(int)
    post-decrement (it–)
    Definition: json.hpp:6251
    -
    StringType string_t
    a type for a string
    Definition: json.hpp:433
    -
    void push_back(const typename object_t::value_type &val)
    add an object to an object
    Definition: json.hpp:4179
    -
    basic_json(boolean_t val)
    create a boolean (explicit)
    Definition: json.hpp:1131
    -
    static basic_json array(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an array from an initializer list
    Definition: json.hpp:1467
    -
    iterator & operator++()
    pre-increment (++it)
    Definition: json.hpp:6132
    -
    friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
    comparison: not equal
    Definition: json.hpp:4695
    -
    ArrayType< basic_json, AllocatorType< basic_json >> array_t
    a type for an array
    Definition: json.hpp:386
    -
    const_iterator & operator++()
    pre-increment (++it)
    Definition: json.hpp:5796
    -
    difference_type operator-(const json_reverse_iterator &other) const
    return difference
    Definition: json.hpp:6287
    -
    basic_json<> json
    default JSON class
    Definition: json.hpp:7811
    -
    reference front()
    access the first element
    Definition: json.hpp:3143
    -
    bool is_array() const noexcept
    return whether value is an array
    Definition: json.hpp:2084
    -
    const_iterator find(typename object_t::key_type key) const
    find an element in a JSON object
    Definition: json.hpp:3516
    -
    std::reverse_iterator< Base > base_iterator
    shortcut to the reverse iterator adaptor
    Definition: json.hpp:6223
    -
    json_reverse_iterator(const typename base_iterator::iterator_type &it)
    create reverse iterator from iterator
    Definition: json.hpp:6228
    -
    a class to store JSON values
    Definition: json.hpp:187
    -
    json_reverse_iterator & operator--()
    pre-decrement (–it)
    Definition: json.hpp:6257
    -
    basic_json(const object_t &val)
    create an object (explicit)
    Definition: json.hpp:933
    -
    friend bool operator==(std::nullptr_t, const_reference v) noexcept
    comparison: equal
    Definition: json.hpp:4674
    -
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4095
    -
    const_iterator cbegin() const
    returns a const iterator to the first element
    Definition: json.hpp:3614
    -
    bool is_string() const noexcept
    return whether value is a string
    Definition: json.hpp:2103
    -
    iterator & operator+=(difference_type i)
    add to iterator
    Definition: json.hpp:6154
    -
    const PointerType get_ptr() const noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2542
    -
    basic_json(const CompatibleStringType &val)
    create a string (implicit)
    Definition: json.hpp:1113
    -
    the parser read ] and finished processing a JSON array
    -
    const_iterator base_iterator
    Definition: json.hpp:6082
    -
    reference operator+=(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4120
    -
    basic_json(size_type cnt, const basic_json &val)
    construct an array with count copies of given value
    Definition: json.hpp:1531
    -
    a mutable random access iterator for the basic_json class
    Definition: json.hpp:6079
    -
    iterator & operator-=(difference_type i)
    subtract from iterator
    Definition: json.hpp:6161
    -
    static basic_json parse(std::istream &&i, parser_callback_t cb=nullptr)
    deserialize from stream
    Definition: json.hpp:4992
    -
    reference operator[](const typename object_t::key_type &key)
    access specified object element
    Definition: json.hpp:2887
    +
    1 
    38 #ifndef NLOHMANN_JSON_HPP
    39 #define NLOHMANN_JSON_HPP
    40 
    41 #include <algorithm>
    42 #include <array>
    43 #include <cassert>
    44 #include <ciso646>
    45 #include <cmath>
    46 #include <cstdio>
    47 #include <functional>
    48 #include <initializer_list>
    49 #include <iomanip>
    50 #include <iostream>
    51 #include <iterator>
    52 #include <limits>
    53 #include <map>
    54 #include <memory>
    55 #include <sstream>
    56 #include <string>
    57 #include <type_traits>
    58 #include <utility>
    59 #include <vector>
    60 
    61 // enable ssize_t on MinGW
    62 #ifdef __GNUC__
    63  #ifdef __MINGW32__
    64  #include <sys/types.h>
    65  #endif
    66 #endif
    67 
    68 // enable ssize_t for MSVC
    69 #ifdef _MSC_VER
    70  #include <basetsd.h>
    71  using ssize_t = SSIZE_T;
    72 #endif
    73 
    79 namespace nlohmann
    80 {
    81 
    82 
    87 namespace
    88 {
    93 template<typename T>
    94 struct has_mapped_type
    95 {
    96  private:
    97  template<typename C> static char test(typename C::mapped_type*);
    98  template<typename C> static char (&test(...))[2];
    99  public:
    100  static constexpr bool value = sizeof(test<T>(0)) == 1;
    101 };
    102 
    104 template<typename T>
    105 static bool approx(const T a, const T b)
    106 {
    107  return not (a > b or a < b);
    108 }
    109 }
    110 
    179 template <
    180  template<typename U, typename V, typename... Args> class ObjectType = std::map,
    181  template<typename U, typename... Args> class ArrayType = std::vector,
    182  class StringType = std::string,
    183  class BooleanType = bool,
    184  class NumberIntegerType = int64_t,
    185  class NumberFloatType = double,
    186  template<typename U> class AllocatorType = std::allocator
    187  >
    189 {
    190  private:
    192  using basic_json_t = basic_json<ObjectType,
    193  ArrayType,
    194  StringType,
    195  BooleanType,
    196  NumberIntegerType,
    197  NumberFloatType,
    198  AllocatorType>;
    199 
    200  public:
    201 
    203  // container types //
    205 
    208 
    211 
    214 
    216  using const_reference = const value_type&;
    217 
    219  using difference_type = std::ptrdiff_t;
    220 
    222  using size_type = std::size_t;
    223 
    225  using allocator_type = AllocatorType<basic_json>;
    226 
    228  using pointer = typename std::allocator_traits<allocator_type>::pointer;
    230  using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer;
    231 
    232  // forward declaration
    233  template<typename Base> class json_reverse_iterator;
    234 
    236  class iterator;
    238  class const_iterator;
    243 
    245 
    246 
    251  {
    252  return allocator_type();
    253  }
    254 
    255 
    257  // JSON value data types //
    259 
    262 
    337  using object_t = ObjectType<StringType,
    338  basic_json,
    339  std::less<StringType>,
    340  AllocatorType<std::pair<const StringType,
    341  basic_json>>>;
    342 
    387  using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
    388 
    434  using string_t = StringType;
    435 
    460  using boolean_t = BooleanType;
    461 
    528  using number_integer_t = NumberIntegerType;
    529 
    593  using number_float_t = NumberFloatType;
    594 
    596 
    597 
    599  // JSON type enumeration //
    601 
    612  enum class value_t : uint8_t
    613  {
    614  null,
    615  object,
    616  array,
    617  string,
    618  boolean,
    619  number_integer,
    620  number_float,
    621  discarded
    622  };
    623 
    624 
    625  private:
    627  template<typename T, typename... Args>
    628  static T* create(Args&& ... args)
    629  {
    630  AllocatorType<T> alloc;
    631  auto deleter = [&](T * object)
    632  {
    633  alloc.deallocate(object, 1);
    634  };
    635  std::unique_ptr<T, decltype(deleter)> object(alloc.allocate(1), deleter);
    636  alloc.construct(object.get(), std::forward<Args>(args)...);
    637  return object.release();
    638  }
    639 
    641  // JSON value storage //
    643 
    651  union json_value
    652  {
    654  object_t* object;
    656  array_t* array;
    658  string_t* string;
    660  boolean_t boolean;
    662  number_integer_t number_integer;
    664  number_float_t number_float;
    665 
    667  json_value() noexcept = default;
    669  json_value(boolean_t v) noexcept : boolean(v) {}
    671  json_value(number_integer_t v) noexcept : number_integer(v) {}
    673  json_value(number_float_t v) noexcept : number_float(v) {}
    675  json_value(value_t t)
    676  {
    677  switch (t)
    678  {
    679  case value_t::object:
    680  {
    681  object = create<object_t>();
    682  break;
    683  }
    684 
    685  case value_t::array:
    686  {
    687  array = create<array_t>();
    688  break;
    689  }
    690 
    691  case value_t::string:
    692  {
    693  string = create<string_t>("");
    694  break;
    695  }
    696 
    697  case value_t::boolean:
    698  {
    699  boolean = boolean_t(false);
    700  break;
    701  }
    702 
    703  case value_t::number_integer:
    704  {
    705  number_integer = number_integer_t(0);
    706  break;
    707  }
    708 
    709  case value_t::number_float:
    710  {
    711  number_float = number_float_t(0.0);
    712  break;
    713  }
    714 
    715  default:
    716  {
    717  break;
    718  }
    719  }
    720  }
    721 
    723  json_value(const string_t& value)
    724  {
    725  string = create<string_t>(value);
    726  }
    727 
    729  json_value(const object_t& value)
    730  {
    731  object = create<object_t>(value);
    732  }
    733 
    735  json_value(const array_t& value)
    736  {
    737  array = create<array_t>(value);
    738  }
    739  };
    740 
    741 
    742  public:
    744  // JSON parser callback //
    746 
    755  enum class parse_event_t : uint8_t
    756  {
    758  object_start,
    760  object_end,
    762  array_start,
    764  array_end,
    766  key,
    768  value
    769  };
    770 
    820  using parser_callback_t = std::function<bool(int depth, parse_event_t event, basic_json& parsed)>;
    821 
    822 
    824  // constructors //
    826 
    829 
    868  : m_type(value_type), m_value(value_type)
    869  {}
    870 
    890  basic_json() noexcept = default;
    891 
    911  basic_json(std::nullptr_t) noexcept
    912  : basic_json(value_t::null)
    913  {}
    914 
    934  basic_json(const object_t& val)
    935  : m_type(value_t::object), m_value(val)
    936  {}
    937 
    961  template <class CompatibleObjectType, typename
    962  std::enable_if<
    963  std::is_constructible<typename object_t::key_type, typename CompatibleObjectType::key_type>::value and
    964  std::is_constructible<basic_json, typename CompatibleObjectType::mapped_type>::value, int>::type
    965  = 0>
    966  basic_json(const CompatibleObjectType& val)
    967  : m_type(value_t::object)
    968  {
    969  using std::begin;
    970  using std::end;
    971  m_value.object = create<object_t>(begin(val), end(val));
    972  }
    973 
    993  basic_json(const array_t& val)
    994  : m_type(value_t::array), m_value(val)
    995  {}
    996 
    1020  template <class CompatibleArrayType, typename
    1021  std::enable_if<
    1022  not std::is_same<CompatibleArrayType, typename basic_json_t::iterator>::value and
    1023  not std::is_same<CompatibleArrayType, typename basic_json_t::const_iterator>::value and
    1024  not std::is_same<CompatibleArrayType, typename basic_json_t::reverse_iterator>::value and
    1025  not std::is_same<CompatibleArrayType, typename basic_json_t::const_reverse_iterator>::value and
    1026  not std::is_same<CompatibleArrayType, typename array_t::iterator>::value and
    1027  not std::is_same<CompatibleArrayType, typename array_t::const_iterator>::value and
    1028  std::is_constructible<basic_json, typename CompatibleArrayType::value_type>::value, int>::type
    1029  = 0>
    1030  basic_json(const CompatibleArrayType& val)
    1031  : m_type(value_t::array)
    1032  {
    1033  using std::begin;
    1034  using std::end;
    1035  m_value.array = create<array_t>(begin(val), end(val));
    1036  }
    1037 
    1059  basic_json(const string_t& val)
    1060  : m_type(value_t::string), m_value(val)
    1061  {}
    1062 
    1083  basic_json(const typename string_t::value_type* val)
    1084  : basic_json(string_t(val))
    1085  {}
    1086 
    1110  template <class CompatibleStringType, typename
    1111  std::enable_if<
    1112  std::is_constructible<string_t, CompatibleStringType>::value, int>::type
    1113  = 0>
    1114  basic_json(const CompatibleStringType& val)
    1115  : basic_json(string_t(val))
    1116  {}
    1117 
    1133  : m_type(value_t::boolean), m_value(val)
    1134  {}
    1135 
    1161  template<typename T,
    1162  typename std::enable_if<
    1163  not (std::is_same<T, int>::value)
    1164  and std::is_same<T, number_integer_t>::value
    1165  , int>::type = 0>
    1167  : m_type(value_t::number_integer), m_value(val)
    1168  {}
    1169 
    1195  basic_json(const int val)
    1196  : m_type(value_t::number_integer),
    1197  m_value(static_cast<number_integer_t>(val))
    1198  {}
    1199 
    1225  template<typename CompatibleNumberIntegerType, typename
    1226  std::enable_if<
    1227  std::is_constructible<number_integer_t, CompatibleNumberIntegerType>::value and
    1228  std::numeric_limits<CompatibleNumberIntegerType>::is_integer, CompatibleNumberIntegerType>::type
    1229  = 0>
    1230  basic_json(const CompatibleNumberIntegerType val) noexcept
    1231  : m_type(value_t::number_integer),
    1232  m_value(static_cast<number_integer_t>(val))
    1233  {}
    1234 
    1260  : m_type(value_t::number_float), m_value(val)
    1261  {
    1262  // replace infinity and NAN by null
    1263  if (not std::isfinite(val))
    1264  {
    1265  m_type = value_t::null;
    1266  m_value = json_value();
    1267  }
    1268  }
    1269 
    1300  template<typename CompatibleNumberFloatType, typename = typename
    1301  std::enable_if<
    1302  std::is_constructible<number_float_t, CompatibleNumberFloatType>::value and
    1303  std::is_floating_point<CompatibleNumberFloatType>::value>::type
    1304  >
    1305  basic_json(const CompatibleNumberFloatType val) noexcept
    1306  : basic_json(number_float_t(val))
    1307  {}
    1308 
    1378  basic_json(std::initializer_list<basic_json> init,
    1379  bool type_deduction = true,
    1380  value_t manual_type = value_t::array)
    1381  {
    1382  // the initializer list could describe an object
    1383  bool is_an_object = true;
    1384 
    1385  // check if each element is an array with two elements whose first
    1386  // element is a string
    1387  for (const auto& element : init)
    1388  {
    1389  if (not element.is_array() or element.size() != 2
    1390  or not element[0].is_string())
    1391  {
    1392  // we found an element that makes it impossible to use the
    1393  // initializer list as object
    1394  is_an_object = false;
    1395  break;
    1396  }
    1397  }
    1398 
    1399  // adjust type if type deduction is not wanted
    1400  if (not type_deduction)
    1401  {
    1402  // if array is wanted, do not create an object though possible
    1403  if (manual_type == value_t::array)
    1404  {
    1405  is_an_object = false;
    1406  }
    1407 
    1408  // if object is wanted but impossible, throw an exception
    1409  if (manual_type == value_t::object and not is_an_object)
    1410  {
    1411  throw std::domain_error("cannot create object from initializer list");
    1412  }
    1413  }
    1414 
    1415  if (is_an_object)
    1416  {
    1417  // the initializer list is a list of pairs -> create object
    1418  m_type = value_t::object;
    1419  m_value = value_t::object;
    1420 
    1421  assert(m_value.object != nullptr);
    1422 
    1423  for (auto& element : init)
    1424  {
    1425  m_value.object->emplace(std::move(*(element[0].m_value.string)), std::move(element[1]));
    1426  }
    1427  }
    1428  else
    1429  {
    1430  // the initializer list describes an array -> create array
    1431  m_type = value_t::array;
    1432  m_value.array = create<array_t>(std::move(init));
    1433  }
    1434  }
    1435 
    1470  static basic_json array(std::initializer_list<basic_json> init =
    1471  std::initializer_list<basic_json>())
    1472  {
    1473  return basic_json(init, false, value_t::array);
    1474  }
    1475 
    1510  static basic_json object(std::initializer_list<basic_json> init =
    1511  std::initializer_list<basic_json>())
    1512  {
    1513  return basic_json(init, false, value_t::object);
    1514  }
    1515 
    1534  basic_json(size_type cnt, const basic_json& val)
    1535  : m_type(value_t::array)
    1536  {
    1537  m_value.array = create<array_t>(cnt, val);
    1538  }
    1539 
    1574  template <class InputIT, typename
    1575  std::enable_if<
    1576  std::is_same<InputIT, typename basic_json_t::iterator>::value or
    1577  std::is_same<InputIT, typename basic_json_t::const_iterator>::value
    1578  , int>::type
    1579  = 0>
    1580  basic_json(InputIT first, InputIT last) : m_type(first.m_object->m_type)
    1581  {
    1582  // make sure iterator fits the current value
    1583  if (first.m_object != last.m_object)
    1584  {
    1585  throw std::domain_error("iterators are not compatible");
    1586  }
    1587 
    1588  // check if iterator range is complete for primitive values
    1589  switch (m_type)
    1590  {
    1591  case value_t::boolean:
    1592  case value_t::number_float:
    1593  case value_t::number_integer:
    1594  case value_t::string:
    1595  {
    1596  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
    1597  {
    1598  throw std::out_of_range("iterators out of range");
    1599  }
    1600  break;
    1601  }
    1602 
    1603  default:
    1604  {
    1605  break;
    1606  }
    1607  }
    1608 
    1609  switch (m_type)
    1610  {
    1611  case value_t::number_integer:
    1612  {
    1613  assert(first.m_object != nullptr);
    1614  m_value.number_integer = first.m_object->m_value.number_integer;
    1615  break;
    1616  }
    1617 
    1618  case value_t::number_float:
    1619  {
    1620  assert(first.m_object != nullptr);
    1621  m_value.number_float = first.m_object->m_value.number_float;
    1622  break;
    1623  }
    1624 
    1625  case value_t::boolean:
    1626  {
    1627  assert(first.m_object != nullptr);
    1628  m_value.boolean = first.m_object->m_value.boolean;
    1629  break;
    1630  }
    1631 
    1632  case value_t::string:
    1633  {
    1634  assert(first.m_object != nullptr);
    1635  m_value = *first.m_object->m_value.string;
    1636  break;
    1637  }
    1638 
    1639  case value_t::object:
    1640  {
    1641  m_value.object = create<object_t>(first.m_it.object_iterator, last.m_it.object_iterator);
    1642  break;
    1643  }
    1644 
    1645  case value_t::array:
    1646  {
    1647  m_value.array = create<array_t>(first.m_it.array_iterator, last.m_it.array_iterator);
    1648  break;
    1649  }
    1650 
    1651  default:
    1652  {
    1653  assert(first.m_object != nullptr);
    1654  throw std::domain_error("cannot use construct with iterators from " + first.m_object->type_name());
    1655  }
    1656  }
    1657  }
    1658 
    1660  // other constructors and destructor //
    1662 
    1683  basic_json(const basic_json& other)
    1684  : m_type(other.m_type)
    1685  {
    1686  switch (m_type)
    1687  {
    1688  case value_t::object:
    1689  {
    1690  assert(other.m_value.object != nullptr);
    1691  m_value = *other.m_value.object;
    1692  break;
    1693  }
    1694 
    1695  case value_t::array:
    1696  {
    1697  assert(other.m_value.array != nullptr);
    1698  m_value = *other.m_value.array;
    1699  break;
    1700  }
    1701 
    1702  case value_t::string:
    1703  {
    1704  assert(other.m_value.string != nullptr);
    1705  m_value = *other.m_value.string;
    1706  break;
    1707  }
    1708 
    1709  case value_t::boolean:
    1710  {
    1711  m_value = other.m_value.boolean;
    1712  break;
    1713  }
    1714 
    1715  case value_t::number_integer:
    1716  {
    1717  m_value = other.m_value.number_integer;
    1718  break;
    1719  }
    1720 
    1721  case value_t::number_float:
    1722  {
    1723  m_value = other.m_value.number_float;
    1724  break;
    1725  }
    1726 
    1727  default:
    1728  {
    1729  break;
    1730  }
    1731  }
    1732  }
    1733 
    1752  basic_json(basic_json&& other) noexcept
    1753  : m_type(std::move(other.m_type)),
    1754  m_value(std::move(other.m_value))
    1755  {
    1756  // invalidate payload
    1757  other.m_type = value_t::null;
    1758  other.m_value = {};
    1759  }
    1760 
    1782  reference& operator=(basic_json other) noexcept (
    1783  std::is_nothrow_move_constructible<value_t>::value and
    1784  std::is_nothrow_move_assignable<value_t>::value and
    1785  std::is_nothrow_move_constructible<json_value>::value and
    1786  std::is_nothrow_move_assignable<json_value>::value
    1787  )
    1788  {
    1789  using std::swap;
    1790  swap(m_type, other.m_type);
    1791  swap(m_value, other.m_value);
    1792  return *this;
    1793  }
    1794 
    1809  {
    1810  switch (m_type)
    1811  {
    1812  case value_t::object:
    1813  {
    1814  AllocatorType<object_t> alloc;
    1815  alloc.destroy(m_value.object);
    1816  alloc.deallocate(m_value.object, 1);
    1817  break;
    1818  }
    1819 
    1820  case value_t::array:
    1821  {
    1822  AllocatorType<array_t> alloc;
    1823  alloc.destroy(m_value.array);
    1824  alloc.deallocate(m_value.array, 1);
    1825  break;
    1826  }
    1827 
    1828  case value_t::string:
    1829  {
    1830  AllocatorType<string_t> alloc;
    1831  alloc.destroy(m_value.string);
    1832  alloc.deallocate(m_value.string, 1);
    1833  break;
    1834  }
    1835 
    1836  default:
    1837  {
    1838  // all other types need no specific destructor
    1839  break;
    1840  }
    1841  }
    1842  }
    1843 
    1845 
    1846  public:
    1848  // object inspection //
    1850 
    1853 
    1877  string_t dump(const int indent = -1) const
    1878  {
    1879  std::stringstream ss;
    1880 
    1881  if (indent >= 0)
    1882  {
    1883  dump(ss, true, static_cast<unsigned int>(indent));
    1884  }
    1885  else
    1886  {
    1887  dump(ss, false, 0);
    1888  }
    1889 
    1890  return ss.str();
    1891  }
    1892 
    1908  value_t type() const noexcept
    1909  {
    1910  return m_type;
    1911  }
    1912 
    1929  bool is_primitive() const noexcept
    1930  {
    1931  return is_null() or is_string() or is_boolean() or is_number();
    1932  }
    1933 
    1949  bool is_structured() const noexcept
    1950  {
    1951  return is_array() or is_object();
    1952  }
    1953 
    1968  bool is_null() const noexcept
    1969  {
    1970  return m_type == value_t::null;
    1971  }
    1972 
    1987  bool is_boolean() const noexcept
    1988  {
    1989  return m_type == value_t::boolean;
    1990  }
    1991 
    2011  bool is_number() const noexcept
    2012  {
    2013  return is_number_integer() or is_number_float();
    2014  }
    2015 
    2034  bool is_number_integer() const noexcept
    2035  {
    2036  return m_type == value_t::number_integer;
    2037  }
    2038 
    2057  bool is_number_float() const noexcept
    2058  {
    2059  return m_type == value_t::number_float;
    2060  }
    2061 
    2076  bool is_object() const noexcept
    2077  {
    2078  return m_type == value_t::object;
    2079  }
    2080 
    2095  bool is_array() const noexcept
    2096  {
    2097  return m_type == value_t::array;
    2098  }
    2099 
    2114  bool is_string() const noexcept
    2115  {
    2116  return m_type == value_t::string;
    2117  }
    2118 
    2138  bool is_discarded() const noexcept
    2139  {
    2140  return m_type == value_t::discarded;
    2141  }
    2142 
    2158  operator value_t() const noexcept
    2159  {
    2160  return m_type;
    2161  }
    2162 
    2164 
    2165  private:
    2167  // value access //
    2169 
    2171  template <class T, typename
    2172  std::enable_if<
    2173  std::is_convertible<typename object_t::key_type, typename T::key_type>::value and
    2174  std::is_convertible<basic_json_t, typename T::mapped_type>::value
    2175  , int>::type = 0>
    2176  T get_impl(T*) const
    2177  {
    2178  if (is_object())
    2179  {
    2180  assert(m_value.object != nullptr);
    2181  return T(m_value.object->begin(), m_value.object->end());
    2182  }
    2183  else
    2184  {
    2185  throw std::domain_error("type must be object, but is " + type_name());
    2186  }
    2187  }
    2188 
    2190  object_t get_impl(object_t*) const
    2191  {
    2192  if (is_object())
    2193  {
    2194  assert(m_value.object != nullptr);
    2195  return *(m_value.object);
    2196  }
    2197  else
    2198  {
    2199  throw std::domain_error("type must be object, but is " + type_name());
    2200  }
    2201  }
    2202 
    2204  template <class T, typename
    2205  std::enable_if<
    2206  std::is_convertible<basic_json_t, typename T::value_type>::value and
    2207  not std::is_same<basic_json_t, typename T::value_type>::value and
    2208  not std::is_arithmetic<T>::value and
    2209  not std::is_convertible<std::string, T>::value and
    2210  not has_mapped_type<T>::value
    2211  , int>::type = 0>
    2212  T get_impl(T*) const
    2213  {
    2214  if (is_array())
    2215  {
    2216  T to_vector;
    2217  assert(m_value.array != nullptr);
    2218  std::transform(m_value.array->begin(), m_value.array->end(),
    2219  std::inserter(to_vector, to_vector.end()), [](basic_json i)
    2220  {
    2221  return i.get<typename T::value_type>();
    2222  });
    2223  return to_vector;
    2224  }
    2225  else
    2226  {
    2227  throw std::domain_error("type must be array, but is " + type_name());
    2228  }
    2229  }
    2230 
    2232  template <class T, typename
    2233  std::enable_if<
    2234  std::is_convertible<basic_json_t, T>::value and
    2235  not std::is_same<basic_json_t, T>::value
    2236  , int>::type = 0>
    2237  std::vector<T> get_impl(std::vector<T>*) const
    2238  {
    2239  if (is_array())
    2240  {
    2241  std::vector<T> to_vector;
    2242  assert(m_value.array != nullptr);
    2243  to_vector.reserve(m_value.array->size());
    2244  std::transform(m_value.array->begin(), m_value.array->end(),
    2245  std::inserter(to_vector, to_vector.end()), [](basic_json i)
    2246  {
    2247  return i.get<T>();
    2248  });
    2249  return to_vector;
    2250  }
    2251  else
    2252  {
    2253  throw std::domain_error("type must be array, but is " + type_name());
    2254  }
    2255  }
    2256 
    2258  template <class T, typename
    2259  std::enable_if<
    2260  std::is_same<basic_json, typename T::value_type>::value and
    2261  not has_mapped_type<T>::value
    2262  , int>::type = 0>
    2263  T get_impl(T*) const
    2264  {
    2265  if (is_array())
    2266  {
    2267  assert(m_value.array != nullptr);
    2268  return T(m_value.array->begin(), m_value.array->end());
    2269  }
    2270  else
    2271  {
    2272  throw std::domain_error("type must be array, but is " + type_name());
    2273  }
    2274  }
    2275 
    2277  array_t get_impl(array_t*) const
    2278  {
    2279  if (is_array())
    2280  {
    2281  assert(m_value.array != nullptr);
    2282  return *(m_value.array);
    2283  }
    2284  else
    2285  {
    2286  throw std::domain_error("type must be array, but is " + type_name());
    2287  }
    2288  }
    2289 
    2291  template <typename T, typename
    2292  std::enable_if<
    2293  std::is_convertible<string_t, T>::value
    2294  , int>::type = 0>
    2295  T get_impl(T*) const
    2296  {
    2297  if (is_string())
    2298  {
    2299  assert(m_value.string != nullptr);
    2300  return *m_value.string;
    2301  }
    2302  else
    2303  {
    2304  throw std::domain_error("type must be string, but is " + type_name());
    2305  }
    2306  }
    2307 
    2309  template<typename T, typename
    2310  std::enable_if<
    2311  std::is_arithmetic<T>::value
    2312  , int>::type = 0>
    2313  T get_impl(T*) const
    2314  {
    2315  switch (m_type)
    2316  {
    2317  case value_t::number_integer:
    2318  {
    2319  return static_cast<T>(m_value.number_integer);
    2320  }
    2321 
    2322  case value_t::number_float:
    2323  {
    2324  return static_cast<T>(m_value.number_float);
    2325  }
    2326 
    2327  default:
    2328  {
    2329  throw std::domain_error("type must be number, but is " + type_name());
    2330  }
    2331  }
    2332  }
    2333 
    2335  boolean_t get_impl(boolean_t*) const
    2336  {
    2337  if (is_boolean())
    2338  {
    2339  return m_value.boolean;
    2340  }
    2341  else
    2342  {
    2343  throw std::domain_error("type must be boolean, but is " + type_name());
    2344  }
    2345  }
    2346 
    2348  object_t* get_impl_ptr(object_t*) noexcept
    2349  {
    2350  return is_object() ? m_value.object : nullptr;
    2351  }
    2352 
    2354  const object_t* get_impl_ptr(const object_t*) const noexcept
    2355  {
    2356  return is_object() ? m_value.object : nullptr;
    2357  }
    2358 
    2360  array_t* get_impl_ptr(array_t*) noexcept
    2361  {
    2362  return is_array() ? m_value.array : nullptr;
    2363  }
    2364 
    2366  const array_t* get_impl_ptr(const array_t*) const noexcept
    2367  {
    2368  return is_array() ? m_value.array : nullptr;
    2369  }
    2370 
    2372  string_t* get_impl_ptr(string_t*) noexcept
    2373  {
    2374  return is_string() ? m_value.string : nullptr;
    2375  }
    2376 
    2378  const string_t* get_impl_ptr(const string_t*) const noexcept
    2379  {
    2380  return is_string() ? m_value.string : nullptr;
    2381  }
    2382 
    2384  boolean_t* get_impl_ptr(boolean_t*) noexcept
    2385  {
    2386  return is_boolean() ? &m_value.boolean : nullptr;
    2387  }
    2388 
    2390  const boolean_t* get_impl_ptr(const boolean_t*) const noexcept
    2391  {
    2392  return is_boolean() ? &m_value.boolean : nullptr;
    2393  }
    2394 
    2396  number_integer_t* get_impl_ptr(number_integer_t*) noexcept
    2397  {
    2398  return is_number_integer() ? &m_value.number_integer : nullptr;
    2399  }
    2400 
    2402  const number_integer_t* get_impl_ptr(const number_integer_t*) const noexcept
    2403  {
    2404  return is_number_integer() ? &m_value.number_integer : nullptr;
    2405  }
    2406 
    2408  number_float_t* get_impl_ptr(number_float_t*) noexcept
    2409  {
    2410  return is_number_float() ? &m_value.number_float : nullptr;
    2411  }
    2412 
    2414  const number_float_t* get_impl_ptr(const number_float_t*) const noexcept
    2415  {
    2416  return is_number_float() ? &m_value.number_float : nullptr;
    2417  }
    2418 
    2419  public:
    2420 
    2423 
    2457  template<typename ValueType, typename
    2458  std::enable_if<
    2459  not std::is_pointer<ValueType>::value
    2460  , int>::type = 0>
    2461  ValueType get() const
    2462  {
    2463  return get_impl(static_cast<ValueType*>(nullptr));
    2464  }
    2465 
    2492  template<typename PointerType, typename
    2493  std::enable_if<
    2494  std::is_pointer<PointerType>::value
    2495  , int>::type = 0>
    2496  PointerType get() noexcept
    2497  {
    2498  // delegate the call to get_ptr
    2499  return get_ptr<PointerType>();
    2500  }
    2501 
    2506  template<typename PointerType, typename
    2507  std::enable_if<
    2508  std::is_pointer<PointerType>::value
    2509  , int>::type = 0>
    2510  const PointerType get() const noexcept
    2511  {
    2512  // delegate the call to get_ptr
    2513  return get_ptr<PointerType>();
    2514  }
    2515 
    2541  template<typename PointerType, typename
    2542  std::enable_if<
    2543  std::is_pointer<PointerType>::value
    2544  , int>::type = 0>
    2545  PointerType get_ptr() noexcept
    2546  {
    2547  // delegate the call to get_impl_ptr<>()
    2548  return get_impl_ptr(static_cast<PointerType>(nullptr));
    2549  }
    2550 
    2555  template<typename PointerType, typename
    2556  std::enable_if<
    2557  std::is_pointer<PointerType>::value
    2558  and std::is_const<typename std::remove_pointer<PointerType>::type>::value
    2559  , int>::type = 0>
    2560  const PointerType get_ptr() const noexcept
    2561  {
    2562  // delegate the call to get_impl_ptr<>() const
    2563  return get_impl_ptr(static_cast<const PointerType>(nullptr));
    2564  }
    2565 
    2594  template<typename ValueType, typename
    2595  std::enable_if<
    2596  not std::is_pointer<ValueType>::value
    2597  and not std::is_same<ValueType, typename string_t::value_type>::value
    2598  and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
    2599  , int>::type = 0>
    2600  operator ValueType() const
    2601  {
    2602  // delegate the call to get<>() const
    2603  return get<ValueType>();
    2604  }
    2605 
    2607 
    2608 
    2610  // element access //
    2612 
    2615 
    2639  {
    2640  // at only works for arrays
    2641  if (is_array())
    2642  {
    2643  try
    2644  {
    2645  assert(m_value.array != nullptr);
    2646  return m_value.array->at(idx);
    2647  }
    2648  catch (std::out_of_range& e)
    2649  {
    2650  // create better exception explanation
    2651  throw std::out_of_range("array index " + std::to_string(idx) + " is out of range");
    2652  }
    2653  }
    2654  else
    2655  {
    2656  throw std::domain_error("cannot use at() with " + type_name());
    2657  }
    2658  }
    2659 
    2683  {
    2684  // at only works for arrays
    2685  if (is_array())
    2686  {
    2687  try
    2688  {
    2689  assert(m_value.array != nullptr);
    2690  return m_value.array->at(idx);
    2691  }
    2692  catch (std::out_of_range& e)
    2693  {
    2694  // create better exception explanation
    2695  throw std::out_of_range("array index " + std::to_string(idx) + " is out of range");
    2696  }
    2697  }
    2698  else
    2699  {
    2700  throw std::domain_error("cannot use at() with " + type_name());
    2701  }
    2702  }
    2703 
    2730  reference at(const typename object_t::key_type& key)
    2731  {
    2732  // at only works for objects
    2733  if (is_object())
    2734  {
    2735  try
    2736  {
    2737  assert(m_value.object != nullptr);
    2738  return m_value.object->at(key);
    2739  }
    2740  catch (std::out_of_range& e)
    2741  {
    2742  // create better exception explanation
    2743  throw std::out_of_range("key '" + key + "' not found");
    2744  }
    2745  }
    2746  else
    2747  {
    2748  throw std::domain_error("cannot use at() with " + type_name());
    2749  }
    2750  }
    2751 
    2778  const_reference at(const typename object_t::key_type& key) const
    2779  {
    2780  // at only works for objects
    2781  if (is_object())
    2782  {
    2783  try
    2784  {
    2785  assert(m_value.object != nullptr);
    2786  return m_value.object->at(key);
    2787  }
    2788  catch (std::out_of_range& e)
    2789  {
    2790  // create better exception explanation
    2791  throw std::out_of_range("key '" + key + "' not found");
    2792  }
    2793  }
    2794  else
    2795  {
    2796  throw std::domain_error("cannot use at() with " + type_name());
    2797  }
    2798  }
    2799 
    2826  {
    2827  // implicitly convert null to object
    2828  if (is_null())
    2829  {
    2830  m_type = value_t::array;
    2831  m_value.array = create<array_t>();
    2832  }
    2833 
    2834  // [] only works for arrays
    2835  if (is_array())
    2836  {
    2837  assert(m_value.array != nullptr);
    2838  for (size_t i = m_value.array->size(); i <= idx; ++i)
    2839  {
    2840  m_value.array->push_back(basic_json());
    2841  }
    2842 
    2843  return m_value.array->operator[](idx);
    2844  }
    2845  else
    2846  {
    2847  throw std::domain_error("cannot use operator[] with " + type_name());
    2848  }
    2849  }
    2850 
    2871  {
    2872  // at only works for arrays
    2873  if (is_array())
    2874  {
    2875  assert(m_value.array != nullptr);
    2876  return m_value.array->operator[](idx);
    2877  }
    2878  else
    2879  {
    2880  throw std::domain_error("cannot use operator[] with " + type_name());
    2881  }
    2882  }
    2883 
    2911  reference operator[](const typename object_t::key_type& key)
    2912  {
    2913  // implicitly convert null to object
    2914  if (is_null())
    2915  {
    2916  m_type = value_t::object;
    2917  m_value.object = create<object_t>();
    2918  }
    2919 
    2920  // [] only works for objects
    2921  if (is_object())
    2922  {
    2923  assert(m_value.object != nullptr);
    2924  return m_value.object->operator[](key);
    2925  }
    2926  else
    2927  {
    2928  throw std::domain_error("cannot use operator[] with " + type_name());
    2929  }
    2930  }
    2931 
    2959  const_reference operator[](const typename object_t::key_type& key) const
    2960  {
    2961  // [] only works for objects
    2962  if (is_object())
    2963  {
    2964  assert(m_value.object != nullptr);
    2965  assert(m_value.object->find(key) != m_value.object->end());
    2966  return m_value.object->find(key)->second;
    2967  }
    2968  else
    2969  {
    2970  throw std::domain_error("cannot use operator[] with " + type_name());
    2971  }
    2972  }
    2973 
    3003  template<typename T, std::size_t n>
    3004  reference operator[](const T (&key)[n])
    3005  {
    3006  // implicitly convert null to object
    3007  if (is_null())
    3008  {
    3009  m_type = value_t::object;
    3010  m_value = value_t::object;
    3011  }
    3012 
    3013  // at only works for objects
    3014  if (is_object())
    3015  {
    3016  assert(m_value.object != nullptr);
    3017  return m_value.object->operator[](key);
    3018  }
    3019  else
    3020  {
    3021  throw std::domain_error("cannot use operator[] with " + type_name());
    3022  }
    3023  }
    3024 
    3054  template<typename T, std::size_t n>
    3055  const_reference operator[](const T (&key)[n]) const
    3056  {
    3057  // at only works for objects
    3058  if (is_object())
    3059  {
    3060  assert(m_value.object != nullptr);
    3061  assert(m_value.object->find(key) != m_value.object->end());
    3062  return m_value.object->find(key)->second;
    3063  }
    3064  else
    3065  {
    3066  throw std::domain_error("cannot use operator[] with " + type_name());
    3067  }
    3068  }
    3069 
    3118  template <class ValueType, typename
    3119  std::enable_if<
    3120  std::is_convertible<basic_json_t, ValueType>::value
    3121  , int>::type = 0>
    3122  ValueType value(const typename object_t::key_type& key, ValueType default_value) const
    3123  {
    3124  // at only works for objects
    3125  if (is_object())
    3126  {
    3127  // if key is found, return value and given default value otherwise
    3128  const auto it = find(key);
    3129  if (it != end())
    3130  {
    3131  return *it;
    3132  }
    3133  else
    3134  {
    3135  return default_value;
    3136  }
    3137  }
    3138  else
    3139  {
    3140  throw std::domain_error("cannot use value() with " + type_name());
    3141  }
    3142  }
    3143 
    3148  string_t value(const typename object_t::key_type& key, const char* default_value) const
    3149  {
    3150  return value(key, string_t(default_value));
    3151  }
    3152 
    3174  {
    3175  return *begin();
    3176  }
    3177 
    3182  {
    3183  return *cbegin();
    3184  }
    3185 
    3208  {
    3209  auto tmp = end();
    3210  --tmp;
    3211  return *tmp;
    3212  }
    3213 
    3218  {
    3219  auto tmp = cend();
    3220  --tmp;
    3221  return *tmp;
    3222  }
    3223 
    3268  template <class InteratorType, typename
    3269  std::enable_if<
    3270  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
    3271  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
    3272  , int>::type
    3273  = 0>
    3274  InteratorType erase(InteratorType pos)
    3275  {
    3276  // make sure iterator fits the current value
    3277  if (this != pos.m_object)
    3278  {
    3279  throw std::domain_error("iterator does not fit current value");
    3280  }
    3281 
    3282  InteratorType result = end();
    3283 
    3284  switch (m_type)
    3285  {
    3286  case value_t::boolean:
    3287  case value_t::number_float:
    3288  case value_t::number_integer:
    3289  case value_t::string:
    3290  {
    3291  if (not pos.m_it.primitive_iterator.is_begin())
    3292  {
    3293  throw std::out_of_range("iterator out of range");
    3294  }
    3295 
    3296  if (is_string())
    3297  {
    3298  delete m_value.string;
    3299  m_value.string = nullptr;
    3300  }
    3301 
    3302  m_type = value_t::null;
    3303  break;
    3304  }
    3305 
    3306  case value_t::object:
    3307  {
    3308  assert(m_value.object != nullptr);
    3309  result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
    3310  break;
    3311  }
    3312 
    3313  case value_t::array:
    3314  {
    3315  assert(m_value.array != nullptr);
    3316  result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
    3317  break;
    3318  }
    3319 
    3320  default:
    3321  {
    3322  throw std::domain_error("cannot use erase() with " + type_name());
    3323  }
    3324  }
    3325 
    3326  return result;
    3327  }
    3328 
    3373  template <class InteratorType, typename
    3374  std::enable_if<
    3375  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
    3376  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
    3377  , int>::type
    3378  = 0>
    3379  InteratorType erase(InteratorType first, InteratorType last)
    3380  {
    3381  // make sure iterator fits the current value
    3382  if (this != first.m_object or this != last.m_object)
    3383  {
    3384  throw std::domain_error("iterators do not fit current value");
    3385  }
    3386 
    3387  InteratorType result = end();
    3388 
    3389  switch (m_type)
    3390  {
    3391  case value_t::boolean:
    3392  case value_t::number_float:
    3393  case value_t::number_integer:
    3394  case value_t::string:
    3395  {
    3396  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
    3397  {
    3398  throw std::out_of_range("iterators out of range");
    3399  }
    3400 
    3401  if (is_string())
    3402  {
    3403  delete m_value.string;
    3404  m_value.string = nullptr;
    3405  }
    3406 
    3407  m_type = value_t::null;
    3408  break;
    3409  }
    3410 
    3411  case value_t::object:
    3412  {
    3413  assert(m_value.object != nullptr);
    3414  result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
    3415  last.m_it.object_iterator);
    3416  break;
    3417  }
    3418 
    3419  case value_t::array:
    3420  {
    3421  assert(m_value.array != nullptr);
    3422  result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,
    3423  last.m_it.array_iterator);
    3424  break;
    3425  }
    3426 
    3427  default:
    3428  {
    3429  throw std::domain_error("cannot use erase() with " + type_name());
    3430  }
    3431  }
    3432 
    3433  return result;
    3434  }
    3435 
    3462  size_type erase(const typename object_t::key_type& key)
    3463  {
    3464  // this erase only works for objects
    3465  if (is_object())
    3466  {
    3467  assert(m_value.object != nullptr);
    3468  return m_value.object->erase(key);
    3469  }
    3470  else
    3471  {
    3472  throw std::domain_error("cannot use erase() with " + type_name());
    3473  }
    3474  }
    3475 
    3500  void erase(const size_type idx)
    3501  {
    3502  // this erase only works for arrays
    3503  if (is_array())
    3504  {
    3505  if (idx >= size())
    3506  {
    3507  throw std::out_of_range("index out of range");
    3508  }
    3509 
    3510  assert(m_value.array != nullptr);
    3511  m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));
    3512  }
    3513  else
    3514  {
    3515  throw std::domain_error("cannot use erase() with " + type_name());
    3516  }
    3517  }
    3518 
    3536  iterator find(typename object_t::key_type key)
    3537  {
    3538  auto result = end();
    3539 
    3540  if (is_object())
    3541  {
    3542  assert(m_value.object != nullptr);
    3543  result.m_it.object_iterator = m_value.object->find(key);
    3544  }
    3545 
    3546  return result;
    3547  }
    3548 
    3553  const_iterator find(typename object_t::key_type key) const
    3554  {
    3555  auto result = cend();
    3556 
    3557  if (is_object())
    3558  {
    3559  assert(m_value.object != nullptr);
    3560  result.m_it.object_iterator = m_value.object->find(key);
    3561  }
    3562 
    3563  return result;
    3564  }
    3565 
    3584  size_type count(typename object_t::key_type key) const
    3585  {
    3586  // return 0 for all nonobject types
    3587  assert(not is_object() or m_value.object != nullptr);
    3588  return is_object() ? m_value.object->count(key) : 0;
    3589  }
    3590 
    3592 
    3593 
    3595  // iterators //
    3597 
    3600 
    3620  {
    3621  iterator result(this);
    3622  result.set_begin();
    3623  return result;
    3624  }
    3625 
    3630  {
    3631  return cbegin();
    3632  }
    3633 
    3654  {
    3655  const_iterator result(this);
    3656  result.set_begin();
    3657  return result;
    3658  }
    3659 
    3679  {
    3680  iterator result(this);
    3681  result.set_end();
    3682  return result;
    3683  }
    3684 
    3689  {
    3690  return cend();
    3691  }
    3692 
    3713  {
    3714  const_iterator result(this);
    3715  result.set_end();
    3716  return result;
    3717  }
    3718 
    3737  {
    3738  return reverse_iterator(end());
    3739  }
    3740 
    3745  {
    3746  return crbegin();
    3747  }
    3748 
    3768  {
    3769  return reverse_iterator(begin());
    3770  }
    3771 
    3776  {
    3777  return crend();
    3778  }
    3779 
    3799  {
    3800  return const_reverse_iterator(cend());
    3801  }
    3802 
    3822  {
    3823  return const_reverse_iterator(cbegin());
    3824  }
    3825 
    3826  private:
    3827  // forward declaration
    3828  template<typename IteratorType> class iteration_proxy;
    3829 
    3830  public:
    3842  static iteration_proxy<iterator> iterator_wrapper(reference cont)
    3843  {
    3844  return iteration_proxy<iterator>(cont);
    3845  }
    3846 
    3850  static iteration_proxy<const_iterator> iterator_wrapper(const_reference cont)
    3851  {
    3852  return iteration_proxy<const_iterator>(cont);
    3853  }
    3854 
    3856 
    3857 
    3859  // capacity //
    3861 
    3864 
    3894  bool empty() const noexcept
    3895  {
    3896  switch (m_type)
    3897  {
    3898  case value_t::null:
    3899  {
    3900  // null values are empty
    3901  return true;
    3902  }
    3903 
    3904  case value_t::array:
    3905  {
    3906  assert(m_value.array != nullptr);
    3907  return m_value.array->empty();
    3908  }
    3909 
    3910  case value_t::object:
    3911  {
    3912  assert(m_value.object != nullptr);
    3913  return m_value.object->empty();
    3914  }
    3915 
    3916  default:
    3917  {
    3918  // all other types are nonempty
    3919  return false;
    3920  }
    3921  }
    3922  }
    3923 
    3952  size_type size() const noexcept
    3953  {
    3954  switch (m_type)
    3955  {
    3956  case value_t::null:
    3957  {
    3958  // null values are empty
    3959  return 0;
    3960  }
    3961 
    3962  case value_t::array:
    3963  {
    3964  assert(m_value.array != nullptr);
    3965  return m_value.array->size();
    3966  }
    3967 
    3968  case value_t::object:
    3969  {
    3970  assert(m_value.object != nullptr);
    3971  return m_value.object->size();
    3972  }
    3973 
    3974  default:
    3975  {
    3976  // all other types have size 1
    3977  return 1;
    3978  }
    3979  }
    3980  }
    3981 
    4014  size_type max_size() const noexcept
    4015  {
    4016  switch (m_type)
    4017  {
    4018  case value_t::array:
    4019  {
    4020  assert(m_value.array != nullptr);
    4021  return m_value.array->max_size();
    4022  }
    4023 
    4024  case value_t::object:
    4025  {
    4026  assert(m_value.object != nullptr);
    4027  return m_value.object->max_size();
    4028  }
    4029 
    4030  default:
    4031  {
    4032  // all other types have max_size() == size()
    4033  return size();
    4034  }
    4035  }
    4036  }
    4037 
    4039 
    4040 
    4042  // modifiers //
    4044 
    4047 
    4073  void clear() noexcept
    4074  {
    4075  switch (m_type)
    4076  {
    4077  case value_t::number_integer:
    4078  {
    4079  m_value.number_integer = 0;
    4080  break;
    4081  }
    4082 
    4083  case value_t::number_float:
    4084  {
    4085  m_value.number_float = 0.0;
    4086  break;
    4087  }
    4088 
    4089  case value_t::boolean:
    4090  {
    4091  m_value.boolean = false;
    4092  break;
    4093  }
    4094 
    4095  case value_t::string:
    4096  {
    4097  assert(m_value.string != nullptr);
    4098  m_value.string->clear();
    4099  break;
    4100  }
    4101 
    4102  case value_t::array:
    4103  {
    4104  assert(m_value.array != nullptr);
    4105  m_value.array->clear();
    4106  break;
    4107  }
    4108 
    4109  case value_t::object:
    4110  {
    4111  assert(m_value.object != nullptr);
    4112  m_value.object->clear();
    4113  break;
    4114  }
    4115 
    4116  default:
    4117  {
    4118  break;
    4119  }
    4120  }
    4121  }
    4122 
    4143  void push_back(basic_json&& val)
    4144  {
    4145  // push_back only works for null objects or arrays
    4146  if (not(is_null() or is_array()))
    4147  {
    4148  throw std::domain_error("cannot use push_back() with " + type_name());
    4149  }
    4150 
    4151  // transform null object into an array
    4152  if (is_null())
    4153  {
    4154  m_type = value_t::array;
    4155  m_value = value_t::array;
    4156  }
    4157 
    4158  // add element to array (move semantics)
    4159  assert(m_value.array != nullptr);
    4160  m_value.array->push_back(std::move(val));
    4161  // invalidate object
    4162  val.m_type = value_t::null;
    4163  }
    4164 
    4169  reference operator+=(basic_json&& val)
    4170  {
    4171  push_back(std::move(val));
    4172  return *this;
    4173  }
    4174 
    4179  void push_back(const basic_json& val)
    4180  {
    4181  // push_back only works for null objects or arrays
    4182  if (not(is_null() or is_array()))
    4183  {
    4184  throw std::domain_error("cannot use push_back() with " + type_name());
    4185  }
    4186 
    4187  // transform null object into an array
    4188  if (is_null())
    4189  {
    4190  m_type = value_t::array;
    4191  m_value = value_t::array;
    4192  }
    4193 
    4194  // add element to array
    4195  assert(m_value.array != nullptr);
    4196  m_value.array->push_back(val);
    4197  }
    4198 
    4203  reference operator+=(const basic_json& val)
    4204  {
    4205  push_back(val);
    4206  return *this;
    4207  }
    4208 
    4229  void push_back(const typename object_t::value_type& val)
    4230  {
    4231  // push_back only works for null objects or objects
    4232  if (not(is_null() or is_object()))
    4233  {
    4234  throw std::domain_error("cannot use push_back() with " + type_name());
    4235  }
    4236 
    4237  // transform null object into an object
    4238  if (is_null())
    4239  {
    4240  m_type = value_t::object;
    4241  m_value = value_t::object;
    4242  }
    4243 
    4244  // add element to array
    4245  assert(m_value.object != nullptr);
    4246  m_value.object->insert(val);
    4247  }
    4248 
    4253  reference operator+=(const typename object_t::value_type& val)
    4254  {
    4255  push_back(val);
    4256  return operator[](val.first);
    4257  }
    4258 
    4281  iterator insert(const_iterator pos, const basic_json& val)
    4282  {
    4283  // insert only works for arrays
    4284  if (is_array())
    4285  {
    4286  // check if iterator pos fits to this JSON value
    4287  if (pos.m_object != this)
    4288  {
    4289  throw std::domain_error("iterator does not fit current value");
    4290  }
    4291 
    4292  // insert to array and return iterator
    4293  iterator result(this);
    4294  assert(m_value.array != nullptr);
    4295  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, val);
    4296  return result;
    4297  }
    4298  else
    4299  {
    4300  throw std::domain_error("cannot use insert() with " + type_name());
    4301  }
    4302  }
    4303 
    4308  iterator insert(const_iterator pos, basic_json&& val)
    4309  {
    4310  return insert(pos, val);
    4311  }
    4312 
    4337  iterator insert(const_iterator pos, size_type cnt, const basic_json& val)
    4338  {
    4339  // insert only works for arrays
    4340  if (is_array())
    4341  {
    4342  // check if iterator pos fits to this JSON value
    4343  if (pos.m_object != this)
    4344  {
    4345  throw std::domain_error("iterator does not fit current value");
    4346  }
    4347 
    4348  // insert to array and return iterator
    4349  iterator result(this);
    4350  assert(m_value.array != nullptr);
    4351  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
    4352  return result;
    4353  }
    4354  else
    4355  {
    4356  throw std::domain_error("cannot use insert() with " + type_name());
    4357  }
    4358  }
    4359 
    4391  {
    4392  // insert only works for arrays
    4393  if (not is_array())
    4394  {
    4395  throw std::domain_error("cannot use insert() with " + type_name());
    4396  }
    4397 
    4398  // check if iterator pos fits to this JSON value
    4399  if (pos.m_object != this)
    4400  {
    4401  throw std::domain_error("iterator does not fit current value");
    4402  }
    4403 
    4404  if (first.m_object != last.m_object)
    4405  {
    4406  throw std::domain_error("iterators do not fit");
    4407  }
    4408 
    4409  if (first.m_object == this or last.m_object == this)
    4410  {
    4411  throw std::domain_error("passed iterators may not belong to container");
    4412  }
    4413 
    4414  // insert to array and return iterator
    4415  iterator result(this);
    4416  assert(m_value.array != nullptr);
    4417  result.m_it.array_iterator = m_value.array->insert(
    4418  pos.m_it.array_iterator,
    4419  first.m_it.array_iterator,
    4420  last.m_it.array_iterator);
    4421  return result;
    4422  }
    4423 
    4448  iterator insert(const_iterator pos, std::initializer_list<basic_json> ilist)
    4449  {
    4450  // insert only works for arrays
    4451  if (not is_array())
    4452  {
    4453  throw std::domain_error("cannot use insert() with " + type_name());
    4454  }
    4455 
    4456  // check if iterator pos fits to this JSON value
    4457  if (pos.m_object != this)
    4458  {
    4459  throw std::domain_error("iterator does not fit current value");
    4460  }
    4461 
    4462  // insert to array and return iterator
    4463  iterator result(this);
    4464  assert(m_value.array != nullptr);
    4465  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
    4466  return result;
    4467  }
    4468 
    4486  void swap(reference other) noexcept (
    4487  std::is_nothrow_move_constructible<value_t>::value and
    4488  std::is_nothrow_move_assignable<value_t>::value and
    4489  std::is_nothrow_move_constructible<json_value>::value and
    4490  std::is_nothrow_move_assignable<json_value>::value
    4491  )
    4492  {
    4493  std::swap(m_type, other.m_type);
    4494  std::swap(m_value, other.m_value);
    4495  }
    4496 
    4517  void swap(array_t& other)
    4518  {
    4519  // swap only works for arrays
    4520  if (is_array())
    4521  {
    4522  assert(m_value.array != nullptr);
    4523  std::swap(*(m_value.array), other);
    4524  }
    4525  else
    4526  {
    4527  throw std::domain_error("cannot use swap() with " + type_name());
    4528  }
    4529  }
    4530 
    4551  void swap(object_t& other)
    4552  {
    4553  // swap only works for objects
    4554  if (is_object())
    4555  {
    4556  assert(m_value.object != nullptr);
    4557  std::swap(*(m_value.object), other);
    4558  }
    4559  else
    4560  {
    4561  throw std::domain_error("cannot use swap() with " + type_name());
    4562  }
    4563  }
    4564 
    4585  void swap(string_t& other)
    4586  {
    4587  // swap only works for strings
    4588  if (is_string())
    4589  {
    4590  assert(m_value.string != nullptr);
    4591  std::swap(*(m_value.string), other);
    4592  }
    4593  else
    4594  {
    4595  throw std::domain_error("cannot use swap() with " + type_name());
    4596  }
    4597  }
    4598 
    4600 
    4601 
    4603  // lexicographical comparison operators //
    4605 
    4608 
    4609  private:
    4619  friend bool operator<(const value_t lhs, const value_t rhs)
    4620  {
    4621  static constexpr std::array<uint8_t, 7> order = {{
    4622  0, // null
    4623  3, // object
    4624  4, // array
    4625  5, // string
    4626  1, // boolean
    4627  2, // integer
    4628  2 // float
    4629  }
    4630  };
    4631 
    4632  // discarded values are not comparable
    4633  if (lhs == value_t::discarded or rhs == value_t::discarded)
    4634  {
    4635  return false;
    4636  }
    4637 
    4638  return order[static_cast<std::size_t>(lhs)] < order[static_cast<std::size_t>(rhs)];
    4639  }
    4640 
    4641  public:
    4665  friend bool operator==(const_reference lhs, const_reference rhs) noexcept
    4666  {
    4667  const auto lhs_type = lhs.type();
    4668  const auto rhs_type = rhs.type();
    4669 
    4670  if (lhs_type == rhs_type)
    4671  {
    4672  switch (lhs_type)
    4673  {
    4674  case value_t::array:
    4675  {
    4676  assert(lhs.m_value.array != nullptr);
    4677  assert(rhs.m_value.array != nullptr);
    4678  return *lhs.m_value.array == *rhs.m_value.array;
    4679  }
    4680  case value_t::object:
    4681  {
    4682  assert(lhs.m_value.object != nullptr);
    4683  assert(rhs.m_value.object != nullptr);
    4684  return *lhs.m_value.object == *rhs.m_value.object;
    4685  }
    4686  case value_t::null:
    4687  {
    4688  return true;
    4689  }
    4690  case value_t::string:
    4691  {
    4692  assert(lhs.m_value.string != nullptr);
    4693  assert(rhs.m_value.string != nullptr);
    4694  return *lhs.m_value.string == *rhs.m_value.string;
    4695  }
    4696  case value_t::boolean:
    4697  {
    4698  return lhs.m_value.boolean == rhs.m_value.boolean;
    4699  }
    4700  case value_t::number_integer:
    4701  {
    4702  return lhs.m_value.number_integer == rhs.m_value.number_integer;
    4703  }
    4704  case value_t::number_float:
    4705  {
    4706  return approx(lhs.m_value.number_float, rhs.m_value.number_float);
    4707  }
    4708  default:
    4709  {
    4710  return false;
    4711  }
    4712  }
    4713  }
    4714  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
    4715  {
    4716  return approx(static_cast<number_float_t>(lhs.m_value.number_integer),
    4717  rhs.m_value.number_float);
    4718  }
    4719  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
    4720  {
    4721  return approx(lhs.m_value.number_float,
    4722  static_cast<number_float_t>(rhs.m_value.number_integer));
    4723  }
    4724  return false;
    4725  }
    4726 
    4745  friend bool operator==(const_reference v, std::nullptr_t) noexcept
    4746  {
    4747  return v.is_null();
    4748  }
    4749 
    4754  friend bool operator==(std::nullptr_t, const_reference v) noexcept
    4755  {
    4756  return v.is_null();
    4757  }
    4758 
    4775  friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
    4776  {
    4777  return not (lhs == rhs);
    4778  }
    4779 
    4798  friend bool operator!=(const_reference v, std::nullptr_t) noexcept
    4799  {
    4800  return not v.is_null();
    4801  }
    4802 
    4807  friend bool operator!=(std::nullptr_t, const_reference v) noexcept
    4808  {
    4809  return not v.is_null();
    4810  }
    4811 
    4836  friend bool operator<(const_reference lhs, const_reference rhs) noexcept
    4837  {
    4838  const auto lhs_type = lhs.type();
    4839  const auto rhs_type = rhs.type();
    4840 
    4841  if (lhs_type == rhs_type)
    4842  {
    4843  switch (lhs_type)
    4844  {
    4845  case value_t::array:
    4846  {
    4847  assert(lhs.m_value.array != nullptr);
    4848  assert(rhs.m_value.array != nullptr);
    4849  return *lhs.m_value.array < *rhs.m_value.array;
    4850  }
    4851  case value_t::object:
    4852  {
    4853  assert(lhs.m_value.object != nullptr);
    4854  assert(rhs.m_value.object != nullptr);
    4855  return *lhs.m_value.object < *rhs.m_value.object;
    4856  }
    4857  case value_t::null:
    4858  {
    4859  return false;
    4860  }
    4861  case value_t::string:
    4862  {
    4863  assert(lhs.m_value.string != nullptr);
    4864  assert(rhs.m_value.string != nullptr);
    4865  return *lhs.m_value.string < *rhs.m_value.string;
    4866  }
    4867  case value_t::boolean:
    4868  {
    4869  return lhs.m_value.boolean < rhs.m_value.boolean;
    4870  }
    4871  case value_t::number_integer:
    4872  {
    4873  return lhs.m_value.number_integer < rhs.m_value.number_integer;
    4874  }
    4875  case value_t::number_float:
    4876  {
    4877  return lhs.m_value.number_float < rhs.m_value.number_float;
    4878  }
    4879  default:
    4880  {
    4881  return false;
    4882  }
    4883  }
    4884  }
    4885  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
    4886  {
    4887  return static_cast<number_float_t>(lhs.m_value.number_integer) <
    4888  rhs.m_value.number_float;
    4889  }
    4890  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
    4891  {
    4892  return lhs.m_value.number_float <
    4893  static_cast<number_float_t>(rhs.m_value.number_integer);
    4894  }
    4895 
    4896  // We only reach this line if we cannot compare values. In that case,
    4897  // we compare types. Note we have to call the operator explicitly,
    4898  // because MSVC has problems otherwise.
    4899  return operator<(lhs_type, rhs_type);
    4900  }
    4901 
    4919  friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
    4920  {
    4921  return not (rhs < lhs);
    4922  }
    4923 
    4941  friend bool operator>(const_reference lhs, const_reference rhs) noexcept
    4942  {
    4943  return not (lhs <= rhs);
    4944  }
    4945 
    4963  friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
    4964  {
    4965  return not (lhs < rhs);
    4966  }
    4967 
    4969 
    4970 
    4972  // serialization //
    4974 
    4977 
    5000  friend std::ostream& operator<<(std::ostream& o, const basic_json& j)
    5001  {
    5002  // read width member and use it as indentation parameter if nonzero
    5003  const bool pretty_print = (o.width() > 0);
    5004  const auto indentation = (pretty_print ? o.width() : 0);
    5005 
    5006  // reset width to 0 for subsequent calls to this stream
    5007  o.width(0);
    5008 
    5009  // do the actual serialization
    5010  j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
    5011  return o;
    5012  }
    5013 
    5018  friend std::ostream& operator>>(const basic_json& j, std::ostream& o)
    5019  {
    5020  return o << j;
    5021  }
    5022 
    5024 
    5025 
    5027  // deserialization //
    5029 
    5032 
    5057  static basic_json parse(const string_t& s, parser_callback_t cb = nullptr)
    5058  {
    5059  return parser(s, cb).parse();
    5060  }
    5061 
    5086  static basic_json parse(std::istream& i, parser_callback_t cb = nullptr)
    5087  {
    5088  return parser(i, cb).parse();
    5089  }
    5090 
    5094  static basic_json parse(std::istream&& i, parser_callback_t cb = nullptr)
    5095  {
    5096  return parser(i, cb).parse();
    5097  }
    5098 
    5122  friend std::istream& operator<<(basic_json& j, std::istream& i)
    5123  {
    5124  j = parser(i).parse();
    5125  return i;
    5126  }
    5127 
    5132  friend std::istream& operator>>(std::istream& i, basic_json& j)
    5133  {
    5134  j = parser(i).parse();
    5135  return i;
    5136  }
    5137 
    5139 
    5140 
    5141  private:
    5143  // convenience functions //
    5145 
    5147  string_t type_name() const
    5148  {
    5149  switch (m_type)
    5150  {
    5151  case value_t::null:
    5152  return "null";
    5153  case value_t::object:
    5154  return "object";
    5155  case value_t::array:
    5156  return "array";
    5157  case value_t::string:
    5158  return "string";
    5159  case value_t::boolean:
    5160  return "boolean";
    5161  case value_t::discarded:
    5162  return "discarded";
    5163  default:
    5164  return "number";
    5165  }
    5166  }
    5167 
    5176  static std::size_t extra_space(const string_t& s) noexcept
    5177  {
    5178  std::size_t result = 0;
    5179 
    5180  for (const auto& c : s)
    5181  {
    5182  switch (c)
    5183  {
    5184  case '"':
    5185  case '\\':
    5186  case '\b':
    5187  case '\f':
    5188  case '\n':
    5189  case '\r':
    5190  case '\t':
    5191  {
    5192  // from c (1 byte) to \x (2 bytes)
    5193  result += 1;
    5194  break;
    5195  }
    5196 
    5197  default:
    5198  {
    5199  if (c >= 0x00 and c <= 0x1f)
    5200  {
    5201  // from c (1 byte) to \uxxxx (6 bytes)
    5202  result += 5;
    5203  }
    5204  break;
    5205  }
    5206  }
    5207  }
    5208 
    5209  return result;
    5210  }
    5211 
    5225  static string_t escape_string(const string_t& s) noexcept
    5226  {
    5227  const auto space = extra_space(s);
    5228  if (space == 0)
    5229  {
    5230  return s;
    5231  }
    5232 
    5233  // create a result string of necessary size
    5234  string_t result(s.size() + space, '\\');
    5235  std::size_t pos = 0;
    5236 
    5237  for (const auto& c : s)
    5238  {
    5239  switch (c)
    5240  {
    5241  // quotation mark (0x22)
    5242  case '"':
    5243  {
    5244  result[pos + 1] = '"';
    5245  pos += 2;
    5246  break;
    5247  }
    5248 
    5249  // reverse solidus (0x5c)
    5250  case '\\':
    5251  {
    5252  // nothing to change
    5253  pos += 2;
    5254  break;
    5255  }
    5256 
    5257  // backspace (0x08)
    5258  case '\b':
    5259  {
    5260  result[pos + 1] = 'b';
    5261  pos += 2;
    5262  break;
    5263  }
    5264 
    5265  // formfeed (0x0c)
    5266  case '\f':
    5267  {
    5268  result[pos + 1] = 'f';
    5269  pos += 2;
    5270  break;
    5271  }
    5272 
    5273  // newline (0x0a)
    5274  case '\n':
    5275  {
    5276  result[pos + 1] = 'n';
    5277  pos += 2;
    5278  break;
    5279  }
    5280 
    5281  // carriage return (0x0d)
    5282  case '\r':
    5283  {
    5284  result[pos + 1] = 'r';
    5285  pos += 2;
    5286  break;
    5287  }
    5288 
    5289  // horizontal tab (0x09)
    5290  case '\t':
    5291  {
    5292  result[pos + 1] = 't';
    5293  pos += 2;
    5294  break;
    5295  }
    5296 
    5297  default:
    5298  {
    5299  if (c >= 0x00 and c <= 0x1f)
    5300  {
    5301  // convert a number 0..15 to its hex representation (0..f)
    5302  auto hexify = [](const char v) -> char
    5303  {
    5304  return (v < 10) ? ('0' + v) : ('a' + v - 10);
    5305  };
    5306 
    5307  // print character c as \uxxxx
    5308  for (const char m :
    5309  { 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f)
    5310  })
    5311  {
    5312  result[++pos] = m;
    5313  }
    5314 
    5315  ++pos;
    5316  }
    5317  else
    5318  {
    5319  // all other characters are added as-is
    5320  result[pos++] = c;
    5321  }
    5322  break;
    5323  }
    5324  }
    5325  }
    5326 
    5327  return result;
    5328  }
    5329 
    5347  void dump(std::ostream& o,
    5348  const bool pretty_print,
    5349  const unsigned int indent_step,
    5350  const unsigned int current_indent = 0) const
    5351  {
    5352  // variable to hold indentation for recursive calls
    5353  unsigned int new_indent = current_indent;
    5354 
    5355  switch (m_type)
    5356  {
    5357  case value_t::object:
    5358  {
    5359  assert(m_value.object != nullptr);
    5360 
    5361  if (m_value.object->empty())
    5362  {
    5363  o << "{}";
    5364  return;
    5365  }
    5366 
    5367  o << "{";
    5368 
    5369  // increase indentation
    5370  if (pretty_print)
    5371  {
    5372  new_indent += indent_step;
    5373  o << "\n";
    5374  }
    5375 
    5376  for (auto i = m_value.object->cbegin(); i != m_value.object->cend(); ++i)
    5377  {
    5378  if (i != m_value.object->cbegin())
    5379  {
    5380  o << (pretty_print ? ",\n" : ",");
    5381  }
    5382  o << string_t(new_indent, ' ') << "\""
    5383  << escape_string(i->first) << "\":"
    5384  << (pretty_print ? " " : "");
    5385  i->second.dump(o, pretty_print, indent_step, new_indent);
    5386  }
    5387 
    5388  // decrease indentation
    5389  if (pretty_print)
    5390  {
    5391  new_indent -= indent_step;
    5392  o << "\n";
    5393  }
    5394 
    5395  o << string_t(new_indent, ' ') + "}";
    5396  return;
    5397  }
    5398 
    5399  case value_t::array:
    5400  {
    5401  assert(m_value.array != nullptr);
    5402 
    5403  if (m_value.array->empty())
    5404  {
    5405  o << "[]";
    5406  return;
    5407  }
    5408 
    5409  o << "[";
    5410 
    5411  // increase indentation
    5412  if (pretty_print)
    5413  {
    5414  new_indent += indent_step;
    5415  o << "\n";
    5416  }
    5417 
    5418  for (auto i = m_value.array->cbegin(); i != m_value.array->cend(); ++i)
    5419  {
    5420  if (i != m_value.array->cbegin())
    5421  {
    5422  o << (pretty_print ? ",\n" : ",");
    5423  }
    5424  o << string_t(new_indent, ' ');
    5425  i->dump(o, pretty_print, indent_step, new_indent);
    5426  }
    5427 
    5428  // decrease indentation
    5429  if (pretty_print)
    5430  {
    5431  new_indent -= indent_step;
    5432  o << "\n";
    5433  }
    5434 
    5435  o << string_t(new_indent, ' ') << "]";
    5436  return;
    5437  }
    5438 
    5439  case value_t::string:
    5440  {
    5441  assert(m_value.string != nullptr);
    5442  o << string_t("\"") << escape_string(*m_value.string) << "\"";
    5443  return;
    5444  }
    5445 
    5446  case value_t::boolean:
    5447  {
    5448  o << (m_value.boolean ? "true" : "false");
    5449  return;
    5450  }
    5451 
    5452  case value_t::number_integer:
    5453  {
    5454  o << m_value.number_integer;
    5455  return;
    5456  }
    5457 
    5458  case value_t::number_float:
    5459  {
    5460  // 15 digits of precision allows round-trip IEEE 754
    5461  // string->double->string; to be safe, we read this value from
    5462  // std::numeric_limits<number_float_t>::digits10
    5463  o << std::setprecision(std::numeric_limits<number_float_t>::digits10) << m_value.number_float;
    5464  return;
    5465  }
    5466 
    5467  case value_t::discarded:
    5468  {
    5469  o << "<discarded>";
    5470  return;
    5471  }
    5472 
    5473  case value_t::null:
    5474  {
    5475  o << "null";
    5476  return;
    5477  }
    5478  }
    5479  }
    5480 
    5481  private:
    5483  // member variables //
    5485 
    5487  value_t m_type = value_t::null;
    5488 
    5490  json_value m_value = {};
    5491 
    5492 
    5493  private:
    5495  // iterators //
    5497 
    5507  class primitive_iterator_t
    5508  {
    5509  public:
    5511  void set_begin()
    5512  {
    5513  m_it = begin_value;
    5514  }
    5515 
    5517  void set_end()
    5518  {
    5519  m_it = end_value;
    5520  }
    5521 
    5523  bool is_begin() const
    5524  {
    5525  return (m_it == begin_value);
    5526  }
    5527 
    5529  bool is_end() const
    5530  {
    5531  return (m_it == end_value);
    5532  }
    5533 
    5535  operator difference_type& ()
    5536  {
    5537  return m_it;
    5538  }
    5539 
    5541  operator difference_type () const
    5542  {
    5543  return m_it;
    5544  }
    5545 
    5546  private:
    5547  static constexpr difference_type begin_value = 0;
    5548  static constexpr difference_type end_value = begin_value + 1;
    5549 
    5551  difference_type m_it = std::numeric_limits<std::ptrdiff_t>::denorm_min();
    5552  };
    5553 
    5561  struct internal_iterator
    5562  {
    5564  typename object_t::iterator object_iterator;
    5566  typename array_t::iterator array_iterator;
    5568  primitive_iterator_t primitive_iterator;
    5569 
    5571  internal_iterator()
    5572  : object_iterator(), array_iterator(), primitive_iterator()
    5573  {}
    5574  };
    5575 
    5577  template<typename IteratorType>
    5578  class iteration_proxy
    5579  {
    5580  private:
    5582  class iteration_proxy_internal
    5583  {
    5584  private:
    5586  IteratorType anchor;
    5588  size_t array_index = 0;
    5589 
    5590  public:
    5591  iteration_proxy_internal(IteratorType it)
    5592  : anchor(it)
    5593  {}
    5594 
    5596  iteration_proxy_internal& operator*()
    5597  {
    5598  return *this;
    5599  }
    5600 
    5602  iteration_proxy_internal& operator++()
    5603  {
    5604  ++anchor;
    5605  ++array_index;
    5606 
    5607  return *this;
    5608  }
    5609 
    5611  bool operator!= (const iteration_proxy_internal& o) const
    5612  {
    5613  return anchor != o.anchor;
    5614  }
    5615 
    5617  typename basic_json::string_t key() const
    5618  {
    5619  assert(anchor.m_object != nullptr);
    5620 
    5621  switch (anchor.m_object->type())
    5622  {
    5623  // use integer array index as key
    5624  case value_t::array:
    5625  {
    5626  return std::to_string(array_index);
    5627  }
    5628 
    5629  // use key from the object
    5630  case value_t::object:
    5631  {
    5632  return anchor.key();
    5633  }
    5634 
    5635  // use an empty key for all primitive types
    5636  default:
    5637  {
    5638  return "";
    5639  }
    5640  }
    5641  }
    5642 
    5644  typename IteratorType::reference value() const
    5645  {
    5646  return anchor.value();
    5647  }
    5648  };
    5649 
    5651  typename IteratorType::reference container;
    5652 
    5653  public:
    5655  iteration_proxy(typename IteratorType::reference cont)
    5656  : container(cont)
    5657  {}
    5658 
    5660  iteration_proxy_internal begin()
    5661  {
    5662  return iteration_proxy_internal(container.begin());
    5663  }
    5664 
    5666  iteration_proxy_internal end()
    5667  {
    5668  return iteration_proxy_internal(container.end());
    5669  }
    5670  };
    5671 
    5672  public:
    5686  class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
    5687  {
    5689  friend class basic_json;
    5690 
    5691  public:
    5701  using iterator_category = std::bidirectional_iterator_tag;
    5702 
    5704  const_iterator() = default;
    5705 
    5707  const_iterator(pointer object) : m_object(object)
    5708  {
    5709  assert(m_object != nullptr);
    5710 
    5711  switch (m_object->m_type)
    5712  {
    5714  {
    5715  m_it.object_iterator = typename object_t::iterator();
    5716  break;
    5717  }
    5718 
    5720  {
    5721  m_it.array_iterator = typename array_t::iterator();
    5722  break;
    5723  }
    5724 
    5725  default:
    5726  {
    5727  m_it.primitive_iterator = primitive_iterator_t();
    5728  break;
    5729  }
    5730  }
    5731  }
    5732 
    5734  const_iterator(const iterator& other) : m_object(other.m_object)
    5735  {
    5736  assert(m_object != nullptr);
    5737 
    5738  switch (m_object->m_type)
    5739  {
    5741  {
    5742  m_it.object_iterator = other.m_it.object_iterator;
    5743  break;
    5744  }
    5745 
    5747  {
    5748  m_it.array_iterator = other.m_it.array_iterator;
    5749  break;
    5750  }
    5751 
    5752  default:
    5753  {
    5754  m_it.primitive_iterator = other.m_it.primitive_iterator;
    5755  break;
    5756  }
    5757  }
    5758  }
    5759 
    5761  const_iterator(const const_iterator& other) noexcept
    5762  : m_object(other.m_object), m_it(other.m_it)
    5763  {}
    5764 
    5767  std::is_nothrow_move_constructible<pointer>::value and
    5768  std::is_nothrow_move_assignable<pointer>::value and
    5769  std::is_nothrow_move_constructible<internal_iterator>::value and
    5770  std::is_nothrow_move_assignable<internal_iterator>::value
    5771  )
    5772  {
    5773  std::swap(m_object, other.m_object);
    5774  std::swap(m_it, other.m_it);
    5775  return *this;
    5776  }
    5777 
    5778  private:
    5780  void set_begin()
    5781  {
    5782  assert(m_object != nullptr);
    5783 
    5784  switch (m_object->m_type)
    5785  {
    5787  {
    5788  assert(m_object->m_value.object != nullptr);
    5789  m_it.object_iterator = m_object->m_value.object->begin();
    5790  break;
    5791  }
    5792 
    5794  {
    5795  assert(m_object->m_value.array != nullptr);
    5796  m_it.array_iterator = m_object->m_value.array->begin();
    5797  break;
    5798  }
    5799 
    5801  {
    5802  // set to end so begin()==end() is true: null is empty
    5803  m_it.primitive_iterator.set_end();
    5804  break;
    5805  }
    5806 
    5807  default:
    5808  {
    5809  m_it.primitive_iterator.set_begin();
    5810  break;
    5811  }
    5812  }
    5813  }
    5814 
    5816  void set_end()
    5817  {
    5818  assert(m_object != nullptr);
    5819 
    5820  switch (m_object->m_type)
    5821  {
    5823  {
    5824  assert(m_object->m_value.object != nullptr);
    5825  m_it.object_iterator = m_object->m_value.object->end();
    5826  break;
    5827  }
    5828 
    5830  {
    5831  assert(m_object->m_value.array != nullptr);
    5832  m_it.array_iterator = m_object->m_value.array->end();
    5833  break;
    5834  }
    5835 
    5836  default:
    5837  {
    5838  m_it.primitive_iterator.set_end();
    5839  break;
    5840  }
    5841  }
    5842  }
    5843 
    5844  public:
    5847  {
    5848  assert(m_object != nullptr);
    5849 
    5850  switch (m_object->m_type)
    5851  {
    5853  {
    5854  assert(m_object->m_value.object);
    5855  assert(m_it.object_iterator != m_object->m_value.object->end());
    5856  return m_it.object_iterator->second;
    5857  }
    5858 
    5860  {
    5861  assert(m_object->m_value.array);
    5862  assert(m_it.array_iterator != m_object->m_value.array->end());
    5863  return *m_it.array_iterator;
    5864  }
    5865 
    5867  {
    5868  throw std::out_of_range("cannot get value");
    5869  }
    5870 
    5871  default:
    5872  {
    5873  if (m_it.primitive_iterator.is_begin())
    5874  {
    5875  return *m_object;
    5876  }
    5877  else
    5878  {
    5879  throw std::out_of_range("cannot get value");
    5880  }
    5881  }
    5882  }
    5883  }
    5884 
    5887  {
    5888  assert(m_object != nullptr);
    5889 
    5890  switch (m_object->m_type)
    5891  {
    5893  {
    5894  assert(m_object->m_value.object);
    5895  assert(m_it.object_iterator != m_object->m_value.object->end());
    5896  return &(m_it.object_iterator->second);
    5897  }
    5898 
    5900  {
    5901  assert(m_object->m_value.array);
    5902  assert(m_it.array_iterator != m_object->m_value.array->end());
    5903  return &*m_it.array_iterator;
    5904  }
    5905 
    5906  default:
    5907  {
    5908  if (m_it.primitive_iterator.is_begin())
    5909  {
    5910  return m_object;
    5911  }
    5912  else
    5913  {
    5914  throw std::out_of_range("cannot get value");
    5915  }
    5916  }
    5917  }
    5918  }
    5919 
    5922  {
    5923  auto result = *this;
    5924  ++(*this);
    5925  return result;
    5926  }
    5927 
    5930  {
    5931  assert(m_object != nullptr);
    5932 
    5933  switch (m_object->m_type)
    5934  {
    5936  {
    5937  ++m_it.object_iterator;
    5938  break;
    5939  }
    5940 
    5942  {
    5943  ++m_it.array_iterator;
    5944  break;
    5945  }
    5946 
    5947  default:
    5948  {
    5949  ++m_it.primitive_iterator;
    5950  break;
    5951  }
    5952  }
    5953 
    5954  return *this;
    5955  }
    5956 
    5959  {
    5960  auto result = *this;
    5961  --(*this);
    5962  return result;
    5963  }
    5964 
    5967  {
    5968  assert(m_object != nullptr);
    5969 
    5970  switch (m_object->m_type)
    5971  {
    5973  {
    5974  --m_it.object_iterator;
    5975  break;
    5976  }
    5977 
    5979  {
    5980  --m_it.array_iterator;
    5981  break;
    5982  }
    5983 
    5984  default:
    5985  {
    5986  --m_it.primitive_iterator;
    5987  break;
    5988  }
    5989  }
    5990 
    5991  return *this;
    5992  }
    5993 
    5995  bool operator==(const const_iterator& other) const
    5996  {
    5997  // if objects are not the same, the comparison is undefined
    5998  if (m_object != other.m_object)
    5999  {
    6000  throw std::domain_error("cannot compare iterators of different containers");
    6001  }
    6002 
    6003  assert(m_object != nullptr);
    6004 
    6005  switch (m_object->m_type)
    6006  {
    6008  {
    6009  return (m_it.object_iterator == other.m_it.object_iterator);
    6010  }
    6011 
    6013  {
    6014  return (m_it.array_iterator == other.m_it.array_iterator);
    6015  }
    6016 
    6017  default:
    6018  {
    6019  return (m_it.primitive_iterator == other.m_it.primitive_iterator);
    6020  }
    6021  }
    6022  }
    6023 
    6025  bool operator!=(const const_iterator& other) const
    6026  {
    6027  return not operator==(other);
    6028  }
    6029 
    6031  bool operator<(const const_iterator& other) const
    6032  {
    6033  // if objects are not the same, the comparison is undefined
    6034  if (m_object != other.m_object)
    6035  {
    6036  throw std::domain_error("cannot compare iterators of different containers");
    6037  }
    6038 
    6039  assert(m_object != nullptr);
    6040 
    6041  switch (m_object->m_type)
    6042  {
    6044  {
    6045  throw std::domain_error("cannot compare order of object iterators");
    6046  }
    6047 
    6049  {
    6050  return (m_it.array_iterator < other.m_it.array_iterator);
    6051  }
    6052 
    6053  default:
    6054  {
    6055  return (m_it.primitive_iterator < other.m_it.primitive_iterator);
    6056  }
    6057  }
    6058  }
    6059 
    6061  bool operator<=(const const_iterator& other) const
    6062  {
    6063  return not other.operator < (*this);
    6064  }
    6065 
    6067  bool operator>(const const_iterator& other) const
    6068  {
    6069  return not operator<=(other);
    6070  }
    6071 
    6073  bool operator>=(const const_iterator& other) const
    6074  {
    6075  return not operator<(other);
    6076  }
    6077 
    6080  {
    6081  assert(m_object != nullptr);
    6082 
    6083  switch (m_object->m_type)
    6084  {
    6086  {
    6087  throw std::domain_error("cannot use offsets with object iterators");
    6088  }
    6089 
    6091  {
    6092  m_it.array_iterator += i;
    6093  break;
    6094  }
    6095 
    6096  default:
    6097  {
    6098  m_it.primitive_iterator += i;
    6099  break;
    6100  }
    6101  }
    6102 
    6103  return *this;
    6104  }
    6105 
    6108  {
    6109  return operator+=(-i);
    6110  }
    6111 
    6114  {
    6115  auto result = *this;
    6116  result += i;
    6117  return result;
    6118  }
    6119 
    6122  {
    6123  auto result = *this;
    6124  result -= i;
    6125  return result;
    6126  }
    6127 
    6130  {
    6131  assert(m_object != nullptr);
    6132 
    6133  switch (m_object->m_type)
    6134  {
    6136  {
    6137  throw std::domain_error("cannot use offsets with object iterators");
    6138  }
    6139 
    6141  {
    6142  return m_it.array_iterator - other.m_it.array_iterator;
    6143  }
    6144 
    6145  default:
    6146  {
    6147  return m_it.primitive_iterator - other.m_it.primitive_iterator;
    6148  }
    6149  }
    6150  }
    6151 
    6154  {
    6155  assert(m_object != nullptr);
    6156 
    6157  switch (m_object->m_type)
    6158  {
    6160  {
    6161  throw std::domain_error("cannot use operator[] for object iterators");
    6162  }
    6163 
    6165  {
    6166  return *(m_it.array_iterator + n);
    6167  }
    6168 
    6170  {
    6171  throw std::out_of_range("cannot get value");
    6172  }
    6173 
    6174  default:
    6175  {
    6176  if (m_it.primitive_iterator == -n)
    6177  {
    6178  return *m_object;
    6179  }
    6180  else
    6181  {
    6182  throw std::out_of_range("cannot get value");
    6183  }
    6184  }
    6185  }
    6186  }
    6187 
    6189  typename object_t::key_type key() const
    6190  {
    6191  assert(m_object != nullptr);
    6192 
    6193  if (m_object->is_object())
    6194  {
    6195  return m_it.object_iterator->first;
    6196  }
    6197  else
    6198  {
    6199  throw std::domain_error("cannot use key() for non-object iterators");
    6200  }
    6201  }
    6202 
    6205  {
    6206  return operator*();
    6207  }
    6208 
    6209  private:
    6211  pointer m_object = nullptr;
    6213  internal_iterator m_it = internal_iterator();
    6214  };
    6215 
    6228  class iterator : public const_iterator
    6229  {
    6230  public:
    6232  using pointer = typename basic_json::pointer;
    6234 
    6236  iterator() = default;
    6237 
    6239  iterator(pointer object) noexcept
    6240  : base_iterator(object)
    6241  {}
    6242 
    6244  iterator(const iterator& other) noexcept
    6245  : base_iterator(other)
    6246  {}
    6247 
    6249  iterator& operator=(iterator other) noexcept(
    6250  std::is_nothrow_move_constructible<pointer>::value and
    6251  std::is_nothrow_move_assignable<pointer>::value and
    6252  std::is_nothrow_move_constructible<internal_iterator>::value and
    6253  std::is_nothrow_move_assignable<internal_iterator>::value
    6254  )
    6255  {
    6256  base_iterator::operator=(other);
    6257  return *this;
    6258  }
    6259 
    6262  {
    6263  return const_cast<reference>(base_iterator::operator*());
    6264  }
    6265 
    6268  {
    6269  return const_cast<pointer>(base_iterator::operator->());
    6270  }
    6271 
    6274  {
    6275  iterator result = *this;
    6276  base_iterator::operator++();
    6277  return result;
    6278  }
    6279 
    6282  {
    6283  base_iterator::operator++();
    6284  return *this;
    6285  }
    6286 
    6289  {
    6290  iterator result = *this;
    6291  base_iterator::operator--();
    6292  return result;
    6293  }
    6294 
    6297  {
    6298  base_iterator::operator--();
    6299  return *this;
    6300  }
    6301 
    6304  {
    6305  base_iterator::operator+=(i);
    6306  return *this;
    6307  }
    6308 
    6311  {
    6312  base_iterator::operator-=(i);
    6313  return *this;
    6314  }
    6315 
    6318  {
    6319  auto result = *this;
    6320  result += i;
    6321  return result;
    6322  }
    6323 
    6326  {
    6327  auto result = *this;
    6328  result -= i;
    6329  return result;
    6330  }
    6331 
    6332  difference_type operator-(const iterator& other) const
    6333  {
    6334  return base_iterator::operator-(other);
    6335  }
    6336 
    6339  {
    6340  return const_cast<reference>(base_iterator::operator[](n));
    6341  }
    6342 
    6345  {
    6346  return const_cast<reference>(base_iterator::value());
    6347  }
    6348  };
    6349 
    6367  template<typename Base>
    6368  class json_reverse_iterator : public std::reverse_iterator<Base>
    6369  {
    6370  public:
    6372  using base_iterator = std::reverse_iterator<Base>;
    6374  using reference = typename Base::reference;
    6375 
    6377  json_reverse_iterator(const typename base_iterator::iterator_type& it)
    6378  : base_iterator(it)
    6379  {}
    6380 
    6383  : base_iterator(it)
    6384  {}
    6385 
    6388  {
    6389  return base_iterator::operator++(1);
    6390  }
    6391 
    6394  {
    6395  base_iterator::operator++();
    6396  return *this;
    6397  }
    6398 
    6401  {
    6402  return base_iterator::operator--(1);
    6403  }
    6404 
    6407  {
    6408  base_iterator::operator--();
    6409  return *this;
    6410  }
    6411 
    6414  {
    6415  base_iterator::operator+=(i);
    6416  return *this;
    6417  }
    6418 
    6421  {
    6422  auto result = *this;
    6423  result += i;
    6424  return result;
    6425  }
    6426 
    6429  {
    6430  auto result = *this;
    6431  result -= i;
    6432  return result;
    6433  }
    6434 
    6437  {
    6438  return this->base() - other.base();
    6439  }
    6440 
    6443  {
    6444  return *(this->operator+(n));
    6445  }
    6446 
    6448  typename object_t::key_type key() const
    6449  {
    6450  auto it = --this->base();
    6451  return it.key();
    6452  }
    6453 
    6456  {
    6457  auto it = --this->base();
    6458  return it.operator * ();
    6459  }
    6460  };
    6461 
    6462 
    6463  private:
    6465  // lexer and parser //
    6467 
    6475  class lexer
    6476  {
    6477  public:
    6479  enum class token_type
    6480  {
    6481  uninitialized,
    6482  literal_true,
    6483  literal_false,
    6484  literal_null,
    6485  value_string,
    6486  value_number,
    6487  begin_array,
    6488  begin_object,
    6489  end_array,
    6490  end_object,
    6491  name_separator,
    6492  value_separator,
    6493  parse_error,
    6494  end_of_input
    6495  };
    6496 
    6498  using lexer_char_t = unsigned char;
    6499 
    6501  explicit lexer(const string_t& s) noexcept
    6502  : m_stream(nullptr), m_buffer(s)
    6503  {
    6504  m_content = reinterpret_cast<const lexer_char_t*>(s.c_str());
    6505  assert(m_content != nullptr);
    6506  m_start = m_cursor = m_content;
    6507  m_limit = m_content + s.size();
    6508  }
    6509 
    6511  explicit lexer(std::istream* s) noexcept
    6512  : m_stream(s), m_buffer()
    6513  {
    6514  assert(m_stream != nullptr);
    6515  getline(*m_stream, m_buffer);
    6516  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
    6517  assert(m_content != nullptr);
    6518  m_start = m_cursor = m_content;
    6519  m_limit = m_content + m_buffer.size();
    6520  }
    6521 
    6523  lexer() = default;
    6524 
    6525  // switch off unwanted functions
    6526  lexer(const lexer&) = delete;
    6527  lexer operator=(const lexer&) = delete;
    6528 
    6544  static string_t to_unicode(const std::size_t codepoint1,
    6545  const std::size_t codepoint2 = 0)
    6546  {
    6547  string_t result;
    6548 
    6549  // calculate the codepoint from the given code points
    6550  std::size_t codepoint = codepoint1;
    6551 
    6552  // check if codepoint1 is a high surrogate
    6553  if (codepoint1 >= 0xD800 and codepoint1 <= 0xDBFF)
    6554  {
    6555  // check if codepoint2 is a low surrogate
    6556  if (codepoint2 >= 0xDC00 and codepoint2 <= 0xDFFF)
    6557  {
    6558  codepoint =
    6559  // high surrogate occupies the most significant 22 bits
    6560  (codepoint1 << 10)
    6561  // low surrogate occupies the least significant 15 bits
    6562  + codepoint2
    6563  // there is still the 0xD800, 0xDC00 and 0x10000 noise
    6564  // in the result so we have to subtract with:
    6565  // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
    6566  - 0x35FDC00;
    6567  }
    6568  else
    6569  {
    6570  throw std::invalid_argument("missing or wrong low surrogate");
    6571  }
    6572  }
    6573 
    6574  if (codepoint < 0x80)
    6575  {
    6576  // 1-byte characters: 0xxxxxxx (ASCII)
    6577  result.append(1, static_cast<typename string_t::value_type>(codepoint));
    6578  }
    6579  else if (codepoint <= 0x7ff)
    6580  {
    6581  // 2-byte characters: 110xxxxx 10xxxxxx
    6582  result.append(1, static_cast<typename string_t::value_type>(0xC0 | ((codepoint >> 6) & 0x1F)));
    6583  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
    6584  }
    6585  else if (codepoint <= 0xffff)
    6586  {
    6587  // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
    6588  result.append(1, static_cast<typename string_t::value_type>(0xE0 | ((codepoint >> 12) & 0x0F)));
    6589  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
    6590  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
    6591  }
    6592  else if (codepoint <= 0x10ffff)
    6593  {
    6594  // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
    6595  result.append(1, static_cast<typename string_t::value_type>(0xF0 | ((codepoint >> 18) & 0x07)));
    6596  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 12) & 0x3F)));
    6597  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
    6598  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
    6599  }
    6600  else
    6601  {
    6602  throw std::out_of_range("code points above 0x10FFFF are invalid");
    6603  }
    6604 
    6605  return result;
    6606  }
    6607 
    6609  static std::string token_type_name(token_type t)
    6610  {
    6611  switch (t)
    6612  {
    6613  case token_type::uninitialized:
    6614  return "<uninitialized>";
    6615  case token_type::literal_true:
    6616  return "true literal";
    6617  case token_type::literal_false:
    6618  return "false literal";
    6619  case token_type::literal_null:
    6620  return "null literal";
    6621  case token_type::value_string:
    6622  return "string literal";
    6623  case token_type::value_number:
    6624  return "number literal";
    6625  case token_type::begin_array:
    6626  return "'['";
    6627  case token_type::begin_object:
    6628  return "'{'";
    6629  case token_type::end_array:
    6630  return "']'";
    6631  case token_type::end_object:
    6632  return "'}'";
    6633  case token_type::name_separator:
    6634  return "':'";
    6635  case token_type::value_separator:
    6636  return "','";
    6637  case token_type::parse_error:
    6638  return "<parse error>";
    6639  case token_type::end_of_input:
    6640  return "end of input";
    6641  default:
    6642  {
    6643  // catch non-enum values
    6644  return "unknown token"; // LCOV_EXCL_LINE
    6645  }
    6646  }
    6647  }
    6648 
    6659  token_type scan() noexcept
    6660  {
    6661  // pointer for backtracking information
    6662  m_marker = nullptr;
    6663 
    6664  // remember the begin of the token
    6665  m_start = m_cursor;
    6666  assert(m_start != nullptr);
    6667 
    6668 
    6669  {
    6670  lexer_char_t yych;
    6671  unsigned int yyaccept = 0;
    6672  static const unsigned char yybm[] =
    6673  {
    6674  0, 0, 0, 0, 0, 0, 0, 0,
    6675  0, 32, 32, 0, 0, 32, 0, 0,
    6676  64, 64, 64, 64, 64, 64, 64, 64,
    6677  64, 64, 64, 64, 64, 64, 64, 64,
    6678  96, 64, 0, 64, 64, 64, 64, 64,
    6679  64, 64, 64, 64, 64, 64, 64, 64,
    6680  192, 192, 192, 192, 192, 192, 192, 192,
    6681  192, 192, 64, 64, 64, 64, 64, 64,
    6682  64, 64, 64, 64, 64, 64, 64, 64,
    6683  64, 64, 64, 64, 64, 64, 64, 64,
    6684  64, 64, 64, 64, 64, 64, 64, 64,
    6685  64, 64, 64, 64, 0, 64, 64, 64,
    6686  64, 64, 64, 64, 64, 64, 64, 64,
    6687  64, 64, 64, 64, 64, 64, 64, 64,
    6688  64, 64, 64, 64, 64, 64, 64, 64,
    6689  64, 64, 64, 64, 64, 64, 64, 64,
    6690  64, 64, 64, 64, 64, 64, 64, 64,
    6691  64, 64, 64, 64, 64, 64, 64, 64,
    6692  64, 64, 64, 64, 64, 64, 64, 64,
    6693  64, 64, 64, 64, 64, 64, 64, 64,
    6694  64, 64, 64, 64, 64, 64, 64, 64,
    6695  64, 64, 64, 64, 64, 64, 64, 64,
    6696  64, 64, 64, 64, 64, 64, 64, 64,
    6697  64, 64, 64, 64, 64, 64, 64, 64,
    6698  64, 64, 64, 64, 64, 64, 64, 64,
    6699  64, 64, 64, 64, 64, 64, 64, 64,
    6700  64, 64, 64, 64, 64, 64, 64, 64,
    6701  64, 64, 64, 64, 64, 64, 64, 64,
    6702  64, 64, 64, 64, 64, 64, 64, 64,
    6703  64, 64, 64, 64, 64, 64, 64, 64,
    6704  64, 64, 64, 64, 64, 64, 64, 64,
    6705  64, 64, 64, 64, 64, 64, 64, 64,
    6706  };
    6707  if ((m_limit - m_cursor) < 5)
    6708  {
    6709  yyfill(); // LCOV_EXCL_LINE;
    6710  }
    6711  yych = *m_cursor;
    6712  if (yych <= ':')
    6713  {
    6714  if (yych <= ' ')
    6715  {
    6716  if (yych <= '\n')
    6717  {
    6718  if (yych <= 0x00)
    6719  {
    6720  goto basic_json_parser_28;
    6721  }
    6722  if (yych <= 0x08)
    6723  {
    6724  goto basic_json_parser_30;
    6725  }
    6726  if (yych >= '\n')
    6727  {
    6728  goto basic_json_parser_4;
    6729  }
    6730  }
    6731  else
    6732  {
    6733  if (yych == '\r')
    6734  {
    6735  goto basic_json_parser_2;
    6736  }
    6737  if (yych <= 0x1F)
    6738  {
    6739  goto basic_json_parser_30;
    6740  }
    6741  }
    6742  }
    6743  else
    6744  {
    6745  if (yych <= ',')
    6746  {
    6747  if (yych == '"')
    6748  {
    6749  goto basic_json_parser_27;
    6750  }
    6751  if (yych <= '+')
    6752  {
    6753  goto basic_json_parser_30;
    6754  }
    6755  goto basic_json_parser_16;
    6756  }
    6757  else
    6758  {
    6759  if (yych <= '/')
    6760  {
    6761  if (yych <= '-')
    6762  {
    6763  goto basic_json_parser_23;
    6764  }
    6765  goto basic_json_parser_30;
    6766  }
    6767  else
    6768  {
    6769  if (yych <= '0')
    6770  {
    6771  goto basic_json_parser_24;
    6772  }
    6773  if (yych <= '9')
    6774  {
    6775  goto basic_json_parser_26;
    6776  }
    6777  goto basic_json_parser_18;
    6778  }
    6779  }
    6780  }
    6781  }
    6782  else
    6783  {
    6784  if (yych <= 'n')
    6785  {
    6786  if (yych <= ']')
    6787  {
    6788  if (yych == '[')
    6789  {
    6790  goto basic_json_parser_8;
    6791  }
    6792  if (yych <= '\\')
    6793  {
    6794  goto basic_json_parser_30;
    6795  }
    6796  goto basic_json_parser_10;
    6797  }
    6798  else
    6799  {
    6800  if (yych == 'f')
    6801  {
    6802  goto basic_json_parser_22;
    6803  }
    6804  if (yych <= 'm')
    6805  {
    6806  goto basic_json_parser_30;
    6807  }
    6808  goto basic_json_parser_20;
    6809  }
    6810  }
    6811  else
    6812  {
    6813  if (yych <= '{')
    6814  {
    6815  if (yych == 't')
    6816  {
    6817  goto basic_json_parser_21;
    6818  }
    6819  if (yych <= 'z')
    6820  {
    6821  goto basic_json_parser_30;
    6822  }
    6823  goto basic_json_parser_12;
    6824  }
    6825  else
    6826  {
    6827  if (yych <= '}')
    6828  {
    6829  if (yych <= '|')
    6830  {
    6831  goto basic_json_parser_30;
    6832  }
    6833  goto basic_json_parser_14;
    6834  }
    6835  else
    6836  {
    6837  if (yych == 0xEF)
    6838  {
    6839  goto basic_json_parser_6;
    6840  }
    6841  goto basic_json_parser_30;
    6842  }
    6843  }
    6844  }
    6845  }
    6846 basic_json_parser_2:
    6847  ++m_cursor;
    6848  yych = *m_cursor;
    6849  goto basic_json_parser_5;
    6850 basic_json_parser_3:
    6851  {
    6852  return scan();
    6853  }
    6854 basic_json_parser_4:
    6855  ++m_cursor;
    6856  if (m_limit <= m_cursor)
    6857  {
    6858  yyfill(); // LCOV_EXCL_LINE;
    6859  }
    6860  yych = *m_cursor;
    6861 basic_json_parser_5:
    6862  if (yybm[0 + yych] & 32)
    6863  {
    6864  goto basic_json_parser_4;
    6865  }
    6866  goto basic_json_parser_3;
    6867 basic_json_parser_6:
    6868  yyaccept = 0;
    6869  yych = *(m_marker = ++m_cursor);
    6870  if (yych == 0xBB)
    6871  {
    6872  goto basic_json_parser_64;
    6873  }
    6874 basic_json_parser_7:
    6875  {
    6876  return token_type::parse_error;
    6877  }
    6878 basic_json_parser_8:
    6879  ++m_cursor;
    6880  {
    6881  return token_type::begin_array;
    6882  }
    6883 basic_json_parser_10:
    6884  ++m_cursor;
    6885  {
    6886  return token_type::end_array;
    6887  }
    6888 basic_json_parser_12:
    6889  ++m_cursor;
    6890  {
    6891  return token_type::begin_object;
    6892  }
    6893 basic_json_parser_14:
    6894  ++m_cursor;
    6895  {
    6896  return token_type::end_object;
    6897  }
    6898 basic_json_parser_16:
    6899  ++m_cursor;
    6900  {
    6901  return token_type::value_separator;
    6902  }
    6903 basic_json_parser_18:
    6904  ++m_cursor;
    6905  {
    6906  return token_type::name_separator;
    6907  }
    6908 basic_json_parser_20:
    6909  yyaccept = 0;
    6910  yych = *(m_marker = ++m_cursor);
    6911  if (yych == 'u')
    6912  {
    6913  goto basic_json_parser_60;
    6914  }
    6915  goto basic_json_parser_7;
    6916 basic_json_parser_21:
    6917  yyaccept = 0;
    6918  yych = *(m_marker = ++m_cursor);
    6919  if (yych == 'r')
    6920  {
    6921  goto basic_json_parser_56;
    6922  }
    6923  goto basic_json_parser_7;
    6924 basic_json_parser_22:
    6925  yyaccept = 0;
    6926  yych = *(m_marker = ++m_cursor);
    6927  if (yych == 'a')
    6928  {
    6929  goto basic_json_parser_51;
    6930  }
    6931  goto basic_json_parser_7;
    6932 basic_json_parser_23:
    6933  yych = *++m_cursor;
    6934  if (yych <= '/')
    6935  {
    6936  goto basic_json_parser_7;
    6937  }
    6938  if (yych <= '0')
    6939  {
    6940  goto basic_json_parser_50;
    6941  }
    6942  if (yych <= '9')
    6943  {
    6944  goto basic_json_parser_41;
    6945  }
    6946  goto basic_json_parser_7;
    6947 basic_json_parser_24:
    6948  yyaccept = 1;
    6949  yych = *(m_marker = ++m_cursor);
    6950  if (yych <= 'D')
    6951  {
    6952  if (yych == '.')
    6953  {
    6954  goto basic_json_parser_43;
    6955  }
    6956  }
    6957  else
    6958  {
    6959  if (yych <= 'E')
    6960  {
    6961  goto basic_json_parser_44;
    6962  }
    6963  if (yych == 'e')
    6964  {
    6965  goto basic_json_parser_44;
    6966  }
    6967  }
    6968 basic_json_parser_25:
    6969  {
    6970  return token_type::value_number;
    6971  }
    6972 basic_json_parser_26:
    6973  yyaccept = 1;
    6974  yych = *(m_marker = ++m_cursor);
    6975  goto basic_json_parser_42;
    6976 basic_json_parser_27:
    6977  yyaccept = 0;
    6978  yych = *(m_marker = ++m_cursor);
    6979  if (yych <= 0x0F)
    6980  {
    6981  goto basic_json_parser_7;
    6982  }
    6983  goto basic_json_parser_32;
    6984 basic_json_parser_28:
    6985  ++m_cursor;
    6986  {
    6987  return token_type::end_of_input;
    6988  }
    6989 basic_json_parser_30:
    6990  yych = *++m_cursor;
    6991  goto basic_json_parser_7;
    6992 basic_json_parser_31:
    6993  ++m_cursor;
    6994  if (m_limit <= m_cursor)
    6995  {
    6996  yyfill(); // LCOV_EXCL_LINE;
    6997  }
    6998  yych = *m_cursor;
    6999 basic_json_parser_32:
    7000  if (yybm[0 + yych] & 64)
    7001  {
    7002  goto basic_json_parser_31;
    7003  }
    7004  if (yych <= 0x0F)
    7005  {
    7006  goto basic_json_parser_33;
    7007  }
    7008  if (yych <= '"')
    7009  {
    7010  goto basic_json_parser_35;
    7011  }
    7012  goto basic_json_parser_34;
    7013 basic_json_parser_33:
    7014  m_cursor = m_marker;
    7015  if (yyaccept == 0)
    7016  {
    7017  goto basic_json_parser_7;
    7018  }
    7019  else
    7020  {
    7021  goto basic_json_parser_25;
    7022  }
    7023 basic_json_parser_34:
    7024  ++m_cursor;
    7025  if (m_limit <= m_cursor)
    7026  {
    7027  yyfill(); // LCOV_EXCL_LINE;
    7028  }
    7029  yych = *m_cursor;
    7030  if (yych <= 'e')
    7031  {
    7032  if (yych <= '/')
    7033  {
    7034  if (yych == '"')
    7035  {
    7036  goto basic_json_parser_31;
    7037  }
    7038  if (yych <= '.')
    7039  {
    7040  goto basic_json_parser_33;
    7041  }
    7042  goto basic_json_parser_31;
    7043  }
    7044  else
    7045  {
    7046  if (yych <= '\\')
    7047  {
    7048  if (yych <= '[')
    7049  {
    7050  goto basic_json_parser_33;
    7051  }
    7052  goto basic_json_parser_31;
    7053  }
    7054  else
    7055  {
    7056  if (yych == 'b')
    7057  {
    7058  goto basic_json_parser_31;
    7059  }
    7060  goto basic_json_parser_33;
    7061  }
    7062  }
    7063  }
    7064  else
    7065  {
    7066  if (yych <= 'q')
    7067  {
    7068  if (yych <= 'f')
    7069  {
    7070  goto basic_json_parser_31;
    7071  }
    7072  if (yych == 'n')
    7073  {
    7074  goto basic_json_parser_31;
    7075  }
    7076  goto basic_json_parser_33;
    7077  }
    7078  else
    7079  {
    7080  if (yych <= 's')
    7081  {
    7082  if (yych <= 'r')
    7083  {
    7084  goto basic_json_parser_31;
    7085  }
    7086  goto basic_json_parser_33;
    7087  }
    7088  else
    7089  {
    7090  if (yych <= 't')
    7091  {
    7092  goto basic_json_parser_31;
    7093  }
    7094  if (yych <= 'u')
    7095  {
    7096  goto basic_json_parser_37;
    7097  }
    7098  goto basic_json_parser_33;
    7099  }
    7100  }
    7101  }
    7102 basic_json_parser_35:
    7103  ++m_cursor;
    7104  {
    7105  return token_type::value_string;
    7106  }
    7107 basic_json_parser_37:
    7108  ++m_cursor;
    7109  if (m_limit <= m_cursor)
    7110  {
    7111  yyfill(); // LCOV_EXCL_LINE;
    7112  }
    7113  yych = *m_cursor;
    7114  if (yych <= '@')
    7115  {
    7116  if (yych <= '/')
    7117  {
    7118  goto basic_json_parser_33;
    7119  }
    7120  if (yych >= ':')
    7121  {
    7122  goto basic_json_parser_33;
    7123  }
    7124  }
    7125  else
    7126  {
    7127  if (yych <= 'F')
    7128  {
    7129  goto basic_json_parser_38;
    7130  }
    7131  if (yych <= '`')
    7132  {
    7133  goto basic_json_parser_33;
    7134  }
    7135  if (yych >= 'g')
    7136  {
    7137  goto basic_json_parser_33;
    7138  }
    7139  }
    7140 basic_json_parser_38:
    7141  ++m_cursor;
    7142  if (m_limit <= m_cursor)
    7143  {
    7144  yyfill(); // LCOV_EXCL_LINE;
    7145  }
    7146  yych = *m_cursor;
    7147  if (yych <= '@')
    7148  {
    7149  if (yych <= '/')
    7150  {
    7151  goto basic_json_parser_33;
    7152  }
    7153  if (yych >= ':')
    7154  {
    7155  goto basic_json_parser_33;
    7156  }
    7157  }
    7158  else
    7159  {
    7160  if (yych <= 'F')
    7161  {
    7162  goto basic_json_parser_39;
    7163  }
    7164  if (yych <= '`')
    7165  {
    7166  goto basic_json_parser_33;
    7167  }
    7168  if (yych >= 'g')
    7169  {
    7170  goto basic_json_parser_33;
    7171  }
    7172  }
    7173 basic_json_parser_39:
    7174  ++m_cursor;
    7175  if (m_limit <= m_cursor)
    7176  {
    7177  yyfill(); // LCOV_EXCL_LINE;
    7178  }
    7179  yych = *m_cursor;
    7180  if (yych <= '@')
    7181  {
    7182  if (yych <= '/')
    7183  {
    7184  goto basic_json_parser_33;
    7185  }
    7186  if (yych >= ':')
    7187  {
    7188  goto basic_json_parser_33;
    7189  }
    7190  }
    7191  else
    7192  {
    7193  if (yych <= 'F')
    7194  {
    7195  goto basic_json_parser_40;
    7196  }
    7197  if (yych <= '`')
    7198  {
    7199  goto basic_json_parser_33;
    7200  }
    7201  if (yych >= 'g')
    7202  {
    7203  goto basic_json_parser_33;
    7204  }
    7205  }
    7206 basic_json_parser_40:
    7207  ++m_cursor;
    7208  if (m_limit <= m_cursor)
    7209  {
    7210  yyfill(); // LCOV_EXCL_LINE;
    7211  }
    7212  yych = *m_cursor;
    7213  if (yych <= '@')
    7214  {
    7215  if (yych <= '/')
    7216  {
    7217  goto basic_json_parser_33;
    7218  }
    7219  if (yych <= '9')
    7220  {
    7221  goto basic_json_parser_31;
    7222  }
    7223  goto basic_json_parser_33;
    7224  }
    7225  else
    7226  {
    7227  if (yych <= 'F')
    7228  {
    7229  goto basic_json_parser_31;
    7230  }
    7231  if (yych <= '`')
    7232  {
    7233  goto basic_json_parser_33;
    7234  }
    7235  if (yych <= 'f')
    7236  {
    7237  goto basic_json_parser_31;
    7238  }
    7239  goto basic_json_parser_33;
    7240  }
    7241 basic_json_parser_41:
    7242  yyaccept = 1;
    7243  m_marker = ++m_cursor;
    7244  if ((m_limit - m_cursor) < 3)
    7245  {
    7246  yyfill(); // LCOV_EXCL_LINE;
    7247  }
    7248  yych = *m_cursor;
    7249 basic_json_parser_42:
    7250  if (yybm[0 + yych] & 128)
    7251  {
    7252  goto basic_json_parser_41;
    7253  }
    7254  if (yych <= 'D')
    7255  {
    7256  if (yych != '.')
    7257  {
    7258  goto basic_json_parser_25;
    7259  }
    7260  }
    7261  else
    7262  {
    7263  if (yych <= 'E')
    7264  {
    7265  goto basic_json_parser_44;
    7266  }
    7267  if (yych == 'e')
    7268  {
    7269  goto basic_json_parser_44;
    7270  }
    7271  goto basic_json_parser_25;
    7272  }
    7273 basic_json_parser_43:
    7274  yych = *++m_cursor;
    7275  if (yych <= '/')
    7276  {
    7277  goto basic_json_parser_33;
    7278  }
    7279  if (yych <= '9')
    7280  {
    7281  goto basic_json_parser_48;
    7282  }
    7283  goto basic_json_parser_33;
    7284 basic_json_parser_44:
    7285  yych = *++m_cursor;
    7286  if (yych <= ',')
    7287  {
    7288  if (yych != '+')
    7289  {
    7290  goto basic_json_parser_33;
    7291  }
    7292  }
    7293  else
    7294  {
    7295  if (yych <= '-')
    7296  {
    7297  goto basic_json_parser_45;
    7298  }
    7299  if (yych <= '/')
    7300  {
    7301  goto basic_json_parser_33;
    7302  }
    7303  if (yych <= '9')
    7304  {
    7305  goto basic_json_parser_46;
    7306  }
    7307  goto basic_json_parser_33;
    7308  }
    7309 basic_json_parser_45:
    7310  yych = *++m_cursor;
    7311  if (yych <= '/')
    7312  {
    7313  goto basic_json_parser_33;
    7314  }
    7315  if (yych >= ':')
    7316  {
    7317  goto basic_json_parser_33;
    7318  }
    7319 basic_json_parser_46:
    7320  ++m_cursor;
    7321  if (m_limit <= m_cursor)
    7322  {
    7323  yyfill(); // LCOV_EXCL_LINE;
    7324  }
    7325  yych = *m_cursor;
    7326  if (yych <= '/')
    7327  {
    7328  goto basic_json_parser_25;
    7329  }
    7330  if (yych <= '9')
    7331  {
    7332  goto basic_json_parser_46;
    7333  }
    7334  goto basic_json_parser_25;
    7335 basic_json_parser_48:
    7336  yyaccept = 1;
    7337  m_marker = ++m_cursor;
    7338  if ((m_limit - m_cursor) < 3)
    7339  {
    7340  yyfill(); // LCOV_EXCL_LINE;
    7341  }
    7342  yych = *m_cursor;
    7343  if (yych <= 'D')
    7344  {
    7345  if (yych <= '/')
    7346  {
    7347  goto basic_json_parser_25;
    7348  }
    7349  if (yych <= '9')
    7350  {
    7351  goto basic_json_parser_48;
    7352  }
    7353  goto basic_json_parser_25;
    7354  }
    7355  else
    7356  {
    7357  if (yych <= 'E')
    7358  {
    7359  goto basic_json_parser_44;
    7360  }
    7361  if (yych == 'e')
    7362  {
    7363  goto basic_json_parser_44;
    7364  }
    7365  goto basic_json_parser_25;
    7366  }
    7367 basic_json_parser_50:
    7368  yyaccept = 1;
    7369  yych = *(m_marker = ++m_cursor);
    7370  if (yych <= 'D')
    7371  {
    7372  if (yych == '.')
    7373  {
    7374  goto basic_json_parser_43;
    7375  }
    7376  goto basic_json_parser_25;
    7377  }
    7378  else
    7379  {
    7380  if (yych <= 'E')
    7381  {
    7382  goto basic_json_parser_44;
    7383  }
    7384  if (yych == 'e')
    7385  {
    7386  goto basic_json_parser_44;
    7387  }
    7388  goto basic_json_parser_25;
    7389  }
    7390 basic_json_parser_51:
    7391  yych = *++m_cursor;
    7392  if (yych != 'l')
    7393  {
    7394  goto basic_json_parser_33;
    7395  }
    7396  yych = *++m_cursor;
    7397  if (yych != 's')
    7398  {
    7399  goto basic_json_parser_33;
    7400  }
    7401  yych = *++m_cursor;
    7402  if (yych != 'e')
    7403  {
    7404  goto basic_json_parser_33;
    7405  }
    7406  ++m_cursor;
    7407  {
    7408  return token_type::literal_false;
    7409  }
    7410 basic_json_parser_56:
    7411  yych = *++m_cursor;
    7412  if (yych != 'u')
    7413  {
    7414  goto basic_json_parser_33;
    7415  }
    7416  yych = *++m_cursor;
    7417  if (yych != 'e')
    7418  {
    7419  goto basic_json_parser_33;
    7420  }
    7421  ++m_cursor;
    7422  {
    7423  return token_type::literal_true;
    7424  }
    7425 basic_json_parser_60:
    7426  yych = *++m_cursor;
    7427  if (yych != 'l')
    7428  {
    7429  goto basic_json_parser_33;
    7430  }
    7431  yych = *++m_cursor;
    7432  if (yych != 'l')
    7433  {
    7434  goto basic_json_parser_33;
    7435  }
    7436  ++m_cursor;
    7437  {
    7438  return token_type::literal_null;
    7439  }
    7440 basic_json_parser_64:
    7441  yych = *++m_cursor;
    7442  if (yych != 0xBF)
    7443  {
    7444  goto basic_json_parser_33;
    7445  }
    7446  ++m_cursor;
    7447  {
    7448  return scan();
    7449  }
    7450  }
    7451 
    7452 
    7453  }
    7454 
    7456  void yyfill() noexcept
    7457  {
    7458  if (m_stream == nullptr or not * m_stream)
    7459  {
    7460  return;
    7461  }
    7462 
    7463  const ssize_t offset_start = m_start - m_content;
    7464  const ssize_t offset_marker = m_marker - m_start;
    7465  const ssize_t offset_cursor = m_cursor - m_start;
    7466 
    7467  m_buffer.erase(0, static_cast<size_t>(offset_start));
    7468  std::string line;
    7469  assert(m_stream != nullptr);
    7470  std::getline(*m_stream, line);
    7471  m_buffer += "\n" + line; // add line with newline symbol
    7472 
    7473  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
    7474  assert(m_content != nullptr);
    7475  m_start = m_content;
    7476  m_marker = m_start + offset_marker;
    7477  m_cursor = m_start + offset_cursor;
    7478  m_limit = m_start + m_buffer.size() - 1;
    7479  }
    7480 
    7482  string_t get_token() const noexcept
    7483  {
    7484  assert(m_start != nullptr);
    7485  return string_t(reinterpret_cast<typename string_t::const_pointer>(m_start),
    7486  static_cast<size_t>(m_cursor - m_start));
    7487  }
    7488 
    7510  string_t get_string() const
    7511  {
    7512  string_t result;
    7513  result.reserve(static_cast<size_t>(m_cursor - m_start - 2));
    7514 
    7515  // iterate the result between the quotes
    7516  for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i)
    7517  {
    7518  // process escaped characters
    7519  if (*i == '\\')
    7520  {
    7521  // read next character
    7522  ++i;
    7523 
    7524  switch (*i)
    7525  {
    7526  // the default escapes
    7527  case 't':
    7528  {
    7529  result += "\t";
    7530  break;
    7531  }
    7532  case 'b':
    7533  {
    7534  result += "\b";
    7535  break;
    7536  }
    7537  case 'f':
    7538  {
    7539  result += "\f";
    7540  break;
    7541  }
    7542  case 'n':
    7543  {
    7544  result += "\n";
    7545  break;
    7546  }
    7547  case 'r':
    7548  {
    7549  result += "\r";
    7550  break;
    7551  }
    7552  case '\\':
    7553  {
    7554  result += "\\";
    7555  break;
    7556  }
    7557  case '/':
    7558  {
    7559  result += "/";
    7560  break;
    7561  }
    7562  case '"':
    7563  {
    7564  result += "\"";
    7565  break;
    7566  }
    7567 
    7568  // unicode
    7569  case 'u':
    7570  {
    7571  // get code xxxx from uxxxx
    7572  auto codepoint = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>(i + 1),
    7573  4).c_str(), nullptr, 16);
    7574 
    7575  // check if codepoint is a high surrogate
    7576  if (codepoint >= 0xD800 and codepoint <= 0xDBFF)
    7577  {
    7578  // make sure there is a subsequent unicode
    7579  if ((i + 6 >= m_limit) or * (i + 5) != '\\' or * (i + 6) != 'u')
    7580  {
    7581  throw std::invalid_argument("missing low surrogate");
    7582  }
    7583 
    7584  // get code yyyy from uxxxx\uyyyy
    7585  auto codepoint2 = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>
    7586  (i + 7), 4).c_str(), nullptr, 16);
    7587  result += to_unicode(codepoint, codepoint2);
    7588  // skip the next 10 characters (xxxx\uyyyy)
    7589  i += 10;
    7590  }
    7591  else
    7592  {
    7593  // add unicode character(s)
    7594  result += to_unicode(codepoint);
    7595  // skip the next four characters (xxxx)
    7596  i += 4;
    7597  }
    7598  break;
    7599  }
    7600  }
    7601  }
    7602  else
    7603  {
    7604  // all other characters are just copied to the end of the
    7605  // string
    7606  result.append(1, static_cast<typename string_t::value_type>(*i));
    7607  }
    7608  }
    7609 
    7610  return result;
    7611  }
    7612 
    7630  long double get_number() const
    7631  {
    7632  // conversion
    7633  typename string_t::value_type* endptr;
    7634  assert(m_start != nullptr);
    7635  const auto float_val = std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start),
    7636  &endptr);
    7637 
    7638  // return float_val if the whole number was translated and NAN
    7639  // otherwise
    7640  return (reinterpret_cast<lexer_char_t*>(endptr) == m_cursor) ? float_val : NAN;
    7641  }
    7642 
    7643  private:
    7645  std::istream* m_stream = nullptr;
    7647  string_t m_buffer;
    7649  const lexer_char_t* m_content = nullptr;
    7651  const lexer_char_t* m_start = nullptr;
    7653  const lexer_char_t* m_marker = nullptr;
    7655  const lexer_char_t* m_cursor = nullptr;
    7657  const lexer_char_t* m_limit = nullptr;
    7658  };
    7659 
    7665  class parser
    7666  {
    7667  public:
    7669  parser(const string_t& s, parser_callback_t cb = nullptr)
    7670  : callback(cb), m_lexer(s)
    7671  {
    7672  // read first token
    7673  get_token();
    7674  }
    7675 
    7677  parser(std::istream& _is, parser_callback_t cb = nullptr)
    7678  : callback(cb), m_lexer(&_is)
    7679  {
    7680  // read first token
    7681  get_token();
    7682  }
    7683 
    7685  basic_json parse()
    7686  {
    7687  basic_json result = parse_internal(true);
    7688 
    7689  expect(lexer::token_type::end_of_input);
    7690 
    7691  // return parser result and replace it with null in case the
    7692  // top-level value was discarded by the callback function
    7693  return result.is_discarded() ? basic_json() : result;
    7694  }
    7695 
    7696  private:
    7698  basic_json parse_internal(bool keep)
    7699  {
    7700  auto result = basic_json(value_t::discarded);
    7701 
    7702  switch (last_token)
    7703  {
    7704  case lexer::token_type::begin_object:
    7705  {
    7706  if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))
    7707  {
    7708  // explicitly set result to object to cope with {}
    7709  result.m_type = value_t::object;
    7710  result.m_value = json_value(value_t::object);
    7711  }
    7712 
    7713  // read next token
    7714  get_token();
    7715 
    7716  // closing } -> we are done
    7717  if (last_token == lexer::token_type::end_object)
    7718  {
    7719  get_token();
    7720  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
    7721  {
    7722  result = basic_json(value_t::discarded);
    7723  }
    7724  return result;
    7725  }
    7726 
    7727  // no comma is expected here
    7728  unexpect(lexer::token_type::value_separator);
    7729 
    7730  // otherwise: parse key-value pairs
    7731  do
    7732  {
    7733  // ugly, but could be fixed with loop reorganization
    7734  if (last_token == lexer::token_type::value_separator)
    7735  {
    7736  get_token();
    7737  }
    7738 
    7739  // store key
    7740  expect(lexer::token_type::value_string);
    7741  const auto key = m_lexer.get_string();
    7742 
    7743  bool keep_tag = false;
    7744  if (keep)
    7745  {
    7746  if (callback)
    7747  {
    7748  basic_json k(key);
    7749  keep_tag = callback(depth, parse_event_t::key, k);
    7750  }
    7751  else
    7752  {
    7753  keep_tag = true;
    7754  }
    7755  }
    7756 
    7757  // parse separator (:)
    7758  get_token();
    7759  expect(lexer::token_type::name_separator);
    7760 
    7761  // parse and add value
    7762  get_token();
    7763  auto value = parse_internal(keep);
    7764  if (keep and keep_tag and not value.is_discarded())
    7765  {
    7766  result[key] = std::move(value);
    7767  }
    7768  }
    7769  while (last_token == lexer::token_type::value_separator);
    7770 
    7771  // closing }
    7772  expect(lexer::token_type::end_object);
    7773  get_token();
    7774  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
    7775  {
    7776  result = basic_json(value_t::discarded);
    7777  }
    7778 
    7779  return result;
    7780  }
    7781 
    7782  case lexer::token_type::begin_array:
    7783  {
    7784  if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))
    7785  {
    7786  // explicitly set result to object to cope with []
    7787  result.m_type = value_t::array;
    7788  result.m_value = json_value(value_t::array);
    7789  }
    7790 
    7791  // read next token
    7792  get_token();
    7793 
    7794  // closing ] -> we are done
    7795  if (last_token == lexer::token_type::end_array)
    7796  {
    7797  get_token();
    7798  if (callback and not callback(--depth, parse_event_t::array_end, result))
    7799  {
    7800  result = basic_json(value_t::discarded);
    7801  }
    7802  return result;
    7803  }
    7804 
    7805  // no comma is expected here
    7806  unexpect(lexer::token_type::value_separator);
    7807 
    7808  // otherwise: parse values
    7809  do
    7810  {
    7811  // ugly, but could be fixed with loop reorganization
    7812  if (last_token == lexer::token_type::value_separator)
    7813  {
    7814  get_token();
    7815  }
    7816 
    7817  // parse value
    7818  auto value = parse_internal(keep);
    7819  if (keep and not value.is_discarded())
    7820  {
    7821  result.push_back(std::move(value));
    7822  }
    7823  }
    7824  while (last_token == lexer::token_type::value_separator);
    7825 
    7826  // closing ]
    7827  expect(lexer::token_type::end_array);
    7828  get_token();
    7829  if (keep and callback and not callback(--depth, parse_event_t::array_end, result))
    7830  {
    7831  result = basic_json(value_t::discarded);
    7832  }
    7833 
    7834  return result;
    7835  }
    7836 
    7837  case lexer::token_type::literal_null:
    7838  {
    7839  get_token();
    7840  result.m_type = value_t::null;
    7841  break;
    7842  }
    7843 
    7844  case lexer::token_type::value_string:
    7845  {
    7846  const auto s = m_lexer.get_string();
    7847  get_token();
    7848  result = basic_json(s);
    7849  break;
    7850  }
    7851 
    7852  case lexer::token_type::literal_true:
    7853  {
    7854  get_token();
    7855  result.m_type = value_t::boolean;
    7856  result.m_value = true;
    7857  break;
    7858  }
    7859 
    7860  case lexer::token_type::literal_false:
    7861  {
    7862  get_token();
    7863  result.m_type = value_t::boolean;
    7864  result.m_value = false;
    7865  break;
    7866  }
    7867 
    7868  case lexer::token_type::value_number:
    7869  {
    7870  auto float_val = m_lexer.get_number();
    7871 
    7872  // NAN is returned if token could not be translated
    7873  // completely
    7874  if (std::isnan(float_val))
    7875  {
    7876  throw std::invalid_argument(std::string("parse error - ") +
    7877  m_lexer.get_token() + " is not a number");
    7878  }
    7879 
    7880  get_token();
    7881 
    7882  // check if conversion loses precision
    7883  const auto int_val = static_cast<number_integer_t>(float_val);
    7884  if (approx(float_val, static_cast<long double>(int_val)))
    7885  {
    7886  // we would not lose precision -> return int
    7887  result.m_type = value_t::number_integer;
    7888  result.m_value = int_val;
    7889  }
    7890  else
    7891  {
    7892  // we would lose precision -> return float
    7893  result.m_type = value_t::number_float;
    7894  result.m_value = static_cast<number_float_t>(float_val);
    7895  }
    7896  break;
    7897  }
    7898 
    7899  default:
    7900  {
    7901  // the last token was unexpected
    7902  unexpect(last_token);
    7903  }
    7904  }
    7905 
    7906  if (keep and callback and not callback(depth, parse_event_t::value, result))
    7907  {
    7908  result = basic_json(value_t::discarded);
    7909  }
    7910  return result;
    7911  }
    7912 
    7914  typename lexer::token_type get_token()
    7915  {
    7916  last_token = m_lexer.scan();
    7917  return last_token;
    7918  }
    7919 
    7920  void expect(typename lexer::token_type t) const
    7921  {
    7922  if (t != last_token)
    7923  {
    7924  std::string error_msg = "parse error - unexpected ";
    7925  error_msg += (last_token == lexer::token_type::parse_error ? ("'" + m_lexer.get_token() + "'") :
    7926  lexer::token_type_name(last_token));
    7927  error_msg += "; expected " + lexer::token_type_name(t);
    7928  throw std::invalid_argument(error_msg);
    7929  }
    7930  }
    7931 
    7932  void unexpect(typename lexer::token_type t) const
    7933  {
    7934  if (t == last_token)
    7935  {
    7936  std::string error_msg = "parse error - unexpected ";
    7937  error_msg += (last_token == lexer::token_type::parse_error ? ("'" + m_lexer.get_token() + "'") :
    7938  lexer::token_type_name(last_token));
    7939  throw std::invalid_argument(error_msg);
    7940  }
    7941  }
    7942 
    7943  private:
    7945  int depth = 0;
    7947  parser_callback_t callback;
    7949  typename lexer::token_type last_token = lexer::token_type::uninitialized;
    7951  lexer m_lexer;
    7952  };
    7953 };
    7954 
    7955 
    7957 // presets //
    7959 
    7969 }
    7970 
    7971 
    7973 // nonmember functions //
    7975 
    7976 // specialization of std::swap, and std::hash
    7977 namespace std
    7978 {
    7984 template <>
    7985 inline void swap(nlohmann::json& j1,
    7986  nlohmann::json& j2) noexcept(
    7987  is_nothrow_move_constructible<nlohmann::json>::value and
    7988  is_nothrow_move_assignable<nlohmann::json>::value
    7989  )
    7990 {
    7991  j1.swap(j2);
    7992 }
    7993 
    7995 template <>
    7996 struct hash<nlohmann::json>
    7997 {
    8003  std::size_t operator()(const nlohmann::json& j) const
    8004  {
    8005  // a naive hashing via the string representation
    8006  const auto& h = hash<nlohmann::json::string_t>();
    8007  return h(j.dump());
    8008  }
    8009 };
    8010 }
    8011 
    8024 inline nlohmann::json operator "" _json(const char* s, std::size_t)
    8025 {
    8026  return nlohmann::json::parse(reinterpret_cast<const nlohmann::json::string_t::value_type*>(s));
    8027 }
    8028 
    8029 #endif
    bool operator!=(const const_iterator &other) const
    comparison: not equal
    Definition: json.hpp:6025
    +
    iterator insert(const_iterator pos, basic_json &&val)
    inserts element
    Definition: json.hpp:4308
    +
    iterator operator++(int)
    post-increment (it++)
    Definition: json.hpp:6273
    +
    friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
    comparison: less than or equal
    Definition: json.hpp:4919
    +
    typename std::allocator_traits< allocator_type >::pointer pointer
    the type of an element pointer
    Definition: json.hpp:228
    +
    json_reverse_iterator operator-(difference_type i) const
    subtract from iterator
    Definition: json.hpp:6428
    +
    static basic_json object(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an object from an initializer list
    Definition: json.hpp:1510
    +
    const_reference operator[](size_type idx) const
    access specified array element
    Definition: json.hpp:2870
    +
    reference operator[](const T(&key)[n])
    access specified object element
    Definition: json.hpp:3004
    +
    typename basic_json::const_pointer pointer
    defines a pointer to the type iterated over (value_type)
    Definition: json.hpp:5697
    +
    static iteration_proxy< iterator > iterator_wrapper(reference cont)
    wrapper to access iterator member functions in range-based for
    Definition: json.hpp:3842
    +
    const_iterator & operator--()
    pre-decrement (–it)
    Definition: json.hpp:5966
    +
    friend std::istream & operator>>(std::istream &i, basic_json &j)
    deserialize from stream
    Definition: json.hpp:5132
    +
    const_iterator & operator=(const_iterator other) noexcept( std::is_nothrow_move_constructible< pointer >::value and std::is_nothrow_move_assignable< pointer >::value and std::is_nothrow_move_constructible< internal_iterator >::value and std::is_nothrow_move_assignable< internal_iterator >::value )
    copy assignment
    Definition: json.hpp:5766
    +
    typename basic_json::value_type value_type
    the type of the values when the iterator is dereferenced
    Definition: json.hpp:5693
    +
    reference & operator=(basic_json other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    copy assignment
    Definition: json.hpp:1782
    +
    iterator insert(const_iterator pos, const_iterator first, const_iterator last)
    inserts elements
    Definition: json.hpp:4390
    +
    iterator insert(const_iterator pos, size_type cnt, const basic_json &val)
    inserts elements
    Definition: json.hpp:4337
    +
    json_reverse_iterator operator--(int)
    post-decrement (it–)
    Definition: json.hpp:6400
    +
    StringType string_t
    a type for a string
    Definition: json.hpp:434
    +
    void push_back(const typename object_t::value_type &val)
    add an object to an object
    Definition: json.hpp:4229
    +
    basic_json(boolean_t val)
    create a boolean (explicit)
    Definition: json.hpp:1132
    +
    static basic_json array(std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
    explicitly create an array from an initializer list
    Definition: json.hpp:1470
    +
    iterator & operator++()
    pre-increment (++it)
    Definition: json.hpp:6281
    +
    friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
    comparison: not equal
    Definition: json.hpp:4775
    +
    ArrayType< basic_json, AllocatorType< basic_json >> array_t
    a type for an array
    Definition: json.hpp:387
    +
    const_iterator & operator++()
    pre-increment (++it)
    Definition: json.hpp:5929
    +
    difference_type operator-(const json_reverse_iterator &other) const
    return difference
    Definition: json.hpp:6436
    +
    basic_json<> json
    default JSON class
    Definition: json.hpp:7968
    +
    reference front()
    access the first element
    Definition: json.hpp:3173
    +
    bool is_array() const noexcept
    return whether value is an array
    Definition: json.hpp:2095
    +
    const_iterator find(typename object_t::key_type key) const
    find an element in a JSON object
    Definition: json.hpp:3553
    +
    std::reverse_iterator< Base > base_iterator
    shortcut to the reverse iterator adaptor
    Definition: json.hpp:6372
    +
    json_reverse_iterator(const typename base_iterator::iterator_type &it)
    create reverse iterator from iterator
    Definition: json.hpp:6377
    +
    a class to store JSON values
    Definition: json.hpp:188
    +
    json_reverse_iterator & operator--()
    pre-decrement (–it)
    Definition: json.hpp:6406
    +
    basic_json(const object_t &val)
    create an object (explicit)
    Definition: json.hpp:934
    +
    friend bool operator==(std::nullptr_t, const_reference v) noexcept
    comparison: equal
    Definition: json.hpp:4754
    +
    void push_back(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4143
    +
    const_iterator cbegin() const
    returns a const iterator to the first element
    Definition: json.hpp:3653
    +
    bool is_string() const noexcept
    return whether value is a string
    Definition: json.hpp:2114
    +
    iterator & operator+=(difference_type i)
    add to iterator
    Definition: json.hpp:6303
    +
    const PointerType get_ptr() const noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2560
    +
    basic_json(const CompatibleStringType &val)
    create a string (implicit)
    Definition: json.hpp:1114
    +
    reference operator+=(basic_json &&val)
    add an object to an array
    Definition: json.hpp:4169
    +
    basic_json(size_type cnt, const basic_json &val)
    construct an array with count copies of given value
    Definition: json.hpp:1534
    +
    a mutable random access iterator for the basic_json class
    Definition: json.hpp:6228
    +
    iterator & operator-=(difference_type i)
    subtract from iterator
    Definition: json.hpp:6310
    +
    static basic_json parse(std::istream &&i, parser_callback_t cb=nullptr)
    deserialize from stream
    Definition: json.hpp:5094
    +
    reference operator[](const typename object_t::key_type &key)
    access specified object element
    Definition: json.hpp:2911
    STL namespace.
    -
    difference_type operator-(const iterator &other) const
    Definition: json.hpp:6183
    -
    reference value() const
    return the value of an iterator
    Definition: json.hpp:6055
    -
    static iteration_proxy< const_iterator > iterator_wrapper(const_reference cont)
    wrapper to access iterator member functions in range-based for
    Definition: json.hpp:3811
    -
    const_iterator end() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3649
    -
    const_iterator(const const_iterator &other) noexcept
    copy constructor
    Definition: json.hpp:5648
    -
    reference at(const typename object_t::key_type &key)
    access specified object element with bounds checking
    Definition: json.hpp:2710
    -
    object_t::key_type key() const
    return the key of an object iterator
    Definition: json.hpp:6042
    -
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3639
    -
    ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
    a type for an object
    Definition: json.hpp:340
    -
    reference operator*()
    return a reference to the value pointed to by the iterator
    Definition: json.hpp:6112
    -
    reverse_iterator rend()
    returns an iterator to the reverse-end
    Definition: json.hpp:3728
    -
    bool is_object() const noexcept
    return whether value is an object
    Definition: json.hpp:2065
    -
    const_iterator operator-(difference_type i)
    subtract from iterator
    Definition: json.hpp:5978
    -
    bool is_discarded() const noexcept
    return whether value is discarded
    Definition: json.hpp:2127
    -
    basic_json(const CompatibleArrayType &val)
    create an array (implicit)
    Definition: json.hpp:1029
    -
    typename basic_json::const_reference reference
    defines a reference to the type iterated over (value_type)
    Definition: json.hpp:5590
    -
    const_reverse_iterator rend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3736
    -
    size_type erase(const typename object_t::key_type &key)
    remove element from a JSON object given a key
    Definition: json.hpp:3428
    -
    bool is_boolean() const noexcept
    return whether value is a boolean
    Definition: json.hpp:1976
    -
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3580
    -
    const_reference at(const typename object_t::key_type &key) const
    access specified object element with bounds checking
    Definition: json.hpp:2757
    -
    reference operator+=(const basic_json &val)
    add an object to an array
    Definition: json.hpp:4153
    -
    AllocatorType< basic_json > allocator_type
    the allocator type
    Definition: json.hpp:224
    -
    basic_json(const number_float_t val)
    create a floating-point number (explicit)
    Definition: json.hpp:1258
    -
    bool is_number_integer() const noexcept
    return whether value is an integer number
    Definition: json.hpp:2023
    -
    iterator operator+(difference_type i)
    add to iterator
    Definition: json.hpp:6168
    -
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:819
    -
    basic_json(const typename string_t::value_type *val)
    create a string (explicit)
    Definition: json.hpp:1082
    -
    const_iterator()=default
    default constructor
    -
    the parser read [ and started to process a JSON array
    -
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3500
    -
    basic_json(const value_t value_type)
    create an empty value with a given type
    Definition: json.hpp:866
    -
    friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
    comparison: greater than or equal
    Definition: json.hpp:4861
    -
    iterator & operator--()
    pre-decrement (–it)
    Definition: json.hpp:6147
    -
    friend bool operator<(const_reference lhs, const_reference rhs) noexcept
    comparison: less than
    Definition: json.hpp:4756
    -
    pointer operator->() const
    dereference the iterator
    Definition: json.hpp:5759
    -
    discarded by the the parser callback function
    -
    const_reference operator[](const typename object_t::key_type &key) const
    read-only access specified object element
    Definition: json.hpp:2934
    -
    const_iterator cend() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3673
    -
    typename Base::reference reference
    the reference type for the pointed-to element
    Definition: json.hpp:6225
    -
    size_type size() const noexcept
    returns the number of elements
    Definition: json.hpp:3911
    -
    static allocator_type get_allocator()
    returns the allocator associated with the container
    Definition: json.hpp:249
    +
    difference_type operator-(const iterator &other) const
    Definition: json.hpp:6332
    +
    reference value() const
    return the value of an iterator
    Definition: json.hpp:6204
    +
    static iteration_proxy< const_iterator > iterator_wrapper(const_reference cont)
    wrapper to access iterator member functions in range-based for
    Definition: json.hpp:3850
    +
    const_iterator end() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3688
    +
    const_iterator(const const_iterator &other) noexcept
    copy constructor
    Definition: json.hpp:5761
    +
    reference at(const typename object_t::key_type &key)
    access specified object element with bounds checking
    Definition: json.hpp:2730
    +
    object_t::key_type key() const
    return the key of an object iterator
    Definition: json.hpp:6189
    +
    iterator end()
    returns an iterator to one past the last element
    Definition: json.hpp:3678
    +
    ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
    a type for an object
    Definition: json.hpp:341
    +
    reference operator*()
    return a reference to the value pointed to by the iterator
    Definition: json.hpp:6261
    +
    reverse_iterator rend()
    returns an iterator to the reverse-end
    Definition: json.hpp:3767
    +
    bool is_object() const noexcept
    return whether value is an object
    Definition: json.hpp:2076
    +
    const_iterator operator-(difference_type i)
    subtract from iterator
    Definition: json.hpp:6121
    +
    bool is_discarded() const noexcept
    return whether value is discarded
    Definition: json.hpp:2138
    +
    basic_json(const CompatibleArrayType &val)
    create an array (implicit)
    Definition: json.hpp:1030
    +
    typename basic_json::const_reference reference
    defines a reference to the type iterated over (value_type)
    Definition: json.hpp:5699
    +
    const_reverse_iterator rend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3775
    +
    size_type erase(const typename object_t::key_type &key)
    remove element from a JSON object given a key
    Definition: json.hpp:3462
    +
    bool is_boolean() const noexcept
    return whether value is a boolean
    Definition: json.hpp:1987
    +
    iterator begin()
    returns an iterator to the first element
    Definition: json.hpp:3619
    +
    const_reference at(const typename object_t::key_type &key) const
    access specified object element with bounds checking
    Definition: json.hpp:2778
    +
    reference operator+=(const basic_json &val)
    add an object to an array
    Definition: json.hpp:4203
    +
    AllocatorType< basic_json > allocator_type
    the allocator type
    Definition: json.hpp:225
    +
    basic_json(const number_float_t val)
    create a floating-point number (explicit)
    Definition: json.hpp:1259
    +
    bool is_number_integer() const noexcept
    return whether value is an integer number
    Definition: json.hpp:2034
    +
    iterator operator+(difference_type i)
    add to iterator
    Definition: json.hpp:6317
    +
    std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
    per-element parser callback type
    Definition: json.hpp:820
    +
    basic_json(const typename string_t::value_type *val)
    create a string (explicit)
    Definition: json.hpp:1083
    +
    iterator find(typename object_t::key_type key)
    find an element in a JSON object
    Definition: json.hpp:3536
    +
    basic_json(const value_t value_type)
    create an empty value with a given type
    Definition: json.hpp:867
    +
    friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
    comparison: greater than or equal
    Definition: json.hpp:4963
    +
    iterator & operator--()
    pre-decrement (–it)
    Definition: json.hpp:6296
    +
    friend bool operator<(const_reference lhs, const_reference rhs) noexcept
    comparison: less than
    Definition: json.hpp:4836
    +
    pointer operator->() const
    dereference the iterator
    Definition: json.hpp:5886
    +
    const_reference operator[](const typename object_t::key_type &key) const
    read-only access specified object element
    Definition: json.hpp:2959
    +
    const_iterator cend() const
    returns a const iterator to one past the last element
    Definition: json.hpp:3712
    +
    typename Base::reference reference
    the reference type for the pointed-to element
    Definition: json.hpp:6374
    +
    size_type size() const noexcept
    returns the number of elements
    Definition: json.hpp:3952
    +
    static allocator_type get_allocator()
    returns the allocator associated with the container
    Definition: json.hpp:250
    object (unordered set of name/value pairs)
    -
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2620
    -
    the parser read } and finished processing a JSON object
    -
    iterator()=default
    default constructor
    -
    json_reverse_iterator(const base_iterator &it)
    create reverse iterator from base class
    Definition: json.hpp:6233
    -
    value_t type() const noexcept
    return the type of the JSON value (explicit)
    Definition: json.hpp:1897
    -
    friend std::ostream & operator>>(const basic_json &j, std::ostream &o)
    serialize to stream
    Definition: json.hpp:4916
    -
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3092
    -
    object_t::key_type key() const
    return the key of an object iterator
    Definition: json.hpp:6299
    -
    bool is_structured() const noexcept
    return whether type is structured
    Definition: json.hpp:1938
    -
    namespace for Niels Lohmann
    Definition: json.hpp:78
    -
    typename basic_json::difference_type difference_type
    a type to represent differences between iterators
    Definition: json.hpp:5586
    -
    void swap(array_t &other)
    exchanges the values
    Definition: json.hpp:4462
    -
    reverse_iterator rbegin()
    returns an iterator to the reverse-beginning
    Definition: json.hpp:3697
    -
    reference operator+=(const typename object_t::value_type &val)
    add an object to an object
    Definition: json.hpp:4202
    - -
    reference operator[](difference_type n) const
    access to successor
    Definition: json.hpp:6189
    -
    std::size_t size_type
    a type to represent container sizes
    Definition: json.hpp:221
    -
    const_reverse_iterator rbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3705
    -
    ~basic_json()
    destructor
    Definition: json.hpp:1797
    -
    basic_json(const basic_json &other)
    copy constructor
    Definition: json.hpp:1675
    -
    const_iterator operator+(difference_type i)
    add to iterator
    Definition: json.hpp:5970
    -
    value_t
    the JSON type enumeration
    Definition: json.hpp:611
    -
    const value_type & const_reference
    the type of an element const reference
    Definition: json.hpp:215
    -
    basic_json(const CompatibleNumberIntegerType val) noexcept
    create an integer number (implicit)
    Definition: json.hpp:1229
    -
    bool is_null() const noexcept
    return whether value is null
    Definition: json.hpp:1957
    -
    void swap(string_t &other)
    exchanges the values
    Definition: json.hpp:4528
    -
    reference value() const
    return the value of an iterator
    Definition: json.hpp:6195
    -
    const_iterator operator--(int)
    post-decrement (it–)
    Definition: json.hpp:5823
    -
    void erase(const size_type idx)
    remove element from a JSON array given an index
    Definition: json.hpp:3465
    -
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4028
    -
    pointer operator->()
    dereference the iterator
    Definition: json.hpp:6118
    -
    basic_json value_type
    the type of elements in a basic_json container
    Definition: json.hpp:209
    +
    reference at(size_type idx)
    access specified array element with bounds checking
    Definition: json.hpp:2638
    +
    json_reverse_iterator(const base_iterator &it)
    create reverse iterator from base class
    Definition: json.hpp:6382
    +
    value_t type() const noexcept
    return the type of the JSON value (explicit)
    Definition: json.hpp:1908
    +
    friend std::ostream & operator>>(const basic_json &j, std::ostream &o)
    serialize to stream
    Definition: json.hpp:5018
    +
    ValueType value(const typename object_t::key_type &key, ValueType default_value) const
    access specified object element with default value
    Definition: json.hpp:3122
    +
    object_t::key_type key() const
    return the key of an object iterator
    Definition: json.hpp:6448
    +
    bool is_structured() const noexcept
    return whether type is structured
    Definition: json.hpp:1949
    +
    namespace for Niels Lohmann
    Definition: json.hpp:79
    +
    typename basic_json::difference_type difference_type
    a type to represent differences between iterators
    Definition: json.hpp:5695
    +
    void swap(array_t &other)
    exchanges the values
    Definition: json.hpp:4517
    +
    reverse_iterator rbegin()
    returns an iterator to the reverse-beginning
    Definition: json.hpp:3736
    +
    reference operator+=(const typename object_t::value_type &val)
    add an object to an object
    Definition: json.hpp:4253
    +
    basic_json(const number_integer_t val)
    create an integer number (explicit)
    Definition: json.hpp:1166
    +
    reference operator[](difference_type n) const
    access to successor
    Definition: json.hpp:6338
    +
    std::size_t size_type
    a type to represent container sizes
    Definition: json.hpp:222
    +
    const_reverse_iterator rbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3744
    +
    ~basic_json()
    destructor
    Definition: json.hpp:1808
    +
    basic_json(const basic_json &other)
    copy constructor
    Definition: json.hpp:1683
    +
    const_iterator operator+(difference_type i)
    add to iterator
    Definition: json.hpp:6113
    +
    value_t
    the JSON type enumeration
    Definition: json.hpp:612
    +
    const value_type & const_reference
    the type of an element const reference
    Definition: json.hpp:216
    +
    basic_json(const CompatibleNumberIntegerType val) noexcept
    create an integer number (implicit)
    Definition: json.hpp:1230
    +
    bool is_null() const noexcept
    return whether value is null
    Definition: json.hpp:1968
    +
    void swap(string_t &other)
    exchanges the values
    Definition: json.hpp:4585
    +
    reference value() const
    return the value of an iterator
    Definition: json.hpp:6344
    +
    const_iterator operator--(int)
    post-decrement (it–)
    Definition: json.hpp:5958
    +
    ValueType get() const
    get a value (explicit)
    Definition: json.hpp:2461
    +
    void erase(const size_type idx)
    remove element from a JSON array given an index
    Definition: json.hpp:3500
    +
    void clear() noexcept
    clears the contents
    Definition: json.hpp:4073
    +
    pointer operator->()
    dereference the iterator
    Definition: json.hpp:6267
    +
    basic_json value_type
    the type of elements in a basic_json container
    Definition: json.hpp:210
    array (ordered collection of values)
    -
    const_reference front() const
    access the first element
    Definition: json.hpp:3151
    -
    bool operator>=(const const_iterator &other) const
    comparison: greater than or equal
    Definition: json.hpp:5932
    -
    iterator insert(const_iterator pos, std::initializer_list< basic_json > ilist)
    inserts elements
    Definition: json.hpp:4394
    -
    std::ptrdiff_t difference_type
    a type to represent differences between iterators
    Definition: json.hpp:218
    -
    const_iterator & operator+=(difference_type i)
    add to iterator
    Definition: json.hpp:5938
    -
    basic_json(std::initializer_list< basic_json > init, bool type_deduction=true, value_t manual_type=value_t::array)
    create a container (array or object) from an initializer list
    Definition: json.hpp:1377
    -
    difference_type operator-(const const_iterator &other) const
    return difference
    Definition: json.hpp:5986
    -
    friend bool operator==(const_reference lhs, const_reference rhs) noexcept
    comparison: equal
    Definition: json.hpp:4607
    -
    bool is_number() const noexcept
    return whether value is a number
    Definition: json.hpp:2000
    -
    BooleanType boolean_t
    a type for a boolean
    Definition: json.hpp:459
    -
    const_reverse_iterator crend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3782
    -
    basic_json() noexcept=default
    create a null object (implicitly)
    -
    the parser read a key of a value in an object
    -
    bool empty() const noexcept
    checks whether the container is empty
    Definition: json.hpp:3855
    -
    string_t value(const typename object_t::key_type &key, const char *default_value) const
    overload for a default value of type const char*
    Definition: json.hpp:3118
    -
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4431
    -
    json_reverse_iterator< typename basic_json::const_iterator > const_reverse_iterator
    a const reverse iterator for a basic_json container
    Definition: json.hpp:241
    -
    const_reverse_iterator crbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3759
    -
    reference value() const
    return the value of an iterator
    Definition: json.hpp:6306
    +
    const_reference front() const
    access the first element
    Definition: json.hpp:3181
    +
    bool operator>=(const const_iterator &other) const
    comparison: greater than or equal
    Definition: json.hpp:6073
    +
    iterator insert(const_iterator pos, std::initializer_list< basic_json > ilist)
    inserts elements
    Definition: json.hpp:4448
    +
    std::ptrdiff_t difference_type
    a type to represent differences between iterators
    Definition: json.hpp:219
    +
    const_iterator & operator+=(difference_type i)
    add to iterator
    Definition: json.hpp:6079
    +
    basic_json(std::initializer_list< basic_json > init, bool type_deduction=true, value_t manual_type=value_t::array)
    create a container (array or object) from an initializer list
    Definition: json.hpp:1378
    +
    difference_type operator-(const const_iterator &other) const
    return difference
    Definition: json.hpp:6129
    +
    friend bool operator==(const_reference lhs, const_reference rhs) noexcept
    comparison: equal
    Definition: json.hpp:4665
    +
    bool is_number() const noexcept
    return whether value is a number
    Definition: json.hpp:2011
    +
    BooleanType boolean_t
    a type for a boolean
    Definition: json.hpp:460
    +
    const_reverse_iterator crend() const
    returns a const reverse iterator to one before the first
    Definition: json.hpp:3821
    +
    bool empty() const noexcept
    checks whether the container is empty
    Definition: json.hpp:3894
    +
    string_t value(const typename object_t::key_type &key, const char *default_value) const
    overload for a default value of type const char*
    Definition: json.hpp:3148
    +
    void swap(reference other) noexcept( std::is_nothrow_move_constructible< value_t >::value and std::is_nothrow_move_assignable< value_t >::value and std::is_nothrow_move_constructible< json_value >::value and std::is_nothrow_move_assignable< json_value >::value )
    exchanges the values
    Definition: json.hpp:4486
    +
    const_reverse_iterator crbegin() const
    returns a const reverse iterator to the last element
    Definition: json.hpp:3798
    +
    reference value() const
    return the value of an iterator
    Definition: json.hpp:6455
    -
    const_iterator(pointer object)
    constructor for a given JSON instance
    Definition: json.hpp:5598
    -
    friend bool operator<(const value_t lhs, const value_t rhs)
    comparison operator for JSON types
    Definition: json.hpp:4561
    -
    iterator(pointer object) noexcept
    constructor for a given JSON instance
    Definition: json.hpp:6090
    -
    bool operator<(const const_iterator &other) const
    comparison: smaller
    Definition: json.hpp:5892
    -
    string_t dump(const int indent=-1) const
    serialization
    Definition: json.hpp:1866
    -
    friend bool operator!=(const_reference v, std::nullptr_t) noexcept
    comparison: not equal
    Definition: json.hpp:4718
    -
    const_iterator & operator-=(difference_type i)
    subtract from iterator
    Definition: json.hpp:5964
    -
    basic_json(const int val)
    create an integer number from an enum type (explicit)
    Definition: json.hpp:1194
    -
    basic_json(const array_t &val)
    create an array (explicit)
    Definition: json.hpp:992
    -
    number value (floating-point)
    -
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:4955
    -
    InteratorType erase(InteratorType first, InteratorType last)
    remove elements given an iterator range
    Definition: json.hpp:3347
    -
    json_reverse_iterator operator++(int)
    post-increment (it++)
    Definition: json.hpp:6238
    -
    PointerType get_ptr() noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2527
    - -
    const_iterator(const iterator &other)
    copy constructor given a nonconst iterator
    Definition: json.hpp:5623
    -
    friend bool operator!=(std::nullptr_t, const_reference v) noexcept
    comparison: not equal
    Definition: json.hpp:4727
    -
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3244
    -
    bool operator<=(const const_iterator &other) const
    comparison: less than or equal
    Definition: json.hpp:5920
    -
    basic_json(const CompatibleNumberFloatType val) noexcept
    create an floating-point number (implicit)
    Definition: json.hpp:1304
    -
    reference back()
    access the last element
    Definition: json.hpp:3177
    -
    bool is_number_float() const noexcept
    return whether value is a floating-point number
    Definition: json.hpp:2046
    -
    the parser read { and started to process a JSON object
    -
    const_iterator operator++(int)
    post-increment (it++)
    Definition: json.hpp:5788
    -
    typename std::allocator_traits< allocator_type >::const_pointer const_pointer
    the type of an element const pointer
    Definition: json.hpp:229
    -
    basic_json(const string_t &val)
    create a string (explicit)
    Definition: json.hpp:1058
    -
    iterator(const iterator &other) noexcept
    copy constructor
    Definition: json.hpp:6095
    -
    const_reference back() const
    access the last element
    Definition: json.hpp:3187
    -
    basic_json(InputIT first, InputIT last)
    construct a JSON container given an iterator range
    Definition: json.hpp:1577
    -
    static basic_json parse(std::istream &i, parser_callback_t cb=nullptr)
    deserialize from stream
    Definition: json.hpp:4984
    -
    size_type count(typename object_t::key_type key) const
    returns the number of occurrences of a key in a JSON object
    Definition: json.hpp:3546
    -
    size_type max_size() const noexcept
    returns the maximum possible number of elements
    Definition: json.hpp:3971
    -
    void push_back(const basic_json &val)
    add an object to an array
    Definition: json.hpp:4130
    -
    bool operator==(const const_iterator &other) const
    comparison: equal
    Definition: json.hpp:5858
    -
    json_reverse_iterator & operator++()
    pre-increment (++it)
    Definition: json.hpp:6244
    -
    bool operator>(const const_iterator &other) const
    comparison: greater than
    Definition: json.hpp:5926
    -
    friend bool operator>(const_reference lhs, const_reference rhs) noexcept
    comparison: greater than
    Definition: json.hpp:4839
    -
    basic_json(basic_json &&other) noexcept
    move constructor
    Definition: json.hpp:1741
    -
    const_reference operator[](const T(&key)[n]) const
    read-only access specified object element
    Definition: json.hpp:3027
    -
    const_iterator begin() const
    returns a const iterator to the first element
    Definition: json.hpp:3590
    -
    const_reference at(size_type idx) const
    access specified array element with bounds checking
    Definition: json.hpp:2663
    -
    json_reverse_iterator & operator+=(difference_type i)
    add to iterator
    Definition: json.hpp:6264
    -
    a const random access iterator for the basic_json class
    Definition: json.hpp:5577
    -
    a template for a reverse iterator class
    Definition: json.hpp:232
    -
    void swap(object_t &other)
    exchanges the values
    Definition: json.hpp:4495
    -
    std::bidirectional_iterator_tag iterator_category
    the category of the iterator
    Definition: json.hpp:5592
    -
    bool is_primitive() const noexcept
    return whether type is primitive
    Definition: json.hpp:1918
    -
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4230
    -
    friend bool operator==(const_reference v, std::nullptr_t) noexcept
    comparison: equal
    Definition: json.hpp:4665
    - -
    reference operator[](difference_type n) const
    access to successor
    Definition: json.hpp:6293
    -
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:527
    -
    reference operator[](difference_type n) const
    access to successor
    Definition: json.hpp:6008
    -
    reference operator*() const
    return a reference to the value pointed to by the iterator
    Definition: json.hpp:5725
    -
    value_type & reference
    the type of an element reference
    Definition: json.hpp:212
    -
    friend std::istream & operator<<(basic_json &j, std::istream &i)
    deserialize from stream
    Definition: json.hpp:5020
    -
    the parser finished reading a JSON value
    -
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:592
    -
    std::size_t operator()(const nlohmann::json &j) const
    return a hash value for a JSON object
    Definition: json.hpp:7846
    -
    friend std::ostream & operator<<(std::ostream &o, const basic_json &j)
    serialize to stream
    Definition: json.hpp:4898
    -
    iterator & operator=(iterator other) noexcept( std::is_nothrow_move_constructible< pointer >::value and std::is_nothrow_move_assignable< pointer >::value and std::is_nothrow_move_constructible< internal_iterator >::value and std::is_nothrow_move_assignable< internal_iterator >::value )
    copy assignment
    Definition: json.hpp:6100
    -
    basic_json(const CompatibleObjectType &val)
    create an object (implicit)
    Definition: json.hpp:965
    -
    reference operator[](size_type idx)
    access specified array element
    Definition: json.hpp:2803
    -
    iterator operator--(int)
    post-decrement (it–)
    Definition: json.hpp:6139
    -
    json_reverse_iterator operator+(difference_type i) const
    add to iterator
    Definition: json.hpp:6271
    -
    parse_event_t
    JSON callback events.
    Definition: json.hpp:754
    -
    iterator operator-(difference_type i)
    subtract from iterator
    Definition: json.hpp:6176
    +
    const_iterator(pointer object)
    constructor for a given JSON instance
    Definition: json.hpp:5707
    +
    friend bool operator<(const value_t lhs, const value_t rhs)
    comparison operator for JSON types
    Definition: json.hpp:4619
    +
    iterator(pointer object) noexcept
    constructor for a given JSON instance
    Definition: json.hpp:6239
    +
    bool operator<(const const_iterator &other) const
    comparison: smaller
    Definition: json.hpp:6031
    +
    string_t dump(const int indent=-1) const
    serialization
    Definition: json.hpp:1877
    +
    friend bool operator!=(const_reference v, std::nullptr_t) noexcept
    comparison: not equal
    Definition: json.hpp:4798
    +
    const_iterator & operator-=(difference_type i)
    subtract from iterator
    Definition: json.hpp:6107
    +
    basic_json(const int val)
    create an integer number from an enum type (explicit)
    Definition: json.hpp:1195
    +
    basic_json(const array_t &val)
    create an array (explicit)
    Definition: json.hpp:993
    +
    static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
    deserialize from string
    Definition: json.hpp:5057
    +
    InteratorType erase(InteratorType first, InteratorType last)
    remove elements given an iterator range
    Definition: json.hpp:3379
    +
    json_reverse_iterator operator++(int)
    post-increment (it++)
    Definition: json.hpp:6387
    +
    PointerType get_ptr() noexcept
    get a pointer value (implicit)
    Definition: json.hpp:2545
    +
    const_iterator(const iterator &other)
    copy constructor given a nonconst iterator
    Definition: json.hpp:5734
    +
    friend bool operator!=(std::nullptr_t, const_reference v) noexcept
    comparison: not equal
    Definition: json.hpp:4807
    +
    InteratorType erase(InteratorType pos)
    remove element given an iterator
    Definition: json.hpp:3274
    +
    bool operator<=(const const_iterator &other) const
    comparison: less than or equal
    Definition: json.hpp:6061
    +
    basic_json(const CompatibleNumberFloatType val) noexcept
    create an floating-point number (implicit)
    Definition: json.hpp:1305
    +
    reference back()
    access the last element
    Definition: json.hpp:3207
    +
    bool is_number_float() const noexcept
    return whether value is a floating-point number
    Definition: json.hpp:2057
    +
    const_iterator operator++(int)
    post-increment (it++)
    Definition: json.hpp:5921
    +
    typename std::allocator_traits< allocator_type >::const_pointer const_pointer
    the type of an element const pointer
    Definition: json.hpp:230
    +
    basic_json(const string_t &val)
    create a string (explicit)
    Definition: json.hpp:1059
    +
    iterator(const iterator &other) noexcept
    copy constructor
    Definition: json.hpp:6244
    +
    const_reference back() const
    access the last element
    Definition: json.hpp:3217
    +
    basic_json(InputIT first, InputIT last)
    construct a JSON container given an iterator range
    Definition: json.hpp:1580
    +
    static basic_json parse(std::istream &i, parser_callback_t cb=nullptr)
    deserialize from stream
    Definition: json.hpp:5086
    +
    size_type count(typename object_t::key_type key) const
    returns the number of occurrences of a key in a JSON object
    Definition: json.hpp:3584
    +
    size_type max_size() const noexcept
    returns the maximum possible number of elements
    Definition: json.hpp:4014
    +
    void push_back(const basic_json &val)
    add an object to an array
    Definition: json.hpp:4179
    +
    bool operator==(const const_iterator &other) const
    comparison: equal
    Definition: json.hpp:5995
    +
    json_reverse_iterator & operator++()
    pre-increment (++it)
    Definition: json.hpp:6393
    +
    basic_json(std::nullptr_t) noexcept
    create a null object (explicitly)
    Definition: json.hpp:911
    +
    bool operator>(const const_iterator &other) const
    comparison: greater than
    Definition: json.hpp:6067
    +
    friend bool operator>(const_reference lhs, const_reference rhs) noexcept
    comparison: greater than
    Definition: json.hpp:4941
    +
    basic_json(basic_json &&other) noexcept
    move constructor
    Definition: json.hpp:1752
    +
    const_reference operator[](const T(&key)[n]) const
    read-only access specified object element
    Definition: json.hpp:3055
    +
    const_iterator begin() const
    returns a const iterator to the first element
    Definition: json.hpp:3629
    +
    const_reference at(size_type idx) const
    access specified array element with bounds checking
    Definition: json.hpp:2682
    +
    json_reverse_iterator & operator+=(difference_type i)
    add to iterator
    Definition: json.hpp:6413
    +
    a const random access iterator for the basic_json class
    Definition: json.hpp:5686
    +
    a template for a reverse iterator class
    Definition: json.hpp:233
    +
    void swap(object_t &other)
    exchanges the values
    Definition: json.hpp:4551
    +
    std::bidirectional_iterator_tag iterator_category
    the category of the iterator
    Definition: json.hpp:5701
    +
    bool is_primitive() const noexcept
    return whether type is primitive
    Definition: json.hpp:1929
    +
    iterator insert(const_iterator pos, const basic_json &val)
    inserts element
    Definition: json.hpp:4281
    +
    friend bool operator==(const_reference v, std::nullptr_t) noexcept
    comparison: equal
    Definition: json.hpp:4745
    +
    reference operator[](difference_type n) const
    access to successor
    Definition: json.hpp:6442
    +
    NumberIntegerType number_integer_t
    a type for a number (integer)
    Definition: json.hpp:528
    +
    reference operator[](difference_type n) const
    access to successor
    Definition: json.hpp:6153
    +
    reference operator*() const
    return a reference to the value pointed to by the iterator
    Definition: json.hpp:5846
    +
    value_type & reference
    the type of an element reference
    Definition: json.hpp:213
    +
    friend std::istream & operator<<(basic_json &j, std::istream &i)
    deserialize from stream
    Definition: json.hpp:5122
    +
    NumberFloatType number_float_t
    a type for a number (floating-point)
    Definition: json.hpp:593
    +
    std::size_t operator()(const nlohmann::json &j) const
    return a hash value for a JSON object
    Definition: json.hpp:8003
    +
    friend std::ostream & operator<<(std::ostream &o, const basic_json &j)
    serialize to stream
    Definition: json.hpp:5000
    +
    iterator & operator=(iterator other) noexcept( std::is_nothrow_move_constructible< pointer >::value and std::is_nothrow_move_assignable< pointer >::value and std::is_nothrow_move_constructible< internal_iterator >::value and std::is_nothrow_move_assignable< internal_iterator >::value )
    copy assignment
    Definition: json.hpp:6249
    +
    basic_json(const CompatibleObjectType &val)
    create an object (implicit)
    Definition: json.hpp:966
    +
    reference operator[](size_type idx)
    access specified array element
    Definition: json.hpp:2825
    +
    iterator operator--(int)
    post-decrement (it–)
    Definition: json.hpp:6288
    +
    json_reverse_iterator operator+(difference_type i) const
    add to iterator
    Definition: json.hpp:6420
    +
    parse_event_t
    JSON callback events.
    Definition: json.hpp:755
    +
    iterator operator-(difference_type i)
    subtract from iterator
    Definition: json.hpp:6325
    diff --git a/namespacemembers.html b/namespacemembers.html index d0e47a910..cf14fe3e2 100644 --- a/namespacemembers.html +++ b/namespacemembers.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Namespace Members @@ -33,7 +33,7 @@
    - + @@ -94,9 +94,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/namespacemembers_type.html b/namespacemembers_type.html index 4f74cdae5..c79b37940 100644 --- a/namespacemembers_type.html +++ b/namespacemembers_type.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Namespace Members @@ -33,7 +33,7 @@ - + @@ -94,9 +94,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/namespacenlohmann.html b/namespacenlohmann.html index c2224b5d3..68658d204 100644 --- a/namespacenlohmann.html +++ b/namespacenlohmann.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann Namespace Reference @@ -33,7 +33,7 @@ - + @@ -116,9 +116,9 @@ Typedefs diff --git a/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html b/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html index 403675069..2c51b3fae 100644 --- a/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html +++ b/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::anonymous_namespace{json.hpp} Namespace Reference @@ -33,7 +33,7 @@ - + @@ -105,9 +105,9 @@ Classes diff --git a/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html b/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html index 48a32f5f5..fa919b65b 100644 --- a/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html +++ b/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: nlohmann::json @@ -33,7 +33,7 @@ - + @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This type is the default specialization of the basic_json class which uses the standard template types.

    Since
    version 1.0.0
    -

    Definition at line 7811 of file json.hpp.

    +

    Definition at line 7968 of file json.hpp.

    @@ -111,9 +111,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/search/all_0.html b/search/all_0.html index 1d4695009..d54e0bd8e 100644 --- a/search/all_0.html +++ b/search/all_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_1.html b/search/all_1.html index 1fbc509c2..8cc6a1de9 100644 --- a/search/all_1.html +++ b/search/all_1.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_10.html b/search/all_10.html index 80581d5aa..c25484f20 100644 --- a/search/all_10.html +++ b/search/all_10.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_11.html b/search/all_11.html index bb6241bef..3615c2815 100644 --- a/search/all_11.html +++ b/search/all_11.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_12.html b/search/all_12.html index fe93a5bfb..abd082a5e 100644 --- a/search/all_12.html +++ b/search/all_12.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_13.html b/search/all_13.html index cb938b917..88fa65319 100644 --- a/search/all_13.html +++ b/search/all_13.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_2.html b/search/all_2.html index 93962b724..d15ac65f7 100644 --- a/search/all_2.html +++ b/search/all_2.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_3.html b/search/all_3.html index 679f93ca9..9f526c67c 100644 --- a/search/all_3.html +++ b/search/all_3.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_4.html b/search/all_4.html index adc99fbbf..7b814aa94 100644 --- a/search/all_4.html +++ b/search/all_4.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_5.html b/search/all_5.html index a9fcd1702..d8de5560e 100644 --- a/search/all_5.html +++ b/search/all_5.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_6.html b/search/all_6.html index 821c374d8..9ba0cc2b4 100644 --- a/search/all_6.html +++ b/search/all_6.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_7.html b/search/all_7.html index 38c6c0006..9384ec9b3 100644 --- a/search/all_7.html +++ b/search/all_7.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_8.html b/search/all_8.html index 2a22cd52c..37566c5d8 100644 --- a/search/all_8.html +++ b/search/all_8.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_9.html b/search/all_9.html index bd9b05c38..c8c51023c 100644 --- a/search/all_9.html +++ b/search/all_9.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_a.html b/search/all_a.html index 4a25af1ca..4cb31f0c9 100644 --- a/search/all_a.html +++ b/search/all_a.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_b.html b/search/all_b.html index a92de4851..d34a612ec 100644 --- a/search/all_b.html +++ b/search/all_b.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_c.html b/search/all_c.html index 20cdfbcf3..c1ae2cae7 100644 --- a/search/all_c.html +++ b/search/all_c.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_d.html b/search/all_d.html index 00b28ed86..712223c66 100644 --- a/search/all_d.html +++ b/search/all_d.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_e.html b/search/all_e.html index 07d525999..d553ffa22 100644 --- a/search/all_e.html +++ b/search/all_e.html @@ -1,7 +1,7 @@ - + diff --git a/search/all_f.html b/search/all_f.html index 2213eb208..c77391a04 100644 --- a/search/all_f.html +++ b/search/all_f.html @@ -1,7 +1,7 @@ - + diff --git a/search/classes_0.html b/search/classes_0.html index 523591f06..025587a71 100644 --- a/search/classes_0.html +++ b/search/classes_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/classes_1.html b/search/classes_1.html index f5a65ad4f..86dc4ffe6 100644 --- a/search/classes_1.html +++ b/search/classes_1.html @@ -1,7 +1,7 @@ - + diff --git a/search/classes_2.html b/search/classes_2.html index 5b89b2776..014caf809 100644 --- a/search/classes_2.html +++ b/search/classes_2.html @@ -1,7 +1,7 @@ - + diff --git a/search/classes_3.html b/search/classes_3.html index 63ffc5db8..2e9720118 100644 --- a/search/classes_3.html +++ b/search/classes_3.html @@ -1,7 +1,7 @@ - + diff --git a/search/classes_4.html b/search/classes_4.html index 4acce5bcf..776fee375 100644 --- a/search/classes_4.html +++ b/search/classes_4.html @@ -1,7 +1,7 @@ - + diff --git a/search/enums_0.html b/search/enums_0.html index d8d79a39c..aba8d799d 100644 --- a/search/enums_0.html +++ b/search/enums_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/enums_1.html b/search/enums_1.html index 9c2ae9a9a..a8d384301 100644 --- a/search/enums_1.html +++ b/search/enums_1.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_0.html b/search/enumvalues_0.html index 450f1acdb..83192d354 100644 --- a/search/enumvalues_0.html +++ b/search/enumvalues_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_1.html b/search/enumvalues_1.html index ac8ff5721..0715ef5a3 100644 --- a/search/enumvalues_1.html +++ b/search/enumvalues_1.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_2.html b/search/enumvalues_2.html index 71e42ad0c..0f9b5e9fc 100644 --- a/search/enumvalues_2.html +++ b/search/enumvalues_2.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_3.html b/search/enumvalues_3.html index a7d91094a..9ebb35628 100644 --- a/search/enumvalues_3.html +++ b/search/enumvalues_3.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_4.html b/search/enumvalues_4.html index 5b4a76576..daa496de7 100644 --- a/search/enumvalues_4.html +++ b/search/enumvalues_4.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_5.html b/search/enumvalues_5.html index dc7d99f54..bd3779357 100644 --- a/search/enumvalues_5.html +++ b/search/enumvalues_5.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_6.html b/search/enumvalues_6.html index af14f2924..656e47884 100644 --- a/search/enumvalues_6.html +++ b/search/enumvalues_6.html @@ -1,7 +1,7 @@ - + diff --git a/search/enumvalues_7.html b/search/enumvalues_7.html index ecc13a098..2c3a1c9de 100644 --- a/search/enumvalues_7.html +++ b/search/enumvalues_7.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_0.html b/search/functions_0.html index 246d16721..6bc52b619 100644 --- a/search/functions_0.html +++ b/search/functions_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_1.html b/search/functions_1.html index 5f14d674e..648831fd7 100644 --- a/search/functions_1.html +++ b/search/functions_1.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_10.html b/search/functions_10.html index c322f4084..8bc4de4a7 100644 --- a/search/functions_10.html +++ b/search/functions_10.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_11.html b/search/functions_11.html index c49fcd4ce..e1e427c17 100644 --- a/search/functions_11.html +++ b/search/functions_11.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_2.html b/search/functions_2.html index 3995cf8c5..c93d08946 100644 --- a/search/functions_2.html +++ b/search/functions_2.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_3.html b/search/functions_3.html index 4e302d69b..caa48ea26 100644 --- a/search/functions_3.html +++ b/search/functions_3.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_4.html b/search/functions_4.html index 58ca83a61..a9c64adf9 100644 --- a/search/functions_4.html +++ b/search/functions_4.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_5.html b/search/functions_5.html index 5f9f05aeb..9d135fa08 100644 --- a/search/functions_5.html +++ b/search/functions_5.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_6.html b/search/functions_6.html index c980da25b..5fca897bd 100644 --- a/search/functions_6.html +++ b/search/functions_6.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_7.html b/search/functions_7.html index 385732931..02631a344 100644 --- a/search/functions_7.html +++ b/search/functions_7.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_8.html b/search/functions_8.html index 088e437fb..ff3709592 100644 --- a/search/functions_8.html +++ b/search/functions_8.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_9.html b/search/functions_9.html index 61de44ad4..1d3458312 100644 --- a/search/functions_9.html +++ b/search/functions_9.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_a.html b/search/functions_a.html index a46b662ed..8eb5e5625 100644 --- a/search/functions_a.html +++ b/search/functions_a.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_b.html b/search/functions_b.html index 3b49416d5..fa9cff56e 100644 --- a/search/functions_b.html +++ b/search/functions_b.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_c.html b/search/functions_c.html index 57c64555c..fce7a6b12 100644 --- a/search/functions_c.html +++ b/search/functions_c.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_d.html b/search/functions_d.html index 58b3d31f0..82b2b0cf8 100644 --- a/search/functions_d.html +++ b/search/functions_d.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_e.html b/search/functions_e.html index b44e5c5fb..557ae9a44 100644 --- a/search/functions_e.html +++ b/search/functions_e.html @@ -1,7 +1,7 @@ - + diff --git a/search/functions_f.html b/search/functions_f.html index db9a07c0c..b27fb7d15 100644 --- a/search/functions_f.html +++ b/search/functions_f.html @@ -1,7 +1,7 @@ - + diff --git a/search/namespaces_0.html b/search/namespaces_0.html index 27b2d00ab..f1b59ecc3 100644 --- a/search/namespaces_0.html +++ b/search/namespaces_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/related_0.html b/search/related_0.html index c02994fb4..e40ed4285 100644 --- a/search/related_0.html +++ b/search/related_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/related_1.html b/search/related_1.html index e5320aa9d..e25d1b340 100644 --- a/search/related_1.html +++ b/search/related_1.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_0.html b/search/typedefs_0.html index a6c8e2571..fb07195c2 100644 --- a/search/typedefs_0.html +++ b/search/typedefs_0.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_1.html b/search/typedefs_1.html index c44c36f9d..6edac96b8 100644 --- a/search/typedefs_1.html +++ b/search/typedefs_1.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_2.html b/search/typedefs_2.html index d64bac3cb..cc5cc4047 100644 --- a/search/typedefs_2.html +++ b/search/typedefs_2.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_3.html b/search/typedefs_3.html index 10b9917f9..3fdb8f266 100644 --- a/search/typedefs_3.html +++ b/search/typedefs_3.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_4.html b/search/typedefs_4.html index c1ff64d1a..fb508194d 100644 --- a/search/typedefs_4.html +++ b/search/typedefs_4.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_5.html b/search/typedefs_5.html index 14adc8ed8..0ad02a6c0 100644 --- a/search/typedefs_5.html +++ b/search/typedefs_5.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_6.html b/search/typedefs_6.html index 742e92b54..10007d2ca 100644 --- a/search/typedefs_6.html +++ b/search/typedefs_6.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_7.html b/search/typedefs_7.html index ad03564b8..4e61d8731 100644 --- a/search/typedefs_7.html +++ b/search/typedefs_7.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_8.html b/search/typedefs_8.html index 4e9ac73db..4d3d6b604 100644 --- a/search/typedefs_8.html +++ b/search/typedefs_8.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_9.html b/search/typedefs_9.html index b07ee409c..8dbf62fd2 100644 --- a/search/typedefs_9.html +++ b/search/typedefs_9.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_a.html b/search/typedefs_a.html index b1a32661d..411981efc 100644 --- a/search/typedefs_a.html +++ b/search/typedefs_a.html @@ -1,7 +1,7 @@ - + diff --git a/search/typedefs_b.html b/search/typedefs_b.html index eded260db..dac1e0f27 100644 --- a/search/typedefs_b.html +++ b/search/typedefs_b.html @@ -1,7 +1,7 @@ - + diff --git a/structstd_1_1hash_3_01nlohmann_1_1json_01_4-members.html b/structstd_1_1hash_3_01nlohmann_1_1json_01_4-members.html index b1aa76270..30b2c42ca 100644 --- a/structstd_1_1hash_3_01nlohmann_1_1json_01_4-members.html +++ b/structstd_1_1hash_3_01nlohmann_1_1json_01_4-members.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: Member List @@ -33,7 +33,7 @@ - + @@ -98,9 +98,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/structstd_1_1hash_3_01nlohmann_1_1json_01_4.html b/structstd_1_1hash_3_01nlohmann_1_1json_01_4.html index 8eebf6641..621570546 100644 --- a/structstd_1_1hash_3_01nlohmann_1_1json_01_4.html +++ b/structstd_1_1hash_3_01nlohmann_1_1json_01_4.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: std::hash< nlohmann::json > Struct Template Reference @@ -33,7 +33,7 @@ - + @@ -111,13 +111,13 @@ Public Member Functions struct std::hash< nlohmann::json > -

    Definition at line 7839 of file json.hpp.

    +

    Definition at line 7996 of file json.hpp.

    diff --git a/structstd_1_1hash_3_01nlohmann_1_1json_01_4_afd03f6ad53db22868ca4163a8200b2f9.html b/structstd_1_1hash_3_01nlohmann_1_1json_01_4_afd03f6ad53db22868ca4163a8200b2f9.html index ae0f4a747..a33b20539 100644 --- a/structstd_1_1hash_3_01nlohmann_1_1json_01_4_afd03f6ad53db22868ca4163a8200b2f9.html +++ b/structstd_1_1hash_3_01nlohmann_1_1json_01_4_afd03f6ad53db22868ca4163a8200b2f9.html @@ -3,7 +3,7 @@ - + JSON for Modern C++: std::hash< nlohmann::json >::operator() @@ -33,7 +33,7 @@ - + @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    Since
    version 1.0.0
    -

    Definition at line 7846 of file json.hpp.

    +

    Definition at line 8003 of file json.hpp.

    @@ -122,9 +122,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');