From df1bafd8f5ee5871e6b2b2b72467bdd4741b9a4c Mon Sep 17 00:00:00 2001 From: Niels Date: Thu, 17 Dec 2015 15:55:39 +0100 Subject: [PATCH] Update --- Tokens.xml | 99 +- annotated.html | 2 +- classes.html | 2 +- classnlohmann_1_1basic__json-members.html | 2 +- classnlohmann_1_1basic__json.html | 86 +- ...asic__json_1_1const__iterator-members.html | 2 +- ...ann_1_1basic__json_1_1const__iterator.html | 7 +- ...tor_a019087161350d393f3e4ac841cdd3dbd.html | 4 +- ...tor_a17e5f5d3598e6901f3c1c1f7dc60589f.html | 4 +- ...tor_a1cba94e5a67ee52bc66b898a4e08359d.html | 4 +- ...tor_a211523a57024a43965862b497b89ab91.html | 4 +- ...tor_a301749e9779adafd395369ac36df93df.html | 4 +- ...tor_a36086a699b95e06976c11367b7d6ba53.html | 4 +- ...tor_a4632d8307fc315f21e2ecc9ba5aa6346.html | 4 +- ...tor_a4f7ac43b0ab34c387b1ae1a8e9c08467.html | 4 +- ...tor_a5aff013c03c1bdc248346c249bec7b67.html | 4 +- ...tor_a62cad59e006eb7fa594c2c5b65a76610.html | 4 +- ...tor_a67848d4b7bfa576434ad9807147b5870.html | 4 +- ...tor_a6b3e43d2f45fa611825dbdf4e88fffe2.html | 4 +- ...tor_a83454954e4e16be3d5316f9322e91a34.html | 4 +- ...tor_a86a1771e6658d0b14868df6c197d2353.html | 2 +- ...tor_a8d024cbc99db0d8106899f9fd9973735.html | 4 +- ...tor_ab74b39747a9dad60650a57133fca85b3.html | 4 +- ...tor_ab7dacd8e3ee9b3756bfcdb87dd55a515.html | 4 +- ...tor_ab9d31bf0d0b4d7310c858a04ce84a52f.html | 4 +- ...tor_abb1921cbf0ad4036c83bc6303e22171f.html | 4 +- ...tor_abbacd95955c602efc9a58ed1ffdb46c4.html | 4 +- ...tor_ac36b9187de43721a4bf1b052578bb80b.html | 4 +- ...tor_ac634a659837f5aebc97125e031de23b5.html | 4 +- ...tor_acea5b75d1087e2a92833946d9dc547ff.html | 4 +- ...tor_ada3100cdb8700566051828f1355fa745.html | 4 +- ...tor_adb50d6043ace464d9f694869724d7fb2.html | 4 +- ...tor_adda9a4bd7f0edb9cb39dc0dca3d4a286.html | 4 +- ...tor_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html | 4 +- ...tor_ae480d5c86e5e1129d53d1e19782017a6.html | 4 +- ...tor_aebd099d9a70ffe760242ef24046c9002.html | 4 +- ...tor_af34f68f1ce670e7f25ce267b2b1e64ab.html | 4 +- ...tor_af55564e391b23e41abe78bc4bbe4edcb.html | 4 +- ...nn_1_1basic__json_1_1iterator-members.html | 2 +- classnlohmann_1_1basic__json_1_1iterator.html | 7 +- ...ic__json_1_1iterator__wrapper-members.html | 2 +- ...n_1_1basic__json_1_1iterator__wrapper.html | 4 +- ...per_a784f17dec56c1ec90b0b73eb8307ea7d.html | 4 +- ...per_a80305d6ac43b6fb53c62256e450485ac.html | 4 +- ...per_ab5951e20b05998e768943acd0b418c81.html | 4 +- ...tor_a037e5f3de196ff4cea8a95a8a4e35882.html | 4 +- ...tor_a0a43bd93e6e46645ed0b93d3af7bfe22.html | 4 +- ...tor_a0c0acb68cc2a50a0e8782f860184883f.html | 4 +- ...tor_a0eb7ac9b746fb6f931ae728f70f92a8e.html | 4 +- ...tor_a1220b360a07b0605f7d2f4b3cfd16736.html | 4 +- ...tor_a21d32a4547ba4cbadd8b435a6a0d0e1b.html | 4 +- ...tor_a302d810a0685f8d39368eaa65c833acf.html | 4 +- ...tor_a33277dbf06ac5c1e7102e26f6b5e2c00.html | 4 +- ...tor_a4ae612fa9eb59784047b40f0419db65d.html | 4 +- ...tor_a4f6e03ae3bb674ebf0b727f74957c12f.html | 2 +- ...tor_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html | 4 +- ...tor_a7031e759ee52d1283aada0ff81108a5e.html | 4 +- ...tor_a94285e2ade0bfef829b81377bbbca6cf.html | 4 +- ...tor_a9fcfda575b08d0c73b6274cdbbe7f184.html | 4 +- ...tor_aa2bd10afdcfc70acb8eaabbd2f6496f0.html | 4 +- ...tor_ab220a0cc3fe410fbae4524208bd5834f.html | 4 +- ...tor_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html | 4 +- ...tor_abaebf4e21956dd20d9f862fa5647d32d.html | 4 +- ...tor_af64127418c567660d92b1afdfe9676db.html | 4 +- ...tor_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html | 4 +- ...on_1_1json__reverse__iterator-members.html | 2 +- ...asic__json_1_1json__reverse__iterator.html | 7 +- ...tor_a03e542423284327d3801cf078f1c2b44.html | 4 +- ...tor_a0b494ef7570d031216f907d2c85ec323.html | 4 +- ...tor_a15e9cf4c5a43238e82ab69c4a295c491.html | 4 +- ...tor_a1c84e6d1f047ab4105fa665f455158a7.html | 4 +- ...tor_a2a1dc92fbec862883c8b89755c787c99.html | 4 +- ...tor_a5ee9ec91a6ddcd8d72278d681361626f.html | 4 +- ...tor_a61d31531e0dfc5448e7fa15678b05bbe.html | 4 +- ...tor_a6bd38ed124df0332ba3263a9176b0101.html | 4 +- ...tor_a70086e392779ecbbc9e6845b2be126a0.html | 4 +- ...tor_aa82b48aee07baee284f8340b37ec6864.html | 4 +- ...tor_ab6245ab29d8481ef2a2351c02cc31d4d.html | 4 +- ...tor_ac427d8f61858c13b7c16649bfbf75e76.html | 4 +- ...tor_ad3d6837b6f97065625c6c65f62f4b6d4.html | 4 +- ...tor_ae988bd36b7d098b1157871f83b2d6265.html | 4 +- ...tor_af972fce017b24906236ab235857a11a8.html | 4 +- ...son_a01a2643289b69cd71d9b3f3fc209b748.html | 13 +- ...son_a034bccea9f5400650443e9f12e67b079.html | 8 +- ...son_a088460b5d95f384a4f2ec9e52f4f66ba.html | 13 +- ...son_a0a7560122349628cf4942a316aa6d21f.html | 13 +- ...son_a0a9c6a1fccc4db365860463e8203eb38.html | 10 +- ...son_a0bb6ea56c89560cce8003485bffe49d4.html | 8 +- ...son_a0e372f4c5a90c6be7242a2d7a3709b48.html | 13 +- ...son_a114095c452ca2f4ba976548df3da68be.html | 13 +- ...son_a11c3dd843c21c58daa651e84046a82af.html | 13 +- ...son_a122640e7e2db1814fc7bbb3c122ec76e.html | 11 +- ...son_a13e5642dbfa1602c937d295a085413cc.html | 4 +- ...son_a15e468968cd4d0e4fd566044d66ada24.html | 10 +- ...son_a1683189bd539313b5559f07961166c8b.html | 4 +- ...son_a16a275d0201e9aedc87c933c764b8869.html | 13 +- ...son_a190d719446e7016879c4b961c9cf9072.html | 10 +- ...son_a231b02148577b69a154b2ce2c87a5522.html | 4 +- ...son_a234f03dce002783748ca401a42bc6472.html | 19 +- ...son_a2448b2777e8a3e48614e1b3c41b96f7c.html | 8 +- ...son_a266c4dd24d11a86e4831523af5d9df4d.html | 11 +- ...son_a26b7e4876af25eae5800ce43f93aaef2.html | 13 +- ...son_a2adfc8d24bea3908398cbf325b5dc1d7.html | 15 +- ...son_a3287df6546c905fb0a5786deb4b1cf32.html | 13 +- ...son_a33f1632cfdbf460b4913f4e8a43dd9e4.html | 8 +- ...son_a34d6a60dd99e9f33b8273a1c8db5669b.html | 11 +- ...son_a429c2606865483ff357cccc1b1c46569.html | 13 +- ...son_a42f9133f978dde4cce5851b2c2434a0c.html | 13 +- ...son_a4361aa791f3980abb239e4155a3450cb.html | 15 +- ...son_a4943b7f16ddc4e0df33c0cae7ef14471.html | 15 +- ...son_a4ad3f27ecece8f644e8dca69a97eb67f.html | 15 +- ...son_a4bf695ddf4a00ea8feea2c725ec847f1.html | 15 +- ...son_a4d688b5ff534d3ab4e284b3191061529.html | 15 +- ...son_a53a2abfdd4f72c7df5aba1155bf03e48.html | 13 +- ...son_a55edaf09e1f7785463475f809d987cee.html | 15 +- ...son_a57703688bee6b9736ab3a430d8d246f2.html | 11 +- ...son_a57a96ab3ff1ce7b48a754129fb12c982.html | 15 +- ...son_a5a2d4dbcdbc8ea065b87daf52cd786b9.html | 6 +- ...son_a5c8bb5200f5eac10d31e26be46e5b1ac.html | 11 +- ...son_a5d428360d75a52f6af74751d1cc912c6.html | 13 +- ...son_a5e34c5435e557d0bf666bd7311211405.html | 11 +- ...son_a5f0aad50ed7e8aec3128fe018c18b3fe.html | 13 +- ...son_a5fd8b54389698edf0c08e2dd001f610b.html | 4 +- ...son_a60ca396028b8d9714c6e10efbf475af6.html | 11 +- ...son_a63691315292df8e1522b00d37ebb1ffc.html | 14 +- ...son_a652414dd930cb3af3b6f454cc535a23e.html | 13 +- ...son_a656939a3dc9a6047e4afacd9e11b83a6.html | 19 +- ...son_a6944904b3b59769b1cf62ac2532cbe33.html | 4 +- ...son_a696ced74d8edc0b63a000a72907ab109.html | 18 +- ...son_a6a67c72ba65322bfcb28d170617dcdff.html | 13 +- ...son_a6a7f45095675ac6fd1d018a0e41874be.html | 14 +- ...son_a6bbd3e72a870f1ba81ff6886b063b0fe.html | 4 +- ...son_a6dff6a02a2be250b8f8dc2f47be65544.html | 18 +- ...son_a6e2e21da48f5d9471716cd868a068327.html | 11 +- ...son_a71eba33d906745e66f340952b79fbce3.html | 4 +- ...son_a72442ccbb378b4464a24a2da1e784041.html | 15 +- ...son_a72ba20783ecb3eec98bd6a3b870d565c.html | 15 +- ...son_a749e58042d8069f4f048ee4d23c43f63.html | 13 +- ...son_a74a943800c7f103d0990d7eef82c6453.html | 11 +- ...son_a74ccfa471a0c061876b247f820f3c741.html | 21 +- ...son_a75a1754e0d39f33095d3102a8bdb9881.html | 22 +- ...son_a76cfc5062bf6223396ab82c753cd4634.html | 21 +- ...son_a793e5c1da2fc7de7a04b19eadbb3f2cb.html | 14 +- ...son_a7c08f966200af98db0313a3b517ce0a9.html | 15 +- ...son_a7c19a5c3be6cc755377ee41eade78baf.html | 15 +- ...son_a7d0db3b728d820d4984df78d97d2b104.html | 4 +- ...son_a7d1b990f2c12fecb57db1504fdadd0bb.html | 18 +- ...son_a7dab69b10b98e7bc694339720e37fb2b.html | 15 +- ...son_a7f97a91ad8f1d5cf0b9213bd24f247c4.html | 11 +- ...son_a80a89ddbe4cb7ef15b049febee208cc8.html | 10 +- ...son_a80ceaa3bdd346292273b309e08525c1c.html | 4 +- ...son_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html | 13 +- ...son_a87db51b6b936fb2ea293cdbc8702dcb8.html | 11 +- ...son_a8b526709d395142b68d21abfbfff17c3.html | 13 +- ...son_a8c40cd9ead4de7c82f28268bdf0ec98a.html | 13 +- ...son_a8fa74698f4061e18ec664009f3af1ddf.html | 17 +- ...son_a930e14150ffa067bcf56d35cb00271e1.html | 10 +- ...son_a951a76ba057b3be948e7ba5c2c01cd5a.html | 8 +- ...son_a9730b9f7bc2150e641fe20198d4477c7.html | 11 +- ...son_a98e05a2c9b8f74bd60442772cddeee52.html | 11 +- ...son_a9993148cb0473365e52998c7315f9ada.html | 16 +- ...son_a9c26c5d0f4a519c7236149b9aeb3ef9e.html | 16 +- ...son_a9f17a0690155e3a5603246ccec81499e.html | 13 +- ...son_aa0422e861b4cbd7cdcaad7a11a1304a9.html | 114 +- ...son_aa1f3b3f1dca79392d6727b81f9668c6c.html | 13 +- ...son_aa5413178b8041f7ac685dec4b040dd2c.html | 15 +- ...son_aa6a24b176f9599a21d662cc5f8e1ca76.html | 4 +- ...son_aa71e977d31f470689883ac60d16ea4ac.html | 17 +- ...son_aabe4661644ea549089f0886c2551d2ac.html | 4 +- ...son_aac185a137428a7337aa620de07bfbbd7.html | 7 +- ...son_aacd442b66140c764c594ac8ad7dfd5b3.html | 11 +- ...son_aacf6c869f6a9c66ac1bc99e93f310044.html | 4 +- ...son_aaf363408931d76472ded14017e59c9e8.html | 11 +- ...son_aafa839f2a74dc1b5060314b3423143b8.html | 4 +- ...son_ab14e3503305622fb5ab01a7f490916e8.html | 15 +- ...son_ab2162bc76e10d8736cab9b2039956054.html | 15 +- ...son_ab67345ba5c81c903eddd4eb2a24ac658.html | 15 +- ...son_ab9a20bd1d391e9cb968db50c246f728d.html | 13 +- ...son_ab9da2afc6f77295f25252725fde142a6.html | 13 +- ...son_abe8f3224ca4041908ddb466cb9caecf1.html | 13 +- ...son_ac4011bd0781e51afe4994d2b09fd27e9.html | 4 +- ...son_ac8163abe518595f19dbee68db1caaaf7.html | 13 +- ...son_ac82abedf356d252e0589850c3d8b35ba.html | 13 +- ...son_ac943391891fcde0a71a15ce990e0f7f4.html | 8 +- ...son_acbf7f957ecb6ce19cdc5b40b5d6b6333.html | 8 +- ...son_acdf4445333649ec94198f09a62144884.html | 15 +- ...son_ace8338e57fdb11e1955c2a0c2d782069.html | 13 +- ...son_ad1f617d29e8923dd40c89153f792b1bc.html | 10 +- ...son_ad2c4513cef5d8db760c4b2d871eea42c.html | 4 +- ...son_ad497cbc4f80c8d79662ee6e19bf145dd.html | 24 +- ...son_ad7067a1a8ad2d88125915ada6d4d79b7.html | 8 +- ...son_ad8e0c5d04f016d1b3ac7369e5c73bedf.html | 15 +- ...son_ada8e01109a60088e4db2a670d4903b54.html | 13 +- ...son_adbd4c16c9ac641b2a4736bc2c6787d83.html | 4 +- ...son_add77b50f69debb20e98d5a8c6c11c90c.html | 10 +- ...son_ade7bd6e0fe221fec9d3fa9b430f5ce76.html | 13 +- ...son_adf5dea6fa9d7075ff89ca0796ab47a7e.html | 11 +- ...son_ae2980ed978451f844e6e9a0890b637a6.html | 8 +- ...son_ae347859ec88176ef76a0cbe5b4514fcf.html | 11 +- ...son_ae42d32c34c8014b1bf677fdb7baa5401.html | 8 +- ...son_ae50f22a1c646b8627e88f1313cceffd4.html | 21 +- ...son_ae5ae3b1c6c67f52e9495ac092f6fb43e.html | 15 +- ...son_ae874cfc1746b560c53a03bcf5b7bbeed.html | 13 +- ...son_ae928414b2805cf6ef56b4e4f8d235416.html | 4 +- ...son_ae960d2d6bc7b94fe39cc5e9f106edfa9.html | 13 +- ...son_aea1c863b719b4ca5b77188c171bbfafe.html | 4 +- ...son_aeda4ec7473c17fae51e6d1eba0faf720.html | 13 +- ...son_af073eec08d2e68924098aef09e9a10ba.html | 13 +- ...son_af0ebd1757acb971a6504b4acabf88584.html | 15 +- ...son_af1e3f9e079136abca2530c8191c56292.html | 14 +- ...son_af2730bc8ffa6b28916875c13ee7b83f5.html | 19 +- ...son_af661bc209bf22097e2f76607a11b56bf.html | 13 +- ...son_af6b6050ccd906dddf7c9f47fe3ad62a5.html | 13 +- ...son_af709c079de0ac3507143ea2c60699bd0.html | 11 +- ...son_af74581d177dafc38df5a126ccd358999.html | 11 +- ...son_af93e556bf708cb81b22ce223af1aa727.html | 10 +- ...son_afc4223b5ad03b1b76e925374a8fff98e.html | 14 +- dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- functions.html | 2 +- functions_b.html | 2 +- functions_c.html | 2 +- functions_d.html | 2 +- functions_e.html | 2 +- functions_enum.html | 2 +- functions_f.html | 2 +- functions_func.html | 2 +- functions_g.html | 2 +- functions_i.html | 2 +- functions_j.html | 2 +- functions_k.html | 2 +- functions_m.html | 2 +- functions_n.html | 2 +- functions_o.html | 2 +- functions_p.html | 2 +- functions_r.html | 2 +- functions_rela.html | 2 +- functions_s.html | 2 +- functions_t.html | 2 +- functions_type.html | 2 +- functions_v.html | 2 +- functions_~.html | 2 +- graph_legend.html | 2 +- hierarchy.html | 2 +- index.html | 5 +- json_8hpp_source.html | 9110 ++++++++--------- namespacemembers.html | 2 +- namespacemembers_type.html | 2 +- namespacenlohmann.html | 3 +- ..._1anonymous__namespace_02json_8hpp_03.html | 8 +- ...ann_a2bfd99e845a2e5cd90aeaf1b1431f474.html | 7 +- ...ash_3_01nlohmann_1_1json_01_4-members.html | 2 +- ...std_1_1hash_3_01nlohmann_1_1json_01_4.html | 4 +- ...1_4_afd03f6ad53db22868ca4163a8200b2f9.html | 5 +- 253 files changed, 5791 insertions(+), 5612 deletions(-) diff --git a/Tokens.xml b/Tokens.xml index 15b3b3940..bd517fe16 100644 --- a/Tokens.xml +++ b/Tokens.xml @@ -44,6 +44,18 @@ aabe4661644ea549089f0886c2551d2ac per-element parser callback type + + + get_allocator + cpp + clm + nlohmann::basic_json + + classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html + ad2c4513cef5d8db760c4b2d871eea42c + returns the allocator associated with the container + json.hpp + value_type @@ -220,6 +232,30 @@ aacf6c869f6a9c66ac1bc99e93f310044 a type for a number (floating-point) + + + array + cpp + clm + nlohmann::basic_json + + classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html + afc4223b5ad03b1b76e925374a8fff98e + explicitly create an array from an initializer list + json.hpp + + + + object + cpp + clm + nlohmann::basic_json + + classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html + ad1f617d29e8923dd40c89153f792b1bc + explicitly create an object from an initializer list + json.hpp + basic_json @@ -472,18 +508,6 @@ move constructor json.hpp - - - ~basic_json - cpp - instm - nlohmann::basic_json - - classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html - aa6a24b176f9599a21d662cc5f8e1ca76 - destructor - json.hpp - operator= @@ -496,6 +520,18 @@ copy assignment json.hpp + + + ~basic_json + cpp + instm + nlohmann::basic_json + + classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html + aa6a24b176f9599a21d662cc5f8e1ca76 + destructor + json.hpp + dump @@ -853,7 +889,7 @@ classnlohmann_1_1basic__json_a72442ccbb378b4464a24a2da1e784041.html a72442ccbb378b4464a24a2da1e784041 - access specified object element with default value + overload for a default value of type const char* json.hpp @@ -1360,42 +1396,6 @@ exchanges the values json.hpp - - - array - cpp - clm - nlohmann::basic_json - - classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html - afc4223b5ad03b1b76e925374a8fff98e - explicitly create an array from an initializer list - json.hpp - - - - get_allocator - cpp - clm - nlohmann::basic_json - - classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html - ad2c4513cef5d8db760c4b2d871eea42c - returns the allocator associated with the container - json.hpp - - - - object - cpp - clm - nlohmann::basic_json - - classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html - ad1f617d29e8923dd40c89153f792b1bc - explicitly create an object from an initializer list - json.hpp - operator< @@ -1585,6 +1585,7 @@ classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html aa0422e861b4cbd7cdcaad7a11a1304a9 + deserialize from stream json.hpp diff --git a/annotated.html b/annotated.html index c9144d771..e1ffdc335 100644 --- a/annotated.html +++ b/annotated.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classes.html b/classes.html index 3d4c02d6e..da4f1c4cd 100644 --- a/classes.html +++ b/classes.html @@ -106,7 +106,7 @@ 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 7a8870cd5..2e89f7409 100644 --- a/classnlohmann_1_1basic__json-members.html +++ b/classnlohmann_1_1basic__json-members.html @@ -232,7 +232,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classnlohmann_1_1basic__json.html b/classnlohmann_1_1basic__json.html index be94fbd75..927487ef9 100644 --- a/classnlohmann_1_1basic__json.html +++ b/classnlohmann_1_1basic__json.html @@ -90,7 +90,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
@@ -149,7 +148,15 @@ Public Types } the JSON type enumeration More...
  -
container types
+ + + + + +

+Static Public Member Functions

static allocator_type get_allocator ()
 returns the allocator associated with the container More...
 
+ @@ -180,7 +187,9 @@ Public Types - +

+container types

using value_type = basic_json
 the type of elements in a basic_json container More...
 
using const_reverse_iterator = json_reverse_iterator< typename basic_json::const_iterator >
 a const reverse iterator for a basic_json container More...
 
JSON value data types
+ @@ -200,8 +209,14 @@ Public Types

+JSON value data types

using object_t = ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>>
 a type for an object More...
 
 a type for a number (floating-point) More...
 
- + + + + + + + @@ -272,13 +287,15 @@ Public Member Functions - - - - + + + +

-Public Member Functions

+constructors and destructors

static basic_json array (std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
 explicitly create an array from an initializer list More...
 
static basic_json object (std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
 explicitly create an object from an initializer list More...
 
 basic_json (const value_t value)
 create an empty value with a given type More...
 
 basic_json (basic_json &&other) noexcept
 move constructor More...
 
 ~basic_json ()
 destructor More...
 
referenceoperator= (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 More...
 
object inspection
 ~basic_json ()
 destructor More...
 
+ @@ -321,7 +338,9 @@ Public Member Functions - +

+object inspection

string_t dump (const int indent=-1) const
 serialization More...
 
 operator value_t () const noexcept
 return the type of the JSON value (implicit) More...
 
value access
+ @@ -346,7 +365,9 @@ Public Member Functions - +

+value access

template<typename ValueType , typename std::enable_if< not std::is_pointer< ValueType >::value , int >::type = 0>
ValueType get () const
 get a value (explicit) More...
 operator ValueType () const
 get a value (implicit) More...
 
element access
+ @@ -377,7 +398,7 @@ Public Member Functions - + @@ -414,7 +435,9 @@ Public Member Functions - +

+element access

reference at (size_type idx)
 access specified array element with bounds checking More...
 
 access specified object element with default value More...
 
string_t value (const typename object_t::key_type &key, const char *default_value) const
 access specified object element with default value More...
 overload for a default value of type const char* More...
 
reference front ()
 access the first element More...
size_type count (typename object_t::key_type key) const
 returns the number of occurrences of a key in a JSON object More...
 
iterators
+ @@ -451,7 +474,9 @@ Public Member Functions - +

+iterators

iterator begin ()
 returns an iterator to the first element More...
 
const_reverse_iterator crend () const
 returns a const reverse iterator to one before the first More...
 
capacity
+ @@ -461,7 +486,9 @@ Public Member Functions - +

+capacity

bool empty () const noexcept
 checks whether the container is empty More...
 
size_type max_size () const noexcept
 returns the maximum possible number of elements More...
 
modifiers
+ @@ -511,21 +538,8 @@ Public Member Functions

+modifiers

void clear () noexcept
 clears the contents More...
 
 exchanges the values More...
 
- - - - - - - - - - -

-Static Public Member Functions

static basic_json array (std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
 explicitly create an array from an initializer list More...
 
static allocator_type get_allocator ()
 returns the allocator associated with the container More...
 
static basic_json object (std::initializer_list< basic_json > init=std::initializer_list< basic_json >())
 explicitly create an object from an initializer list More...
 
- - + @@ -559,7 +573,9 @@ Friends - +

-Friends

lexicographical comparison operators

+lexicographical comparison operators

bool operator< (const value_t lhs, const value_t rhs)
 comparison operator for JSON types More...
 
bool operator>= (const_reference lhs, const_reference rhs) noexcept
 comparison: greater than or equal More...
 
serialization
+ @@ -576,6 +592,7 @@ deserialization + @@ -628,13 +645,14 @@ class nlohmann::basic_json -
See also
RFC 7159 http://rfc7159.net/rfc7159
+
See also
RFC 7159 http://rfc7159.net/rfc7159
+
Since
version 1.0
-

Definition at line 181 of file json.hpp.

+

Definition at line 187 of file json.hpp.

diff --git a/classnlohmann_1_1basic__json_1_1const__iterator-members.html b/classnlohmann_1_1basic__json_1_1const__iterator-members.html index 7493d9f37..6a2117582 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator-members.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator-members.html @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

+serialization

std::ostream & operator<< (std::ostream &o, const basic_json &j)
 serialize to stream More...
 
 deserialize from stream More...
 
static basic_json parse (std::istream &&i, parser_callback_t cb=nullptr)
 deserialize from stream More...
 
std::istream & operator<< (basic_json &j, std::istream &i)
 deserialize from stream More...
diff --git a/classnlohmann_1_1basic__json_1_1const__iterator.html b/classnlohmann_1_1basic__json_1_1const__iterator.html index a72c5bac4..e479b8fbf 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator.html @@ -210,15 +210,16 @@ class nlohmann::basic_json::const_iterator

This class implements a const iterator for the basic_json class. From this class, the iterator class is derived.

Requirements
The class satisfies the following concept requirements:
    -
  • RandomAccessIterator: The iterator that can be moved to point (forward and backward) to any element in constant time.
  • +
  • RandomAccessIterator: The iterator that can be moved to point (forward and backward) to any element in constant time.
+
Since
version 1.0
-

Definition at line 5111 of file json.hpp.

+

Definition at line 5232 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 b50ffe3ed..8ec0fa627 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a019087161350d393f3e4ac841cdd3dbd.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a019087161350d393f3e4ac841cdd3dbd.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5358 of file json.hpp.

+

Definition at line 5468 of file json.hpp.

@@ -153,7 +153,7 @@ 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 c601ca7eb..23aee65e0 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a17e5f5d3598e6901f3c1c1f7dc60589f.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a17e5f5d3598e6901f3c1c1f7dc60589f.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5462 of file json.hpp.

+

Definition at line 5571 of file json.hpp.

@@ -153,7 +153,7 @@ 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 7ea029b8c..0f13e48b9 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a1cba94e5a67ee52bc66b898a4e08359d.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a1cba94e5a67ee52bc66b898a4e08359d.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5544 of file json.hpp.

+

Definition at line 5653 of file json.hpp.

@@ -153,7 +153,7 @@ 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 42e4e8fee..9cc1b60a2 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a211523a57024a43965862b497b89ab91.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a211523a57024a43965862b497b89ab91.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5187 of file json.hpp.

+

Definition at line 5308 of file json.hpp.

@@ -153,7 +153,7 @@ 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 1aa6c5348..98de9dc83 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a301749e9779adafd395369ac36df93df.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a301749e9779adafd395369ac36df93df.html @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5293 of file json.hpp.

+

Definition at line 5409 of file json.hpp.

@@ -152,7 +152,7 @@ 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 56d2b1b55..52e0d31f5 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a36086a699b95e06976c11367b7d6ba53.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a36086a699b95e06976c11367b7d6ba53.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5394 of file json.hpp.

+

Definition at line 5503 of file json.hpp.

@@ -153,7 +153,7 @@ 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 8929891ae..9847e4f1c 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a4632d8307fc315f21e2ecc9ba5aa6346.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a4632d8307fc315f21e2ecc9ba5aa6346.html @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5259 of file json.hpp.

+

Definition at line 5380 of file json.hpp.

@@ -152,7 +152,7 @@ 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 9568f72de..21535370c 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a4f7ac43b0ab34c387b1ae1a8e9c08467.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a4f7ac43b0ab34c387b1ae1a8e9c08467.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5122 of file json.hpp.

+

Definition at line 5243 of file json.hpp.

@@ -141,7 +141,7 @@ 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 4dafcb940..3edb60336 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a5aff013c03c1bdc248346c249bec7b67.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a5aff013c03c1bdc248346c249bec7b67.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5157 of file json.hpp.

+

Definition at line 5278 of file json.hpp.

@@ -153,7 +153,7 @@ 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 d8a2eb4f2..ac10d60d7 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a62cad59e006eb7fa594c2c5b65a76610.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a62cad59e006eb7fa594c2c5b65a76610.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5514 of file json.hpp.

+

Definition at line 5623 of file json.hpp.

@@ -153,7 +153,7 @@ 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 30732b584..29e73927a 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a67848d4b7bfa576434ad9807147b5870.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a67848d4b7bfa576434ad9807147b5870.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5118 of file json.hpp.

+

Definition at line 5239 of file json.hpp.

@@ -141,7 +141,7 @@ 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 31e0f6b53..6e01fedc6 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a6b3e43d2f45fa611825dbdf4e88fffe2.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a6b3e43d2f45fa611825dbdf4e88fffe2.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5468 of file json.hpp.

+

Definition at line 5577 of file json.hpp.

@@ -153,7 +153,7 @@ 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 c921796cd..a33197380 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a83454954e4e16be3d5316f9322e91a34.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a83454954e4e16be3d5316f9322e91a34.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5132 of file json.hpp.

+

Definition at line 5253 of file json.hpp.

@@ -153,7 +153,7 @@ 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 fefe016dd..35203fc8c 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a86a1771e6658d0b14868df6c197d2353.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a86a1771e6658d0b14868df6c197d2353.html @@ -150,7 +150,7 @@ 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 fdc08cac9..24896237d 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_a8d024cbc99db0d8106899f9fd9973735.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_a8d024cbc99db0d8106899f9fd9973735.html @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5578 of file json.hpp.

+

Definition at line 5682 of file json.hpp.

@@ -152,7 +152,7 @@ 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 161f54640..5b319848d 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ab74b39747a9dad60650a57133fca85b3.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ab74b39747a9dad60650a57133fca85b3.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5474 of file json.hpp.

+

Definition at line 5583 of file json.hpp.

@@ -153,7 +153,7 @@ 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 20f74d801..5ff0e71b0 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ab7dacd8e3ee9b3756bfcdb87dd55a515.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ab7dacd8e3ee9b3756bfcdb87dd55a515.html @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5591 of file json.hpp.

+

Definition at line 5690 of file json.hpp.

@@ -152,7 +152,7 @@ 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 df1862ed6..f4d4bac5a 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ab9d31bf0d0b4d7310c858a04ce84a52f.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ab9d31bf0d0b4d7310c858a04ce84a52f.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5422 of file json.hpp.

+

Definition at line 5531 of file json.hpp.

@@ -153,7 +153,7 @@ 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 e0c3eb21e..6a0d58812 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_abb1921cbf0ad4036c83bc6303e22171f.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_abb1921cbf0ad4036c83bc6303e22171f.html @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5367 of file json.hpp.

+

Definition at line 5476 of file json.hpp.

@@ -152,7 +152,7 @@ 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 6b4551424..65e521f18 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_abbacd95955c602efc9a58ed1ffdb46c4.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_abbacd95955c602efc9a58ed1ffdb46c4.html @@ -142,7 +142,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5331 of file json.hpp.

+

Definition at line 5441 of file json.hpp.

@@ -152,7 +152,7 @@ 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 6c89d5ed1..433cd2f10 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ac36b9187de43721a4bf1b052578bb80b.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ac36b9187de43721a4bf1b052578bb80b.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5120 of file json.hpp.

+

Definition at line 5241 of file json.hpp.

@@ -141,7 +141,7 @@ 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 e6b8b9634..27527ca4e 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ac634a659837f5aebc97125e031de23b5.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ac634a659837f5aebc97125e031de23b5.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5506 of file json.hpp.

+

Definition at line 5615 of file json.hpp.

@@ -153,7 +153,7 @@ 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 28356ef68..a63f6db04 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_acea5b75d1087e2a92833946d9dc547ff.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_acea5b75d1087e2a92833946d9dc547ff.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5428 of file json.hpp.

+

Definition at line 5537 of file json.hpp.

@@ -153,7 +153,7 @@ 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 82d0de2b5..e206a5fad 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ada3100cdb8700566051828f1355fa745.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ada3100cdb8700566051828f1355fa745.html @@ -139,7 +139,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5114 of file json.hpp.

+

Definition at line 5235 of file json.hpp.

@@ -149,7 +149,7 @@ 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 4d26fffd7..942632017 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_adb50d6043ace464d9f694869724d7fb2.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_adb50d6043ace464d9f694869724d7fb2.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5124 of file json.hpp.

+

Definition at line 5245 of file json.hpp.

@@ -141,7 +141,7 @@ 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 02bdd4ade..d373cbf7e 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_adda9a4bd7f0edb9cb39dc0dca3d4a286.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_adda9a4bd7f0edb9cb39dc0dca3d4a286.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5522 of file json.hpp.

+

Definition at line 5631 of file json.hpp.

@@ -153,7 +153,7 @@ 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 b9b5fc433..563241367 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_adf6f9d3f8f8d8b1ccedabb4f04c098ad.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5322 of file json.hpp.

+

Definition at line 5433 of file json.hpp.

@@ -153,7 +153,7 @@ 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 d45c15caf..f8804045e 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_ae480d5c86e5e1129d53d1e19782017a6.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_ae480d5c86e5e1129d53d1e19782017a6.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5126 of file json.hpp.

+

Definition at line 5247 of file json.hpp.

@@ -141,7 +141,7 @@ 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 3626f25fc..669c8fac8 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_aebd099d9a70ffe760242ef24046c9002.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_aebd099d9a70ffe760242ef24046c9002.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5456 of file json.hpp.

+

Definition at line 5565 of file json.hpp.

@@ -153,7 +153,7 @@ 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 930b695d4..499f9ed26 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_af34f68f1ce670e7f25ce267b2b1e64ab.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_af34f68f1ce670e7f25ce267b2b1e64ab.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5500 of file json.hpp.

+

Definition at line 5609 of file json.hpp.

@@ -153,7 +153,7 @@ 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 3832f76e0..cf870d91a 100644 --- a/classnlohmann_1_1basic__json_1_1const__iterator_af55564e391b23e41abe78bc4bbe4edcb.html +++ b/classnlohmann_1_1basic__json_1_1const__iterator_af55564e391b23e41abe78bc4bbe4edcb.html @@ -143,7 +143,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5182 of file json.hpp.

+

Definition at line 5303 of file json.hpp.

@@ -153,7 +153,7 @@ 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 d0ba9062a..87cf3a8eb 100644 --- a/classnlohmann_1_1basic__json_1_1iterator-members.html +++ b/classnlohmann_1_1basic__json_1_1iterator-members.html @@ -135,7 +135,7 @@ 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 f6acab77e..efe62afed 100644 --- a/classnlohmann_1_1basic__json_1_1iterator.html +++ b/classnlohmann_1_1basic__json_1_1iterator.html @@ -261,15 +261,16 @@ class nlohmann::basic_json::iterator
Requirements
The class satisfies the following concept requirements:
  • RandomAccessIterator: The iterator that can be moved to point (forward and backward) to any element in constant time.
  • -
  • OutputIterator: It is possible to write to the pointed-to element.
  • +
  • OutputIterator: It is possible to write to the pointed-to element.
+
Since
version 1.0
-

Definition at line 5613 of file json.hpp.

+

Definition at line 5714 of file json.hpp.

diff --git a/classnlohmann_1_1basic__json_1_1iterator__wrapper-members.html b/classnlohmann_1_1basic__json_1_1iterator__wrapper-members.html index 048254f49..5fe863d20 100644 --- a/classnlohmann_1_1basic__json_1_1iterator__wrapper-members.html +++ b/classnlohmann_1_1basic__json_1_1iterator__wrapper-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classnlohmann_1_1basic__json_1_1iterator__wrapper.html b/classnlohmann_1_1basic__json_1_1iterator__wrapper.html index 4cb560e3c..2b98ddc8b 100644 --- a/classnlohmann_1_1basic__json_1_1iterator__wrapper.html +++ b/classnlohmann_1_1basic__json_1_1iterator__wrapper.html @@ -119,11 +119,11 @@ class nlohmann::basic_json::iterator_wrapper

This class 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.

-

Definition at line 5848 of file json.hpp.

+

Definition at line 5951 of file json.hpp.

diff --git a/classnlohmann_1_1basic__json_1_1iterator__wrapper_a784f17dec56c1ec90b0b73eb8307ea7d.html b/classnlohmann_1_1basic__json_1_1iterator__wrapper_a784f17dec56c1ec90b0b73eb8307ea7d.html index 2ee04f580..5e07e52eb 100644 --- a/classnlohmann_1_1basic__json_1_1iterator__wrapper_a784f17dec56c1ec90b0b73eb8307ea7d.html +++ b/classnlohmann_1_1basic__json_1_1iterator__wrapper_a784f17dec56c1ec90b0b73eb8307ea7d.html @@ -115,7 +115,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5925 of file json.hpp.

+

Definition at line 6028 of file json.hpp.

@@ -125,7 +125,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator__wrapper_a80305d6ac43b6fb53c62256e450485ac.html b/classnlohmann_1_1basic__json_1_1iterator__wrapper_a80305d6ac43b6fb53c62256e450485ac.html index 95850f422..3fb2a0232 100644 --- a/classnlohmann_1_1basic__json_1_1iterator__wrapper_a80305d6ac43b6fb53c62256e450485ac.html +++ b/classnlohmann_1_1basic__json_1_1iterator__wrapper_a80305d6ac43b6fb53c62256e450485ac.html @@ -114,7 +114,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5930 of file json.hpp.

+

Definition at line 6033 of file json.hpp.

@@ -124,7 +124,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator__wrapper_ab5951e20b05998e768943acd0b418c81.html b/classnlohmann_1_1basic__json_1_1iterator__wrapper_ab5951e20b05998e768943acd0b418c81.html index a75b3ec19..06a5853fa 100644 --- a/classnlohmann_1_1basic__json_1_1iterator__wrapper_ab5951e20b05998e768943acd0b418c81.html +++ b/classnlohmann_1_1basic__json_1_1iterator__wrapper_ab5951e20b05998e768943acd0b418c81.html @@ -114,7 +114,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5936 of file json.hpp.

+

Definition at line 6039 of file json.hpp.

@@ -124,7 +124,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html b/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html index 7e74739bb..c465fa610 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a037e5f3de196ff4cea8a95a8a4e35882.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5665 of file json.hpp.

+

Definition at line 5766 of file json.hpp.

@@ -141,7 +141,7 @@ 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 4a8afac75..65b89aed9 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a0a43bd93e6e46645ed0b93d3af7bfe22.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a0a43bd93e6e46645ed0b93d3af7bfe22.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5694 of file json.hpp.

+

Definition at line 5795 of file json.hpp.

@@ -142,7 +142,7 @@ 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 dcf193ddb..1ea9dbc8e 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a0c0acb68cc2a50a0e8782f860184883f.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a0c0acb68cc2a50a0e8782f860184883f.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5709 of file json.hpp.

+

Definition at line 5810 of file json.hpp.

@@ -142,7 +142,7 @@ 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 279fd767c..7574a73fe 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a0eb7ac9b746fb6f931ae728f70f92a8e.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a0eb7ac9b746fb6f931ae728f70f92a8e.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5722 of file json.hpp.

+

Definition at line 5823 of file json.hpp.

@@ -142,7 +142,7 @@ 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 01b3a478d..917a35b4a 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a1220b360a07b0605f7d2f4b3cfd16736.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a1220b360a07b0605f7d2f4b3cfd16736.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5651 of file json.hpp.

+

Definition at line 5752 of file json.hpp.

@@ -141,7 +141,7 @@ 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 f8e455ec8..305d14ba0 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a21d32a4547ba4cbadd8b435a6a0d0e1b.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a21d32a4547ba4cbadd8b435a6a0d0e1b.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5680 of file json.hpp.

+

Definition at line 5781 of file json.hpp.

@@ -141,7 +141,7 @@ 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 a943e56d3..a77eb4ebd 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a302d810a0685f8d39368eaa65c833acf.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a302d810a0685f8d39368eaa65c833acf.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5716 of file json.hpp.

+

Definition at line 5817 of file json.hpp.

@@ -142,7 +142,7 @@ 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 df33e0f6b..0a6574758 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a33277dbf06ac5c1e7102e26f6b5e2c00.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a33277dbf06ac5c1e7102e26f6b5e2c00.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5645 of file json.hpp.

+

Definition at line 5746 of file json.hpp.

@@ -141,7 +141,7 @@ 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 d294c1ed4..3694ff99d 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a4ae612fa9eb59784047b40f0419db65d.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a4ae612fa9eb59784047b40f0419db65d.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5672 of file json.hpp.

+

Definition at line 5773 of file json.hpp.

@@ -142,7 +142,7 @@ 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 ca579c765..2edb6bf2e 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a4f6e03ae3bb674ebf0b727f74957c12f.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a4f6e03ae3bb674ebf0b727f74957c12f.html @@ -139,7 +139,7 @@ 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 6726bb34c..f50f19e25 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a6e91e9d94a0e14d2fc28cfdf3beac2b1.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5633 of file json.hpp.

+

Definition at line 5734 of file json.hpp.

@@ -142,7 +142,7 @@ 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 2fbf22299..025541d8b 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a7031e759ee52d1283aada0ff81108a5e.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a7031e759ee52d1283aada0ff81108a5e.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5687 of file json.hpp.

+

Definition at line 5788 of file json.hpp.

@@ -142,7 +142,7 @@ 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 64f3bd7bf..7511f7f69 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a94285e2ade0bfef829b81377bbbca6cf.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a94285e2ade0bfef829b81377bbbca6cf.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5628 of file json.hpp.

+

Definition at line 5729 of file json.hpp.

@@ -142,7 +142,7 @@ 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 cd0e999d8..46dc3cd2f 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_a9fcfda575b08d0c73b6274cdbbe7f184.html +++ b/classnlohmann_1_1basic__json_1_1iterator_a9fcfda575b08d0c73b6274cdbbe7f184.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5657 of file json.hpp.

+

Definition at line 5758 of file json.hpp.

@@ -142,7 +142,7 @@ 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 c1ecf1784..e3b30f9c7 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_aa2bd10afdcfc70acb8eaabbd2f6496f0.html +++ b/classnlohmann_1_1basic__json_1_1iterator_aa2bd10afdcfc70acb8eaabbd2f6496f0.html @@ -120,7 +120,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5618 of file json.hpp.

+

Definition at line 5719 of file json.hpp.

@@ -130,7 +130,7 @@ 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 d94020040..5b059ae20 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_ab220a0cc3fe410fbae4524208bd5834f.html +++ b/classnlohmann_1_1basic__json_1_1iterator_ab220a0cc3fe410fbae4524208bd5834f.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5624 of file json.hpp.

+

Definition at line 5725 of file json.hpp.

@@ -142,7 +142,7 @@ 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 b77eb4a3c..9a535cdef 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html +++ b/classnlohmann_1_1basic__json_1_1iterator_ab5cf753cb2f8ce53b9f3e54c39e50ee3.html @@ -132,7 +132,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5701 of file json.hpp.

+

Definition at line 5802 of file json.hpp.

@@ -142,7 +142,7 @@ 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 e50bf65e4..3e1dfc533 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_abaebf4e21956dd20d9f862fa5647d32d.html +++ b/classnlohmann_1_1basic__json_1_1iterator_abaebf4e21956dd20d9f862fa5647d32d.html @@ -120,7 +120,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5616 of file json.hpp.

+

Definition at line 5717 of file json.hpp.

@@ -130,7 +130,7 @@ 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 3f68ccf05..a9eed5d52 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_af64127418c567660d92b1afdfe9676db.html +++ b/classnlohmann_1_1basic__json_1_1iterator_af64127418c567660d92b1afdfe9676db.html @@ -131,7 +131,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5728 of file json.hpp.

+

Definition at line 5829 of file json.hpp.

@@ -141,7 +141,7 @@ 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 e3f20165a..a4e5cf10a 100644 --- a/classnlohmann_1_1basic__json_1_1iterator_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html +++ b/classnlohmann_1_1basic__json_1_1iterator_afe65b5a0572c7bfdd7ccc942bb8e9fe2.html @@ -120,7 +120,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 5617 of file json.hpp.

+

Definition at line 5718 of file json.hpp.

@@ -130,7 +130,7 @@ 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 4e2226818..f4e16febf 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator-members.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator-members.html @@ -112,7 +112,7 @@ 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 a08b7b684..f4d1dea5a 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator.html @@ -165,15 +165,16 @@ class nlohmann::basic_json::json_reverse_iterator< Base >
Requirements
The class satisfies the following concept requirements:
+
Since
version 1.0
-

Definition at line 226 of file json.hpp.

+

Definition at line 232 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 cf934babf..23eedb18f 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a03e542423284327d3801cf078f1c2b44.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a03e542423284327d3801cf078f1c2b44.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5807 of file json.hpp.

+

Definition at line 5910 of file json.hpp.

@@ -139,7 +139,7 @@ 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 1240fcfdc..00b109c73 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a0b494ef7570d031216f907d2c85ec323.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a0b494ef7570d031216f907d2c85ec323.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5759 of file json.hpp.

+

Definition at line 5862 of file json.hpp.

@@ -139,7 +139,7 @@ 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 5933d0d71..96f584594 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a15e9cf4c5a43238e82ab69c4a295c491.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a15e9cf4c5a43238e82ab69c4a295c491.html @@ -128,7 +128,7 @@ template<typename Base >
-

Definition at line 5772 of file json.hpp.

+

Definition at line 5875 of file json.hpp.

@@ -138,7 +138,7 @@ 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 830fcdfa7..449a9f2a1 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a1c84e6d1f047ab4105fa665f455158a7.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a1c84e6d1f047ab4105fa665f455158a7.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5799 of file json.hpp.

+

Definition at line 5902 of file json.hpp.

@@ -139,7 +139,7 @@ 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 deedd2784..60558c48e 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a2a1dc92fbec862883c8b89755c787c99.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a2a1dc92fbec862883c8b89755c787c99.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5792 of file json.hpp.

+

Definition at line 5895 of file json.hpp.

@@ -139,7 +139,7 @@ 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 048060bc0..26ec7c672 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a5ee9ec91a6ddcd8d72278d681361626f.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a5ee9ec91a6ddcd8d72278d681361626f.html @@ -117,7 +117,7 @@ template<typename Base >
-

Definition at line 5756 of file json.hpp.

+

Definition at line 5859 of file json.hpp.

@@ -127,7 +127,7 @@ 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 eb326a7cf..57eedc2a1 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a61d31531e0dfc5448e7fa15678b05bbe.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a61d31531e0dfc5448e7fa15678b05bbe.html @@ -128,7 +128,7 @@ template<typename Base >
-

Definition at line 5834 of file json.hpp.

+

Definition at line 5937 of file json.hpp.

@@ -138,7 +138,7 @@ 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 acfb69797..9c8bed967 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a6bd38ed124df0332ba3263a9176b0101.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a6bd38ed124df0332ba3263a9176b0101.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5779 of file json.hpp.

+

Definition at line 5882 of file json.hpp.

@@ -139,7 +139,7 @@ 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 b6453c1d3..277e5bc17 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a70086e392779ecbbc9e6845b2be126a0.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_a70086e392779ecbbc9e6845b2be126a0.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5763 of file json.hpp.

+

Definition at line 5866 of file json.hpp.

@@ -139,7 +139,7 @@ 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 53fb976a2..00f148228 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_aa82b48aee07baee284f8340b37ec6864.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_aa82b48aee07baee284f8340b37ec6864.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5766 of file json.hpp.

+

Definition at line 5869 of file json.hpp.

@@ -139,7 +139,7 @@ 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 85d4e9338..fb18402a1 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ab6245ab29d8481ef2a2351c02cc31d4d.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ab6245ab29d8481ef2a2351c02cc31d4d.html @@ -117,7 +117,7 @@ template<typename Base >
-

Definition at line 5754 of file json.hpp.

+

Definition at line 5857 of file json.hpp.

@@ -127,7 +127,7 @@ 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 5c1b557c4..4f0cbe1ef 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ac427d8f61858c13b7c16649bfbf75e76.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ac427d8f61858c13b7c16649bfbf75e76.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5815 of file json.hpp.

+

Definition at line 5918 of file json.hpp.

@@ -139,7 +139,7 @@ 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 0457e698b..cd6f306eb 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ad3d6837b6f97065625c6c65f62f4b6d4.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ad3d6837b6f97065625c6c65f62f4b6d4.html @@ -128,7 +128,7 @@ template<typename Base >
-

Definition at line 5785 of file json.hpp.

+

Definition at line 5888 of file json.hpp.

@@ -138,7 +138,7 @@ 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 8112f9809..ec79c0a5c 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ae988bd36b7d098b1157871f83b2d6265.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_ae988bd36b7d098b1157871f83b2d6265.html @@ -129,7 +129,7 @@ template<typename Base >
-

Definition at line 5821 of file json.hpp.

+

Definition at line 5924 of file json.hpp.

@@ -139,7 +139,7 @@ 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 9f55f6fec..69f15888c 100644 --- a/classnlohmann_1_1basic__json_1_1json__reverse__iterator_af972fce017b24906236ab235857a11a8.html +++ b/classnlohmann_1_1basic__json_1_1json__reverse__iterator_af972fce017b24906236ab235857a11a8.html @@ -128,7 +128,7 @@ template<typename Base >
-

Definition at line 5827 of file json.hpp.

+

Definition at line 5930 of file json.hpp.

@@ -138,7 +138,7 @@ template<typename Base > diff --git a/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html b/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html index 7b8d0eb02..382a4e367 100644 --- a/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html +++ b/classnlohmann_1_1basic__json_a01a2643289b69cd71d9b3f3fc209b748.html @@ -273,14 +273,15 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
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:3278
+
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:3338
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/count.cpp -o count 
+
Since
version 1.0
-

Definition at line 3278 of file json.hpp.

+

Definition at line 3338 of file json.hpp.

@@ -290,7 +291,7 @@ number of elements with key "three": 0 diff --git a/classnlohmann_1_1basic__json_a034bccea9f5400650443e9f12e67b079.html b/classnlohmann_1_1basic__json_a034bccea9f5400650443e9f12e67b079.html index 6ea7bae1b..669713569 100644 --- a/classnlohmann_1_1basic__json_a034bccea9f5400650443e9f12e67b079.html +++ b/classnlohmann_1_1basic__json_a034bccea9f5400650443e9f12e67b079.html @@ -287,8 +287,8 @@ In case the parameter value is not a number, a JSON null value is creat
19  std::cout << j_nan << '\n';
20  std::cout << j23 << '\n';
21 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
42.2299995422363
 null
 23.42
@@ -296,7 +296,7 @@ null
 
See also
basic_json(const number_float_t) – create a number value (floating-point)
Since
version 1.0
-

Definition at line 1281 of file json.hpp.

+

Definition at line 1304 of file json.hpp.

@@ -306,7 +306,7 @@ null diff --git a/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html b/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html index 34aede01b..9339b5f54 100644 --- a/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html +++ b/classnlohmann_1_1basic__json_a088460b5d95f384a4f2ec9e52f4f66ba.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
bool is_string() const noexcept
return whether value is a string
Definition: json.hpp:2040
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
bool is_string() const noexcept
return whether value is a string
Definition: json.hpp:2100
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
false
 false
 false
@@ -283,9 +283,10 @@ false
 false
 false
 true
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_string.cpp -o is_string 
+
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
-

Definition at line 2040 of file json.hpp.

+

Definition at line 2100 of file json.hpp.

@@ -295,7 +296,7 @@ true diff --git a/classnlohmann_1_1basic__json_a0a7560122349628cf4942a316aa6d21f.html b/classnlohmann_1_1basic__json_a0a7560122349628cf4942a316aa6d21f.html index 8b1578f98..f39ec7de5 100644 --- a/classnlohmann_1_1basic__json_a0a7560122349628cf4942a316aa6d21f.html +++ b/classnlohmann_1_1basic__json_a0a7560122349628cf4942a316aa6d21f.html @@ -284,16 +284,17 @@ template<template< typename U, typename V, typename...Args > class Obje
22  std::cout << array << '\n';
23  std::cout << null << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3770
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3858
Output (play with this example online):
[1,2,3,4,5]
 null
 [1,2,3,4,5,6,7]
 ["first","second"]
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
+ 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
-

Definition at line 3828 of file json.hpp.

+

Definition at line 3916 of file json.hpp.

@@ -303,7 +304,7 @@ null diff --git a/classnlohmann_1_1basic__json_a0a9c6a1fccc4db365860463e8203eb38.html b/classnlohmann_1_1basic__json_a0a9c6a1fccc4db365860463e8203eb38.html index d06910c3b..06fd9bed9 100644 --- a/classnlohmann_1_1basic__json_a0a9c6a1fccc4db365860463e8203eb38.html +++ b/classnlohmann_1_1basic__json_a0a9c6a1fccc4db365860463e8203eb38.html @@ -275,15 +275,15 @@ template<template< typename U, typename V, typename...Args > class Obje
13  // serialize the JSON object
14  std::cout << j << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
a type for an object
Definition: json.hpp:328
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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
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
-

Definition at line 910 of file json.hpp.

+

Definition at line 933 of file json.hpp.

@@ -293,7 +293,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a0bb6ea56c89560cce8003485bffe49d4.html b/classnlohmann_1_1basic__json_a0bb6ea56c89560cce8003485bffe49d4.html index 652ec3bcf..b2750580d 100644 --- a/classnlohmann_1_1basic__json_a0bb6ea56c89560cce8003485bffe49d4.html +++ b/classnlohmann_1_1basic__json_a0bb6ea56c89560cce8003485bffe49d4.html @@ -289,8 +289,8 @@ template<typename CompatibleNumberIntegerType , typename std::enable_if<
25  std::cout << j17 << '\n';
26  std::cout << j8 << '\n';
27 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
42
 23
 1024
@@ -302,7 +302,7 @@ template<typename CompatibleNumberIntegerType , typename std::enable_if<
 basic_json(const int) – create a number value (integer)
 
Since
version 1.0
-

Definition at line 1206 of file json.hpp.

+

Definition at line 1229 of file json.hpp.

@@ -312,7 +312,7 @@ template<typename CompatibleNumberIntegerType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_a0e372f4c5a90c6be7242a2d7a3709b48.html b/classnlohmann_1_1basic__json_a0e372f4c5a90c6be7242a2d7a3709b48.html index f975fb728..b1b0720fb 100644 --- a/classnlohmann_1_1basic__json_a0e372f4c5a90c6be7242a2d7a3709b48.html +++ b/classnlohmann_1_1basic__json_a0e372f4c5a90c6be7242a2d7a3709b48.html @@ -284,16 +284,17 @@ template<template< typename U, typename V, typename...Args > class Obje
22  std::cout << object << '\n';
23  std::cout << null << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3770
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3858
Output (play with this example online):
{"one":1,"two":2}
 null
 {"four":4,"one":1,"three":3,"two":2}
 {"A":"a","B":"b"}
-
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 
+
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
-

Definition at line 3875 of file json.hpp.

+

Definition at line 3965 of file json.hpp.

@@ -303,7 +304,7 @@ null diff --git a/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html b/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html index 2a2d4b3cc..8c92368ec 100644 --- a/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html +++ b/classnlohmann_1_1basic__json_a114095c452ca2f4ba976548df3da68be.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
bool is_null() const noexcept
return whether value is null
Definition: json.hpp:1918
+
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:1954
Output (play with this example online):
true
 false
 false
@@ -283,9 +283,10 @@ false
 false
 false
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_null.cpp -o is_null 
+ 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
-

Definition at line 1918 of file json.hpp.

+

Definition at line 1954 of file json.hpp.

@@ -295,7 +296,7 @@ false diff --git a/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html b/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html index ebe87b1a7..1efca3a21 100644 --- a/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html +++ b/classnlohmann_1_1basic__json_a11c3dd843c21c58daa651e84046a82af.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:2023
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
bool is_array() const noexcept
return whether value is an array
Definition: json.hpp:2081
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
false
 false
 false
@@ -283,9 +283,10 @@ false
 false
 true
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_array.cpp -o is_array 
+ 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
-

Definition at line 2023 of file json.hpp.

+

Definition at line 2081 of file json.hpp.

@@ -295,7 +296,7 @@ false diff --git a/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html b/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html index bbe62f5f5..f24fdc52c 100644 --- a/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html +++ b/classnlohmann_1_1basic__json_a122640e7e2db1814fc7bbb3c122ec76e.html @@ -293,15 +293,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
 "foo" == "bar" false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator__equal.cpp -o operator__equal 
+ 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
-

Definition at line 4244 of file json.hpp.

+

Definition at line 4356 of file json.hpp.

@@ -311,7 +312,7 @@ 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 737019dac..6d11888f3 100644 --- a/classnlohmann_1_1basic__json_a13e5642dbfa1602c937d295a085413cc.html +++ b/classnlohmann_1_1basic__json_a13e5642dbfa1602c937d295a085413cc.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 223 of file json.hpp.

+

Definition at line 229 of file json.hpp.

@@ -245,7 +245,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a15e468968cd4d0e4fd566044d66ada24.html b/classnlohmann_1_1basic__json_a15e468968cd4d0e4fd566044d66ada24.html index 0d656fc7f..57a868759 100644 --- a/classnlohmann_1_1basic__json_a15e468968cd4d0e4fd566044d66ada24.html +++ b/classnlohmann_1_1basic__json_a15e468968cd4d0e4fd566044d66ada24.html @@ -275,9 +275,9 @@ template<template< typename U, typename V, typename...Args > class Obje
13  // serialize the JSON array
14  std::cout << j << '\n';
15 }
-
StringType string_t
a type for a string
Definition: json.hpp:417
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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
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
@@ -285,7 +285,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
-

Definition at line 1035 of file json.hpp.

+

Definition at line 1058 of file json.hpp.

@@ -295,7 +295,7 @@ 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 f924b9766..a6b1e3d98 100644 --- a/classnlohmann_1_1basic__json_a1683189bd539313b5559f07961166c8b.html +++ b/classnlohmann_1_1basic__json_a1683189bd539313b5559f07961166c8b.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 233 of file json.hpp.

+

Definition at line 239 of file json.hpp.

@@ -245,7 +245,7 @@ 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 2a56b7f11..8d6fdb5d7 100644 --- a/classnlohmann_1_1basic__json_a16a275d0201e9aedc87c933c764b8869.html +++ b/classnlohmann_1_1basic__json_a16a275d0201e9aedc87c933c764b8869.html @@ -289,17 +289,18 @@ template<template< typename U, typename V, typename...Args > class Obje
25  std::cout << "out of range" << '\n';
26  }
27 }
-
a class to store JSON values
Definition: json.hpp:181
-
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:2539
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2582
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
See also
operator[](const typename object_t::key_type&) for unchecked access by reference
-value() for access by value with a default value
+value() for access by value with a default value +
Since
version 1.0
-

Definition at line 2643 of file json.hpp.

+

Definition at line 2677 of file json.hpp.

@@ -309,7 +310,7 @@ out of range diff --git a/classnlohmann_1_1basic__json_a190d719446e7016879c4b961c9cf9072.html b/classnlohmann_1_1basic__json_a190d719446e7016879c4b961c9cf9072.html index f428b2595..0b392baee 100644 --- a/classnlohmann_1_1basic__json_a190d719446e7016879c4b961c9cf9072.html +++ b/classnlohmann_1_1basic__json_a190d719446e7016879c4b961c9cf9072.html @@ -277,9 +277,9 @@ template<typename T , typename std::enable_if<
12  // serialize the JSON numbers
13  std::cout << j << '\n';
14 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:511
+
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
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)
@@ -287,7 +287,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
-

Definition at line 1142 of file json.hpp.

+

Definition at line 1165 of file json.hpp.

@@ -297,7 +297,7 @@ template<typename T , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html b/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html index d37977ed9..c944008a6 100644 --- a/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html +++ b/classnlohmann_1_1basic__json_a231b02148577b69a154b2ce2c87a5522.html @@ -271,7 +271,7 @@ template<template< typename U, typename V, typename...Args > class Obje -

Definition at line 595 of file json.hpp.

+

Definition at line 611 of file json.hpp.

@@ -281,7 +281,7 @@ 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 7ab863b16..54a3b98e5 100644 --- a/classnlohmann_1_1basic__json_a234f03dce002783748ca401a42bc6472.html +++ b/classnlohmann_1_1basic__json_a234f03dce002783748ca401a42bc6472.html @@ -277,17 +277,18 @@ template<typename PointerType , typename std::enable_if<
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:181
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
PointerType get_ptr() noexcept
get a pointer value (implicit)
Definition: json.hpp:2455
-
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:511
-
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:576
+
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:2896
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
PointerType get_ptr() noexcept
get a pointer value (implicit)
Definition: json.hpp:2494
+
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
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 
+ 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
-

Definition at line 2470 of file json.hpp.

+

Definition at line 2509 of file json.hpp.

@@ -297,7 +298,7 @@ true diff --git a/classnlohmann_1_1basic__json_a2448b2777e8a3e48614e1b3c41b96f7c.html b/classnlohmann_1_1basic__json_a2448b2777e8a3e48614e1b3c41b96f7c.html index 7b8cd5717..c0b2d0d56 100644 --- a/classnlohmann_1_1basic__json_a2448b2777e8a3e48614e1b3c41b96f7c.html +++ b/classnlohmann_1_1basic__json_a2448b2777e8a3e48614e1b3c41b96f7c.html @@ -272,8 +272,8 @@ template<template< typename U, typename V, typename...Args > class Obje
10  // serialize the JSON array
11  std::cout << j << '\n';
12 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
@@ -281,7 +281,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
-

Definition at line 1059 of file json.hpp.

+

Definition at line 1082 of file json.hpp.

@@ -291,7 +291,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html b/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html index da6a70c99..4fba0e4ad 100644 --- a/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html +++ b/classnlohmann_1_1basic__json_a266c4dd24d11a86e4831523af5d9df4d.html @@ -296,8 +296,8 @@ This function is required for compatibility reasons with Clang.
28  // output changed object
29  std::cout << std::setw(4) << object << '\n';
30 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
2
 
 {
@@ -320,9 +320,10 @@ This function is required for compatibility reasons with Clang.
 
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operatorarray__key_type.cpp -o operatorarray__key_type 
See also
at(const typename object_t::key_type&) for access by reference with range checking
-value() for access by value with a default value
+value() for access by value with a default value +
Since
version 1.0
-

Definition at line 2803 of file json.hpp.

+

Definition at line 2830 of file json.hpp.

@@ -332,7 +333,7 @@ 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 864d71951..80750fda4 100644 --- a/classnlohmann_1_1basic__json_a26b7e4876af25eae5800ce43f93aaef2.html +++ b/classnlohmann_1_1basic__json_a26b7e4876af25eae5800ce43f93aaef2.html @@ -317,16 +317,17 @@ Unlike 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:181
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2896
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-operator[](const typename object_t::key_type&) for unchecked access by reference
+operator[](const typename object_t::key_type&) for unchecked access by reference +
Since
version 1.0
-

Definition at line 2872 of file json.hpp.

+

Definition at line 2896 of file json.hpp.

@@ -336,7 +337,7 @@ Unlike diff --git a/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html b/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html index a7c380e54..563f5f348 100644 --- a/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html +++ b/classnlohmann_1_1basic__json_a2adfc8d24bea3908398cbf325b5dc1d7.html @@ -271,14 +271,15 @@ Illustration from cppreference.com
13  // serialize the element that the iterator points to
14  std::cout << *it << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
const_reverse_iterator crbegin() const
returns a const reverse iterator to the last element
Definition: json.hpp:3477
-
a template for a reverse iterator class
Definition: json.hpp:226
+
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:3551
+
a template for a reverse iterator class
Definition: json.hpp:232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/crbegin.cpp -o crbegin 
+
Since
version 1.0
-

Definition at line 3427 of file json.hpp.

+

Definition at line 3497 of file json.hpp.

@@ -288,7 +289,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html b/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html index a81a31bf6..383497b82 100644 --- a/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html +++ b/classnlohmann_1_1basic__json_a3287df6546c905fb0a5786deb4b1cf32.html @@ -298,11 +298,11 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
-
bool empty() const noexcept
checks whether the container is empty
Definition: json.hpp:3540
+
bool empty() const noexcept
checks whether the container is empty
Definition: json.hpp:3618
Output (play with this example online):
true
 false
 false
@@ -312,9 +312,10 @@ true
 false
 true
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/empty.cpp -o empty 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/empty.cpp -o empty 
+
Since
version 1.0
-

Definition at line 3540 of file json.hpp.

+

Definition at line 3618 of file json.hpp.

@@ -324,7 +325,7 @@ false diff --git a/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html b/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html index 5d90db2bd..e007fd8d7 100644 --- a/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html +++ b/classnlohmann_1_1basic__json_a33f1632cfdbf460b4913f4e8a43dd9e4.html @@ -271,14 +271,14 @@ template<template< typename U, typename V, typename...Args > class Obje
14  std::cout << a << '\n';
15  std::cout << b << '\n';
16 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-

Definition at line 1715 of file json.hpp.

+

Definition at line 1738 of file json.hpp.

@@ -288,7 +288,7 @@ 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 f1338f0e1..510757113 100644 --- a/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html +++ b/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html @@ -284,8 +284,8 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
{"one":1,"two":2}
 
 [1,2,4,8,16]
@@ -303,9 +303,10 @@ template<template< typename U, typename V, typename...Args > class Obje
   16
 ]
 
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator_serialize.cpp -o operator_serialize 
+ 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
-

Definition at line 4537 of file json.hpp.

+

Definition at line 4665 of file json.hpp.

@@ -315,7 +316,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a429c2606865483ff357cccc1b1c46569.html b/classnlohmann_1_1basic__json_a429c2606865483ff357cccc1b1c46569.html index f03b952ad..c345ded32 100644 --- a/classnlohmann_1_1basic__json_a429c2606865483ff357cccc1b1c46569.html +++ b/classnlohmann_1_1basic__json_a429c2606865483ff357cccc1b1c46569.html @@ -284,16 +284,17 @@ template<template< typename U, typename V, typename...Args > class Obje
22  std::cout << array << '\n';
23  std::cout << null << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3770
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3858
Output (play with this example online):
[1,2,3,4,5]
 null
 [1,2,3,4,5,6,7]
 ["first","second"]
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
+ 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
-

Definition at line 3770 of file json.hpp.

+

Definition at line 3858 of file json.hpp.

@@ -303,7 +304,7 @@ null diff --git a/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html b/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html index f0e9eb4ab..77d0e95e8 100644 --- a/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html +++ b/classnlohmann_1_1basic__json_a42f9133f978dde4cce5851b2c2434a0c.html @@ -273,10 +273,10 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
value_t type() const noexcept
return the type of the JSON value (explicit)
Definition: json.hpp:1864
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
value_t type() const noexcept
return the type of the JSON value (explicit)
Definition: json.hpp:1894
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
@@ -290,9 +290,10 @@ true true true true - The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/type.cpp -o type 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/type.cpp -o type 
+
Since
version 1.0
-

Definition at line 1864 of file json.hpp.

+

Definition at line 1894 of file json.hpp.

@@ -302,7 +303,7 @@ true diff --git a/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html b/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html index 9899493ee..b88d25a91 100644 --- a/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html +++ b/classnlohmann_1_1basic__json_a4361aa791f3980abb239e4155a3450cb.html @@ -272,14 +272,15 @@ Illustration from cppreference.com
13  // serialize the element that the iterator points to
14  std::cout << *it << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
const_iterator cbegin() const
returns a const iterator to the first element
Definition: json.hpp:3342
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
a const random access iterator for the basic_json class
Definition: json.hpp:5111
+
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:3406
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
a const random access iterator for the basic_json class
Definition: json.hpp:5232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/cbegin.cpp -o cbegin 
+
Since
version 1.0
-

Definition at line 3320 of file json.hpp.

+

Definition at line 3382 of file json.hpp.

@@ -289,7 +290,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html b/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html index 8bdf2a1b5..5abe1b7fd 100644 --- a/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html +++ b/classnlohmann_1_1basic__json_a4943b7f16ddc4e0df33c0cae7ef14471.html @@ -274,14 +274,15 @@ Illustration from cppreference.com
16  // serialize the element that the iterator points to
17  std::cout << *it << '\n';
18 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
const_reverse_iterator crend() const
returns a const reverse iterator to one before the first
Definition: json.hpp:3498
-
a template for a reverse iterator class
Definition: json.hpp:226
+
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:3574
+
a template for a reverse iterator class
Definition: json.hpp:232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/crend.cpp -o crend 
+
Since
version 1.0
-

Definition at line 3498 of file json.hpp.

+

Definition at line 3574 of file json.hpp.

@@ -291,7 +292,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html b/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html index a9ee78264..9af6a5727 100644 --- a/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html +++ b/classnlohmann_1_1basic__json_a4ad3f27ecece8f644e8dca69a97eb67f.html @@ -274,14 +274,15 @@ Illustration from cppreference.com
16  // serialize the element that the iterator points to
17  std::cout << *it << '\n';
18 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
const_reverse_iterator crend() const
returns a const reverse iterator to one before the first
Definition: json.hpp:3498
-
a template for a reverse iterator class
Definition: json.hpp:226
+
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:3574
+
a template for a reverse iterator class
Definition: json.hpp:232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/crend.cpp -o crend 
+
Since
version 1.0
-

Definition at line 3456 of file json.hpp.

+

Definition at line 3528 of file json.hpp.

@@ -291,7 +292,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html b/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html index d0b8e2615..67fb48a03 100644 --- a/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html +++ b/classnlohmann_1_1basic__json_a4bf695ddf4a00ea8feea2c725ec847f1.html @@ -279,15 +279,16 @@ template<template< typename U, typename V, typename...Args > class Obje
17  std::cout << "value = " << value << '\n';
18  std::cout << "object = " << object << '\n';
19 }
-
a class to store JSON values
Definition: json.hpp:181
-
ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
a type for an object
Definition: json.hpp:328
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
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:4081
+
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:4183
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 
+ 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
-

Definition at line 4139 of file json.hpp.

+

Definition at line 4245 of file json.hpp.

@@ -297,7 +298,7 @@ object = {"one":"eins","two":"zwei"} diff --git a/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html b/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html index 0692039cb..cdc05c795 100644 --- a/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html +++ b/classnlohmann_1_1basic__json_a4d688b5ff534d3ab4e284b3191061529.html @@ -271,14 +271,15 @@ Illustration from cppreference.com
13  // serialize the element that the iterator points to
14  std::cout << *it << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
const_reverse_iterator crbegin() const
returns a const reverse iterator to the last element
Definition: json.hpp:3477
-
a template for a reverse iterator class
Definition: json.hpp:226
+
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:3551
+
a template for a reverse iterator class
Definition: json.hpp:232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/crbegin.cpp -o crbegin 
+
Since
version 1.0
-

Definition at line 3477 of file json.hpp.

+

Definition at line 3551 of file json.hpp.

@@ -288,7 +289,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html b/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html index 71373180d..6e166fe50 100644 --- a/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html +++ b/classnlohmann_1_1basic__json_a53a2abfdd4f72c7df5aba1155bf03e48.html @@ -274,9 +274,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
bool is_discarded() const noexcept
return whether value is discarded
Definition: json.hpp:2062
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
bool is_discarded() const noexcept
return whether value is discarded
Definition: json.hpp:2124
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
false
 false
 false
@@ -284,9 +284,10 @@ false
 false
 false
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_discarded.cpp -o is_discarded 
+ 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
-

Definition at line 2062 of file json.hpp.

+

Definition at line 2124 of file json.hpp.

@@ -296,7 +297,7 @@ false diff --git a/classnlohmann_1_1basic__json_a55edaf09e1f7785463475f809d987cee.html b/classnlohmann_1_1basic__json_a55edaf09e1f7785463475f809d987cee.html index 0f72b36a4..95d0e909f 100644 --- a/classnlohmann_1_1basic__json_a55edaf09e1f7785463475f809d987cee.html +++ b/classnlohmann_1_1basic__json_a55edaf09e1f7785463475f809d987cee.html @@ -296,15 +296,16 @@ template<template< typename U, typename V, typename...Args > class Obje
14  std::cout << *new_pos << '\n';
15  std::cout << v << '\n';
16 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3899
+
a class to store JSON values
Definition: json.hpp:187
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3991
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 
+ 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
-

Definition at line 3950 of file json.hpp.

+

Definition at line 4044 of file json.hpp.

@@ -314,7 +315,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html b/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html index d63042958..36c7d870d 100644 --- a/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html +++ b/classnlohmann_1_1basic__json_a57703688bee6b9736ab3a430d8d246f2.html @@ -286,14 +286,15 @@ template<template< typename U, typename V, typename...Args > class Obje
22  // output changed array
23  std::cout << array << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ 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
-

Definition at line 2678 of file json.hpp.

+

Definition at line 2709 of file json.hpp.

@@ -303,7 +304,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html b/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html index eb60d2d91..7d2bc1e31 100644 --- a/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html +++ b/classnlohmann_1_1basic__json_a57a96ab3ff1ce7b48a754129fb12c982.html @@ -279,15 +279,16 @@ template<template< typename U, typename V, typename...Args > class Obje
17  std::cout << "value = " << value << '\n';
18  std::cout << "string = " << string << '\n';
19 }
-
StringType string_t
a type for a string
Definition: json.hpp:417
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
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:4081
+
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:4183
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 
+ 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
-

Definition at line 4169 of file json.hpp.

+

Definition at line 4277 of file json.hpp.

@@ -297,7 +298,7 @@ string = the bad diff --git a/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html b/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html index 3a1053a05..475e8c53c 100644 --- a/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html +++ b/classnlohmann_1_1basic__json_a5a2d4dbcdbc8ea065b87daf52cd786b9.html @@ -264,8 +264,8 @@ template<template< typename U, typename V, typename...Args > class Obje
10  // serialize the JSON null value
11  std::cout << j << '\n';
12 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
@@ -279,7 +279,7 @@ 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 e794312b6..8cbf4c74d 100644 --- a/classnlohmann_1_1basic__json_a5c8bb5200f5eac10d31e26be46e5b1ac.html +++ b/classnlohmann_1_1basic__json_a5c8bb5200f5eac10d31e26be46e5b1ac.html @@ -289,15 +289,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
 "foo" == "bar" true
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator__greater.cpp -o operator__greater 
+ 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
-

Definition at line 4444 of file json.hpp.

+

Definition at line 4566 of file json.hpp.

@@ -307,7 +308,7 @@ 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 c3dc53332..c45c7dc6d 100644 --- a/classnlohmann_1_1basic__json_a5d428360d75a52f6af74751d1cc912c6.html +++ b/classnlohmann_1_1basic__json_a5d428360d75a52f6af74751d1cc912c6.html @@ -282,11 +282,11 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
-
value_t
the JSON type enumeration
Definition: json.hpp:595
+
value_t
the JSON type enumeration
Definition: json.hpp:611
array (ordered collection of values)
number value (floating-point)
@@ -299,9 +299,10 @@ true true true true - The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator__value_t.cpp -o operator__value_t 
+ 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
-

Definition at line 2080 of file json.hpp.

+

Definition at line 2144 of file json.hpp.

@@ -311,7 +312,7 @@ true diff --git a/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html b/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html index e4e289599..60d9dde26 100644 --- a/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html +++ b/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html @@ -284,8 +284,8 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
{"one":1,"two":2}
 
 [1,2,4,8,16]
@@ -303,9 +303,10 @@ template<template< typename U, typename V, typename...Args > class Obje
   16
 ]
 
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator_serialize.cpp -o operator_serialize 
+ 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
-

Definition at line 4519 of file json.hpp.

+

Definition at line 4647 of file json.hpp.

@@ -315,7 +316,7 @@ 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 b8c3ee614..3e9391b28 100644 --- a/classnlohmann_1_1basic__json_a5f0aad50ed7e8aec3128fe018c18b3fe.html +++ b/classnlohmann_1_1basic__json_a5f0aad50ed7e8aec3128fe018c18b3fe.html @@ -311,9 +311,9 @@ template<typename ValueType , typename std::enable_if<
47  std::cout << i.first << ": " << i.second << '\n';
48  }
49 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
ValueType get() const
get a value (explicit)
Definition: json.hpp:2374
+
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:2410
Output (play with this example online):
1
 42 42
 17.23 17
@@ -328,9 +328,10 @@ array: [1,2,3,4,5]
 
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/get__ValueType_const.cpp -o get__ValueType_const 
See also
operator ValueType() const for implicit conversion
-get() for pointer-member access
+get() for pointer-member access +
Since
version 1.0
-

Definition at line 2374 of file json.hpp.

+

Definition at line 2410 of file json.hpp.

@@ -340,7 +341,7 @@ array: [1,2,3,4,5] diff --git a/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html b/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html index 45377202a..7d3308a15 100644 --- a/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html +++ b/classnlohmann_1_1basic__json_a5fd8b54389698edf0c08e2dd001f610b.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 206 of file json.hpp.

+

Definition at line 212 of file json.hpp.

@@ -245,7 +245,7 @@ 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 6c4c12fa9..a97e80e88 100644 --- a/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html +++ b/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html @@ -295,8 +295,8 @@ template<template< typename U, typename V, typename...Args > class Obje
21  // serialize JSON
22  std::cout << std::setw(2) << j << '\n';
23 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
{
   "array": [
     1,
@@ -311,9 +311,10 @@ template<template< typename U, typename V, typename...Args > class Obje
   "string": "Hello, world!"
 }
 
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator_deserialize.cpp -o operator_deserialize 
-
See also
parse(std::istream&, parser_callback_t) for a variant with a parser callback function to filter values while parsing
+
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
-

Definition at line 4632 of file json.hpp.

+

Definition at line 4769 of file json.hpp.

@@ -323,7 +324,7 @@ 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 27008c736..050dc3a3b 100644 --- a/classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html +++ b/classnlohmann_1_1basic__json_a63691315292df8e1522b00d37ebb1ffc.html @@ -237,7 +237,15 @@ template<template< typename U, typename V, typename...Args > class Obje

RFC 7159 describes JSON objects as follows:

An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.

-

To store objects in C++, a type is defined by the template parameters ObjectType which chooses the container (e.g., std::map or std::unordered_map), StringType which chooses the type of the keys or names, and AllocatorType which chooses the allocator to use.

+

To store objects in C++, a type is defined by the template parameters described below.

+
Template Parameters
+ + + + +
ObjectTypethe container to store objects (e.g., std::map or std::unordered_map)
StringTypethe type of the keys or names (e.g., std::string). The comparison function std::less<StringType> is used to order elements inside the container.
AllocatorTypethe allocator to use for objects (e.g., std::allocator)
+
+

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<
@@ -264,7 +272,7 @@ template<template< typename U, typename V, typename...Args > class Obje
See also
array_t – type for an array value
Since
version 1.0
-

Definition at line 328 of file json.hpp.

+

Definition at line 340 of file json.hpp.

@@ -274,7 +282,7 @@ 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 6e9fff444..6d90bfd30 100644 --- a/classnlohmann_1_1basic__json_a652414dd930cb3af3b6f454cc535a23e.html +++ b/classnlohmann_1_1basic__json_a652414dd930cb3af3b6f454cc535a23e.html @@ -295,18 +295,19 @@ template<template< typename U, typename V, typename...Args > class Obje
31  std::cout << "out of range" << '\n';
32  }
33 }
-
a class to store JSON values
Definition: json.hpp:181
-
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:2539
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2582
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
"il brutto"
 {"the bad":"il cattivo","the good":"il buono","the ugly":"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.cpp -o at__object_t_key_type 
See also
operator[](const typename object_t::key_type&) for unchecked access by reference
-value() for access by value with a default value
+value() for access by value with a default value +
Since
version 1.0
-

Definition at line 2607 of file json.hpp.

+

Definition at line 2644 of file json.hpp.

@@ -316,7 +317,7 @@ out of range diff --git a/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html b/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html index f574691f7..6acaff789 100644 --- a/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html +++ b/classnlohmann_1_1basic__json_a656939a3dc9a6047e4afacd9e11b83a6.html @@ -277,17 +277,18 @@ template<typename PointerType , typename std::enable_if<
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:181
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
PointerType get_ptr() noexcept
get a pointer value (implicit)
Definition: json.hpp:2455
-
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:511
-
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:576
+
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:2896
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
PointerType get_ptr() noexcept
get a pointer value (implicit)
Definition: json.hpp:2494
+
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
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 
+ 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
-

Definition at line 2455 of file json.hpp.

+

Definition at line 2494 of file json.hpp.

@@ -297,7 +298,7 @@ true diff --git a/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html b/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html index 32ab97fd1..feb444f98 100644 --- a/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html +++ b/classnlohmann_1_1basic__json_a6944904b3b59769b1cf62ac2532cbe33.html @@ -261,7 +261,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
-

Definition at line 511 of file json.hpp.

+

Definition at line 527 of file json.hpp.

@@ -271,7 +271,7 @@ 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 695899a7c..9db6ceafc 100644 --- a/classnlohmann_1_1basic__json_a696ced74d8edc0b63a000a72907ab109.html +++ b/classnlohmann_1_1basic__json_a696ced74d8edc0b63a000a72907ab109.html @@ -246,7 +246,7 @@ 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, false otherwise.
+
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 
@@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
bool is_number() const noexcept
return whether value is a number
Definition: json.hpp:1953
+
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:1997
Output (play with this example online):
false
 false
 true
@@ -283,9 +283,13 @@ true
 false
 false
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_number.cpp -o is_number 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_number.cpp -o is_number 
+
See also
is_number_integer() – check if value is an integer number
+
+is_number_float() – check if value is a floating-point number
+
Since
version 1.0
-

Definition at line 1953 of file json.hpp.

+

Definition at line 1997 of file json.hpp.

@@ -295,7 +299,7 @@ false diff --git a/classnlohmann_1_1basic__json_a6a67c72ba65322bfcb28d170617dcdff.html b/classnlohmann_1_1basic__json_a6a67c72ba65322bfcb28d170617dcdff.html index 1120e09a2..123e21053 100644 --- a/classnlohmann_1_1basic__json_a6a67c72ba65322bfcb28d170617dcdff.html +++ b/classnlohmann_1_1basic__json_a6a67c72ba65322bfcb28d170617dcdff.html @@ -284,16 +284,17 @@ template<template< typename U, typename V, typename...Args > class Obje
22  std::cout << array << '\n';
23  std::cout << null << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3770
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3858
Output (play with this example online):
[1,2,3,4,5]
 null
 [1,2,3,4,5,6,7]
 ["first","second"]
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
+ 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
-

Definition at line 3795 of file json.hpp.

+

Definition at line 3883 of file json.hpp.

@@ -303,7 +304,7 @@ null diff --git a/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html b/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html index 0f84f1335..fadb74e61 100644 --- a/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html +++ b/classnlohmann_1_1basic__json_a6a7f45095675ac6fd1d018a0e41874be.html @@ -307,18 +307,18 @@ template<class InputIT , typename std::enable_if<
19  std::cout << j_number_range << '\n';
20  std::cout << j_object_range << '\n';
21 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3234
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3292
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-

Definition at line 1551 of file json.hpp.

+

Definition at line 1574 of file json.hpp.

@@ -328,7 +328,7 @@ template<class InputIT , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html b/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html index cb9c538cc..6a1075181 100644 --- a/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html +++ b/classnlohmann_1_1basic__json_a6bbd3e72a870f1ba81ff6886b063b0fe.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 221 of file json.hpp.

+

Definition at line 227 of file json.hpp.

@@ -245,7 +245,7 @@ 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 454bc3258..b9f559b14 100644 --- a/classnlohmann_1_1basic__json_a6dff6a02a2be250b8f8dc2f47be65544.html +++ b/classnlohmann_1_1basic__json_a6dff6a02a2be250b8f8dc2f47be65544.html @@ -276,13 +276,19 @@ template<template< typename U, typename V, typename...Args > class Obje
13  // print values
14  std::cout << j_array << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3009
+
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:3046
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 
+ 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
+
Since
version 1.0
-

Definition at line 3201 of file json.hpp.

+

Definition at line 3257 of file json.hpp.

@@ -292,7 +298,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html b/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html index 2e458d22e..a6d4a2ebc 100644 --- a/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html +++ b/classnlohmann_1_1basic__json_a6e2e21da48f5d9471716cd868a068327.html @@ -289,15 +289,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
 "foo" == "bar" true
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator__notequal.cpp -o operator__notequal 
+ 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
-

Definition at line 4328 of file json.hpp.

+

Definition at line 4444 of file json.hpp.

@@ -307,7 +308,7 @@ 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 bd8117b8b..9b0ca570d 100644 --- a/classnlohmann_1_1basic__json_a71eba33d906745e66f340952b79fbce3.html +++ b/classnlohmann_1_1basic__json_a71eba33d906745e66f340952b79fbce3.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 235 of file json.hpp.

+

Definition at line 241 of file json.hpp.

@@ -245,7 +245,7 @@ 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 486c5eda5..15fb327ad 100644 --- a/classnlohmann_1_1basic__json_a72442ccbb378b4464a24a2da1e784041.html +++ b/classnlohmann_1_1basic__json_a72442ccbb378b4464a24a2da1e784041.html @@ -256,7 +256,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

overload for a default value of type const char* 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.

+

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) {
@@ -315,16 +315,17 @@ Unlike 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:181
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2896
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-operator[](const typename object_t::key_type&) for unchecked access by reference
+operator[](const typename object_t::key_type&) for unchecked access by reference +
Since
version 1.0
-

Definition at line 2898 of file json.hpp.

+

Definition at line 2922 of file json.hpp.

@@ -334,7 +335,7 @@ Unlike diff --git a/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html b/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html index 0490a6933..1e2d3cb86 100644 --- a/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html +++ b/classnlohmann_1_1basic__json_a72ba20783ecb3eec98bd6a3b870d565c.html @@ -275,14 +275,15 @@ Illustration from cppreference.com
16  // serialize the element that the iterator points to
17  std::cout << *it << '\n';
18 }
-
a class to store JSON values
Definition: json.hpp:181
-
const_iterator cend() const
returns a const iterator to one past the last element
Definition: json.hpp:3397
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
a const random access iterator for the basic_json class
Definition: json.hpp:5111
+
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:3465
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
a const random access iterator for the basic_json class
Definition: json.hpp:5232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/cend.cpp -o cend 
+
Since
version 1.0
-

Definition at line 3397 of file json.hpp.

+

Definition at line 3465 of file json.hpp.

@@ -292,7 +293,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a749e58042d8069f4f048ee4d23c43f63.html b/classnlohmann_1_1basic__json_a749e58042d8069f4f048ee4d23c43f63.html index 4ae36e5b4..dded9968e 100644 --- a/classnlohmann_1_1basic__json_a749e58042d8069f4f048ee4d23c43f63.html +++ b/classnlohmann_1_1basic__json_a749e58042d8069f4f048ee4d23c43f63.html @@ -284,16 +284,17 @@ template<template< typename U, typename V, typename...Args > class Obje
22  std::cout << array << '\n';
23  std::cout << null << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3770
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3858
Output (play with this example online):
[1,2,3,4,5]
 null
 [1,2,3,4,5,6,7]
 ["first","second"]
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/push_back.cpp -o push_back 
+ 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
-

Definition at line 3805 of file json.hpp.

+

Definition at line 3893 of file json.hpp.

@@ -303,7 +304,7 @@ null diff --git a/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html b/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html index 2918633e0..1c24c4a70 100644 --- a/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html +++ b/classnlohmann_1_1basic__json_a74a943800c7f103d0990d7eef82c6453.html @@ -289,15 +289,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
 "foo" >= "bar" true
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator__greaterequal.cpp -o operator__greaterequal 
+ 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
-

Definition at line 4484 of file json.hpp.

+

Definition at line 4610 of file json.hpp.

@@ -307,7 +308,7 @@ 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 709356141..d15d78f9d 100644 --- a/classnlohmann_1_1basic__json_a74ccfa471a0c061876b247f820f3c741.html +++ b/classnlohmann_1_1basic__json_a74ccfa471a0c061876b247f820f3c741.html @@ -321,14 +321,14 @@ template<template< typename U, typename V, typename...Args > class Obje
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:7425
-
a class to store JSON values
Definition: json.hpp:181
-
std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
per-element parser callback type
Definition: json.hpp:803
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void clear() noexcept
clears the contents
Definition: json.hpp:3706
+
basic_json<> json
default JSON class
Definition: json.hpp:7532
+
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:3792
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:4574
-
parse_event_t
JSON callback events.
Definition: json.hpp:738
+
static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
deserialize from string
Definition: json.hpp:4704
+
parse_event_t
JSON callback events.
Definition: json.hpp:754
Output (play with this example online):
{
     "Image": {
         "Animated": false,
@@ -364,9 +364,10 @@ 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/parse__istream__parser_callback_t.cpp -o parse__istream__parser_callback_t 
-
See also
parse(const string_t&, parser_callback_t) for a version that reads from a string
+
See also
parse(const string_t&, parser_callback_t) for a version that reads from a string
+
Since
version 1.0
-

Definition at line 4601 of file json.hpp.

+

Definition at line 4733 of file json.hpp.

@@ -376,7 +377,7 @@ 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 0cd8abac2..f930f965e 100644 --- a/classnlohmann_1_1basic__json_a75a1754e0d39f33095d3102a8bdb9881.html +++ b/classnlohmann_1_1basic__json_a75a1754e0d39f33095d3102a8bdb9881.html @@ -308,20 +308,26 @@ template<class InteratorType , typename std::enable_if<
28  std::cout << j_array << '\n';
29  std::cout << j_string << '\n';
30 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3234
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3009
+
a class to store JSON values
Definition: json.hpp:187
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3292
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3046
Output (play with this example online):
null
 null
 null
 {"one":1}
 [1,2,8,16]
 null
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/erase__IteratorType.cpp -o erase__IteratorType 
+ 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 size_type) – removes the element from an array at the given index
+
Since
version 1.0
-

Definition at line 3009 of file json.hpp.

+

Definition at line 3046 of file json.hpp.

@@ -331,7 +337,7 @@ null diff --git a/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html b/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html index 6c5b8c7dc..bf056f406 100644 --- a/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html +++ b/classnlohmann_1_1basic__json_a76cfc5062bf6223396ab82c753cd4634.html @@ -248,7 +248,7 @@ template<typename PointerType , typename std::enable_if<

get a pointer value (explicit) Explicit 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.
+
Warning
The pointer becomes invalid if the underlying JSON object changes.
Template Parameters
@@ -277,18 +277,19 @@ template<typename PointerType , typename std::enable_if<
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:181
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
ValueType get() const
get a value (explicit)
Definition: json.hpp:2374
-
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:511
-
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:576
+
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:2896
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
ValueType get() const
get a value (explicit)
Definition: json.hpp:2410
+
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
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
+
See also
get_ptr() for explicit pointer-member access
+
Since
version 1.0
-

Definition at line 2422 of file json.hpp.

+

Definition at line 2459 of file json.hpp.

@@ -298,7 +299,7 @@ true diff --git a/classnlohmann_1_1basic__json_a793e5c1da2fc7de7a04b19eadbb3f2cb.html b/classnlohmann_1_1basic__json_a793e5c1da2fc7de7a04b19eadbb3f2cb.html index 78cf953b5..5d33b561e 100644 --- a/classnlohmann_1_1basic__json_a793e5c1da2fc7de7a04b19eadbb3f2cb.html +++ b/classnlohmann_1_1basic__json_a793e5c1da2fc7de7a04b19eadbb3f2cb.html @@ -300,9 +300,9 @@ template<template< typename U, typename V, typename...Args > class Obje
22  std::cout << j_array << '\n';
23  std::cout << j_string << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
@@ -325,10 +325,14 @@ false
basic_json(const object_t&) – create a object value
-basic_json(const array_t&) – create a array value
+basic_json(const array_t&) – create a array value +
+basic_json(const number_float_t) – create a number (floating-point) value
+
+basic_json(const number_integer_t) – create a number (integer) value
Since
version 1.0
-

Definition at line 843 of file json.hpp.

+

Definition at line 866 of file json.hpp.

@@ -338,7 +342,7 @@ false diff --git a/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html b/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html index 3c19f6256..d710f6869 100644 --- a/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html +++ b/classnlohmann_1_1basic__json_a7c08f966200af98db0313a3b517ce0a9.html @@ -274,14 +274,15 @@ Illustration from cppreference.com
16  // serialize the element that the iterator points to
17  std::cout << *it << '\n';
18 }
-
a class to store JSON values
Definition: json.hpp:181
-
reverse_iterator rend()
returns an iterator to the reverse-end
Definition: json.hpp:3448
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
a template for a reverse iterator class
Definition: json.hpp:226
+
a class to store JSON values
Definition: json.hpp:187
+
reverse_iterator rend()
returns an iterator to the reverse-end
Definition: json.hpp:3520
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
a template for a reverse iterator class
Definition: json.hpp:232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/rend.cpp -o rend 
+
Since
version 1.0
-

Definition at line 3448 of file json.hpp.

+

Definition at line 3520 of file json.hpp.

@@ -291,7 +292,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html b/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html index 2dace4b8b..a94757965 100644 --- a/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html +++ b/classnlohmann_1_1basic__json_a7c19a5c3be6cc755377ee41eade78baf.html @@ -274,16 +274,17 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3234
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3292
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ 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
-

Definition at line 3250 of file json.hpp.

+

Definition at line 3308 of file json.hpp.

@@ -293,7 +294,7 @@ value at key "two": 2 diff --git a/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html b/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html index 87649bef9..4158a5c94 100644 --- a/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html +++ b/classnlohmann_1_1basic__json_a7d0db3b728d820d4984df78d97d2b104.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
PointerTypepointer type; must be a pointer to array_t, object_t, string_t, boolean_t, number_integer_t, or number_float_t.
-

Definition at line 203 of file json.hpp.

+

Definition at line 209 of file json.hpp.

@@ -245,7 +245,7 @@ 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 c0e02137d..5bb1f481b 100644 --- a/classnlohmann_1_1basic__json_a7d1b990f2c12fecb57db1504fdadd0bb.html +++ b/classnlohmann_1_1basic__json_a7d1b990f2c12fecb57db1504fdadd0bb.html @@ -278,14 +278,20 @@ template<template< typename U, typename V, typename...Args > class Obje
15  std::cout << j_object << '\n';
16  std::cout << count_one << " " << count_three << '\n';
17 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3009
+
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:3046
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/erase__key_type.cpp -o erase__key_type 
+
See also
erase(InteratorType) – removes the element at a given position
+
+erase(InteratorType, InteratorType) – removes the elements in the given range
+
+erase(const size_type) – removes the element from an array at the given index
+
Since
version 1.0
-

Definition at line 3174 of file json.hpp.

+

Definition at line 3227 of file json.hpp.

@@ -295,7 +301,7 @@ 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 e25302232..1483b08b8 100644 --- a/classnlohmann_1_1basic__json_a7dab69b10b98e7bc694339720e37fb2b.html +++ b/classnlohmann_1_1basic__json_a7dab69b10b98e7bc694339720e37fb2b.html @@ -274,16 +274,17 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3234
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3292
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ 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
-

Definition at line 3234 of file json.hpp.

+

Definition at line 3292 of file json.hpp.

@@ -293,7 +294,7 @@ value at key "two": 2 diff --git a/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html b/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html index d9784e4e9..534c22899 100644 --- a/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html +++ b/classnlohmann_1_1basic__json_a7f97a91ad8f1d5cf0b9213bd24f247c4.html @@ -287,15 +287,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78

Output (play with this example online):

[1,2,3] != nullptr true
 {"A":"a","B":"b"} != nullptr true
 17 != nullptr true
 "foo" != nullptr true
 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 
-

Definition at line 4358 of file json.hpp.

+

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
+ +

Definition at line 4476 of file json.hpp.

@@ -305,7 +306,7 @@ null != nullptr false diff --git a/classnlohmann_1_1basic__json_a80a89ddbe4cb7ef15b049febee208cc8.html b/classnlohmann_1_1basic__json_a80a89ddbe4cb7ef15b049febee208cc8.html index 24c63f7dc..8db3b3af4 100644 --- a/classnlohmann_1_1basic__json_a80a89ddbe4cb7ef15b049febee208cc8.html +++ b/classnlohmann_1_1basic__json_a80a89ddbe4cb7ef15b049febee208cc8.html @@ -279,9 +279,9 @@ In case the parameter value is not a number, a JSON null value is creat
19  std::cout << j_nan << '\n';
20  std::cout << j_infinity << '\n';
21 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:576
+
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
Output (play with this example online):
3.14159265358979
 null
 null
@@ -289,7 +289,7 @@ null
 
See also
basic_json(const CompatibleNumberFloatType) – create a number value (floating-point) from a compatible number type
Since
version 1.0
-

Definition at line 1235 of file json.hpp.

+

Definition at line 1258 of file json.hpp.

@@ -299,7 +299,7 @@ null diff --git a/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html b/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html index 0cb570d5e..1a7ecf46f 100644 --- a/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html +++ b/classnlohmann_1_1basic__json_a80ceaa3bdd346292273b309e08525c1c.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 215 of file json.hpp.

+

Definition at line 221 of file json.hpp.

@@ -245,7 +245,7 @@ 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 523686f01..7e103b5d7 100644 --- a/classnlohmann_1_1basic__json_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html +++ b/classnlohmann_1_1basic__json_a83cbbfbf5d3ecbad6de8ece0be6b36c4.html @@ -283,10 +283,10 @@ template<template< typename U, typename V, typename...Args > class Obje
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:2921
-
a class to store JSON values
Definition: json.hpp:181
+
reference front()
access the first element
Definition: json.hpp:2947
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
Output (play with this example online):
true
 17
@@ -294,9 +294,10 @@ template<template< typename U, typename V, typename...Args > class Obje
 1
 1
 "Hello, world"
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/front.cpp -o front 
+
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/front.cpp -o front 
+
Since
version 1.0
-

Definition at line 2921 of file json.hpp.

+

Definition at line 2947 of file json.hpp.

@@ -306,7 +307,7 @@ 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 a955683cf..24103010a 100644 --- a/classnlohmann_1_1basic__json_a87db51b6b936fb2ea293cdbc8702dcb8.html +++ b/classnlohmann_1_1basic__json_a87db51b6b936fb2ea293cdbc8702dcb8.html @@ -289,15 +289,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
 "foo" <= "bar" false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator__lessequal.cpp -o operator__lessequal 
+ 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
-

Definition at line 4464 of file json.hpp.

+

Definition at line 4588 of file json.hpp.

@@ -307,7 +308,7 @@ 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 6dad11fae..dc73aa1ea 100644 --- a/classnlohmann_1_1basic__json_a8b526709d395142b68d21abfbfff17c3.html +++ b/classnlohmann_1_1basic__json_a8b526709d395142b68d21abfbfff17c3.html @@ -283,10 +283,10 @@ template<template< typename U, typename V, typename...Args > class Obje
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:2921
-
a class to store JSON values
Definition: json.hpp:181
+
reference front()
access the first element
Definition: json.hpp:2947
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
Output (play with this example online):
true
 17
@@ -294,9 +294,10 @@ template<template< typename U, typename V, typename...Args > class Obje
 1
 1
 "Hello, world"
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/front.cpp -o front 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/front.cpp -o front 
+
Since
version 1.0
-

Definition at line 2929 of file json.hpp.

+

Definition at line 2955 of file json.hpp.

@@ -306,7 +307,7 @@ 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 8df59a6f8..a1fc536e1 100644 --- a/classnlohmann_1_1basic__json_a8c40cd9ead4de7c82f28268bdf0ec98a.html +++ b/classnlohmann_1_1basic__json_a8c40cd9ead4de7c82f28268bdf0ec98a.html @@ -297,9 +297,9 @@ template<template< typename U, typename V, typename...Args > class Obje
31  std::cout << j_array << '\n';
32  std::cout << j_string << '\n';
33 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void clear() noexcept
clears the contents
Definition: json.hpp:3706
+
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:3792
Output (play with this example online):
null
 false
 0
@@ -307,9 +307,10 @@ false
 {}
 []
 ""
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/clear.cpp -o clear 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/clear.cpp -o clear 
+
Since
version 1.0
-

Definition at line 3706 of file json.hpp.

+

Definition at line 3792 of file json.hpp.

@@ -319,7 +320,7 @@ false diff --git a/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html b/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html index 0ba94ccfd..62c65f0d2 100644 --- a/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html +++ b/classnlohmann_1_1basic__json_a8fa74698f4061e18ec664009f3af1ddf.html @@ -301,16 +301,17 @@ template<template< typename U, typename V, typename...Args > class Obje
17  std::cout << *new_pos << '\n';
18  std::cout << v << '\n';
19 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3899
+
a class to store JSON values
Definition: json.hpp:187
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3991
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 
+ 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
-

Definition at line 3996 of file json.hpp.

+

Definition at line 4092 of file json.hpp.

@@ -320,7 +321,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html b/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html index eb8345570..793ad2f6f 100644 --- a/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html +++ b/classnlohmann_1_1basic__json_a930e14150ffa067bcf56d35cb00271e1.html @@ -246,7 +246,7 @@ 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.

+

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 
@@ -260,14 +260,14 @@ template<template< typename U, typename V, typename...Args > class Obje
10  // serialize the JSON null value
11  std::cout << j << '\n';
12 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-

Definition at line 887 of file json.hpp.

+

Definition at line 910 of file json.hpp.

@@ -277,7 +277,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_a951a76ba057b3be948e7ba5c2c01cd5a.html b/classnlohmann_1_1basic__json_a951a76ba057b3be948e7ba5c2c01cd5a.html index 23532beac..d9e3dfecb 100644 --- a/classnlohmann_1_1basic__json_a951a76ba057b3be948e7ba5c2c01cd5a.html +++ b/classnlohmann_1_1basic__json_a951a76ba057b3be948e7ba5c2c01cd5a.html @@ -309,8 +309,8 @@ template<class CompatibleObjectType , typename std::enable_if<
39  std::cout << j_mmap << '\n';
40  std::cout << j_ummap << '\n';
41 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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}
@@ -319,7 +319,7 @@ template<class CompatibleObjectType , typename std::enable_if<
 
See also
basic_json(const object_t&) – create an object value
Since
version 1.0
-

Definition at line 942 of file json.hpp.

+

Definition at line 965 of file json.hpp.

@@ -329,7 +329,7 @@ template<class CompatibleObjectType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html b/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html index aea69e14f..51a92883a 100644 --- a/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html +++ b/classnlohmann_1_1basic__json_a9730b9f7bc2150e641fe20198d4477c7.html @@ -287,15 +287,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78

Output (play with this example online):

[1,2,3] == nullptr false
 {"A":"a","B":"b"} == nullptr false
 17 == nullptr false
 "foo" == nullptr false
 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 
-

Definition at line 4300 of file json.hpp.

+

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
+ +

Definition at line 4414 of file json.hpp.

@@ -305,7 +306,7 @@ null == nullptr true diff --git a/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html b/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html index a5ed060a6..6368c4ef5 100644 --- a/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html +++ b/classnlohmann_1_1basic__json_a98e05a2c9b8f74bd60442772cddeee52.html @@ -287,15 +287,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78

Output (play with this example online):

[1,2,3] == nullptr false
 {"A":"a","B":"b"} == nullptr false
 17 == nullptr false
 "foo" == nullptr false
 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 
-

Definition at line 4309 of file json.hpp.

+

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
+ +

Definition at line 4423 of file json.hpp.

@@ -305,7 +306,7 @@ null == nullptr true diff --git a/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html b/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html index 3fb2b7e57..f360bcccf 100644 --- a/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html +++ b/classnlohmann_1_1basic__json_a9993148cb0473365e52998c7315f9ada.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
bool is_number_integer() const noexcept
return whether value is an integer number
Definition: json.hpp:1971
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2020
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
false
 false
 true
@@ -283,9 +283,13 @@ false
 false
 false
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_number_integer.cpp -o is_number_integer 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_number_integer.cpp -o is_number_integer 
+
See also
is_number() – check if value is a number
+
+is_number_float() – check if value is a floating-point number
+
Since
version 1.0
-

Definition at line 1971 of file json.hpp.

+

Definition at line 2020 of file json.hpp.

@@ -295,7 +299,7 @@ false diff --git a/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html b/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html index 3d35fdc17..1026e6c79 100644 --- a/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html +++ b/classnlohmann_1_1basic__json_a9c26c5d0f4a519c7236149b9aeb3ef9e.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
bool is_number_float() const noexcept
return whether value is a floating-point number
Definition: json.hpp:1989
+
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:2043
Output (play with this example online):
false
 false
 false
@@ -283,9 +283,13 @@ true
 false
 false
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_number_float.cpp -o is_number_float 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_number_float.cpp -o is_number_float 
+
See also
is_number() – check if value is number
+
+is_number_integer() – check if value is an integer number
+
Since
version 1.0
-

Definition at line 1989 of file json.hpp.

+

Definition at line 2043 of file json.hpp.

@@ -295,7 +299,7 @@ false diff --git a/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html b/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html index 851d67584..34aae04d5 100644 --- a/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html +++ b/classnlohmann_1_1basic__json_a9f17a0690155e3a5603246ccec81499e.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
bool is_primitive() const noexcept
return whether type is primitive
Definition: json.hpp:1883
+
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:1915
Output (play with this example online):
true
 true
 true
@@ -283,9 +283,10 @@ true
 false
 false
 true
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_primitive.cpp -o is_primitive 
+ 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
-

Definition at line 1883 of file json.hpp.

+

Definition at line 1915 of file json.hpp.

@@ -295,7 +296,7 @@ true diff --git a/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html b/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html index eb84ec2a4..1b88751e5 100644 --- a/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html +++ b/classnlohmann_1_1basic__json_aa0422e861b4cbd7cdcaad7a11a1304a9.html @@ -256,8 +256,118 @@ template<template< typename U, typename V, typename...Args > class Obje
+
Parameters
+ + + +
[in,out]istream to read a serialized JSON value from
[in]cba parser callback function of type parser_callback_t which is used to control the deserialization by filtering unwanted values (optional)
+
+
+
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:7532
+
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:3792
+
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:4704
+
parse_event_t
JSON callback events.
Definition: json.hpp:754
+
Output (play with this example online):
{
+    "Image": {
+        "Animated": false,
+        "Height": 600,
+        "IDs": [
+            116,
+            943,
+            234,
+            38793
+        ],
+        "Thumbnail": {
+            "Height": 125,
+            "Url": "http://www.example.com/image/481989943",
+            "Width": 100
+        },
+        "Title": "View from 15th Floor",
+        "Width": 800
+    }
+}
 
-

Definition at line 4606 of file json.hpp.

+{ + "Image": { + "Animated": false, + "Height": 600, + "IDs": [ + 116, + 943, + 234, + 38793 + ], + "Title": "View from 15th Floor", + "Width": 800 + } +} +
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/parse__istream__parser_callback_t.cpp -o parse__istream__parser_callback_t 
+
See also
parse(const string_t&, parser_callback_t) for a version that reads from a string
+
Since
version 1.0
+ +

Definition at line 4741 of file json.hpp.

@@ -267,7 +377,7 @@ 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 ed6c765b0..1c28a84ec 100644 --- a/classnlohmann_1_1basic__json_aa1f3b3f1dca79392d6727b81f9668c6c.html +++ b/classnlohmann_1_1basic__json_aa1f3b3f1dca79392d6727b81f9668c6c.html @@ -283,20 +283,21 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
-
reference back()
access the last element
Definition: json.hpp:2953
+
reference back()
access the last element
Definition: json.hpp:2981
Output (play with this example online):
true
 17
 23.42
 2
 16
 "Hello, world"
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/back.cpp -o back 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/back.cpp -o back 
+
Since
version 1.0
-

Definition at line 2953 of file json.hpp.

+

Definition at line 2981 of file json.hpp.

@@ -306,7 +307,7 @@ 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 880688be9..d0fbcd6e0 100644 --- a/classnlohmann_1_1basic__json_aa5413178b8041f7ac685dec4b040dd2c.html +++ b/classnlohmann_1_1basic__json_aa5413178b8041f7ac685dec4b040dd2c.html @@ -275,14 +275,15 @@ Illustration from cppreference.com
16  // serialize the element that the iterator points to
17  std::cout << *it << '\n';
18 }
-
a class to store JSON values
Definition: json.hpp:181
-
const_iterator cend() const
returns a const iterator to one past the last element
Definition: json.hpp:3397
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
a const random access iterator for the basic_json class
Definition: json.hpp:5111
+
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:3465
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
a const random access iterator for the basic_json class
Definition: json.hpp:5232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/cend.cpp -o cend 
+
Since
version 1.0
-

Definition at line 3375 of file json.hpp.

+

Definition at line 3441 of file json.hpp.

@@ -292,7 +293,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html b/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html index f21168782..0a6f4f91a 100644 --- a/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html +++ b/classnlohmann_1_1basic__json_aa6a24b176f9599a21d662cc5f8e1ca76.html @@ -254,7 +254,7 @@ template<template< typename U, typename V, typename...Args > class Obje
Since
version 1.0
-

Definition at line 1769 of file json.hpp.

+

Definition at line 1794 of file json.hpp.

@@ -264,7 +264,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html b/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html index e4df0264e..a1cf9a039 100644 --- a/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html +++ b/classnlohmann_1_1basic__json_aa71e977d31f470689883ac60d16ea4ac.html @@ -279,16 +279,17 @@ template<template< typename U, typename V, typename...Args > class Obje
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:371
-
a class to store JSON values
Definition: json.hpp:181
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
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:4081
+
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:2896
+
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:4183
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 
+ 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
-

Definition at line 4109 of file json.hpp.

+

Definition at line 4213 of file json.hpp.

@@ -298,7 +299,7 @@ array = [1,2,3,4] diff --git a/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html b/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html index daaf4d0e1..3b675f871 100644 --- a/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html +++ b/classnlohmann_1_1basic__json_aabe4661644ea549089f0886c2551d2ac.html @@ -269,7 +269,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
-

Definition at line 803 of file json.hpp.

+

Definition at line 819 of file json.hpp.

@@ -279,7 +279,7 @@ 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 f873480d1..8f4ae9202 100644 --- a/classnlohmann_1_1basic__json_aac185a137428a7337aa620de07bfbbd7.html +++ b/classnlohmann_1_1basic__json_aac185a137428a7337aa620de07bfbbd7.html @@ -258,10 +258,11 @@ template<template< typename U, typename V, typename...Args > class Obje

Returns an ordering that is similar to Python:

  • order: null < boolean < number < object < array < string
  • -
  • furthermore, each type is not smaller than itself
  • +
  • furthermore, each type is not smaller than itself
+
Since
version 1.0
-

Definition at line 4200 of file json.hpp.

+

Definition at line 4310 of file json.hpp.

@@ -271,7 +272,7 @@ 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 741286029..2ec57fc59 100644 --- a/classnlohmann_1_1basic__json_aacd442b66140c764c594ac8ad7dfd5b3.html +++ b/classnlohmann_1_1basic__json_aacd442b66140c764c594ac8ad7dfd5b3.html @@ -293,15 +293,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
 "foo" == "bar" false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator__less.cpp -o operator__less 
+ 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
-

Definition at line 4385 of file json.hpp.

+

Definition at line 4505 of file json.hpp.

@@ -311,7 +312,7 @@ 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 9bb369f37..0c6f1de04 100644 --- a/classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html +++ b/classnlohmann_1_1basic__json_aacf6c869f6a9c66ac1bc99e93f310044.html @@ -257,7 +257,7 @@ template<template< typename U, typename V, typename...Args > class Obje
See also
number_integer_t – type for number values (integer)
Since
version 1.0
-

Definition at line 576 of file json.hpp.

+

Definition at line 592 of file json.hpp.

@@ -267,7 +267,7 @@ 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 142e82130..234364c61 100644 --- a/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html +++ b/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html @@ -295,8 +295,8 @@ template<template< typename U, typename V, typename...Args > class Obje
21  // serialize JSON
22  std::cout << std::setw(2) << j << '\n';
23 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
{
   "array": [
     1,
@@ -311,9 +311,10 @@ template<template< typename U, typename V, typename...Args > class Obje
   "string": "Hello, world!"
 }
 
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/operator_deserialize.cpp -o operator_deserialize 
-
See also
parse(std::istream&, parser_callback_t) for a variant with a parser callback function to filter values while parsing
+
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
-

Definition at line 4642 of file json.hpp.

+

Definition at line 4779 of file json.hpp.

@@ -323,7 +324,7 @@ 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 03c0c3728..60961fd89 100644 --- a/classnlohmann_1_1basic__json_aafa839f2a74dc1b5060314b3423143b8.html +++ b/classnlohmann_1_1basic__json_aafa839f2a74dc1b5060314b3423143b8.html @@ -243,7 +243,7 @@ template<template< typename U, typename V, typename...Args > class Obje

Boolean values are stored directly inside a basic_json type.

Since
version 1.0
-

Definition at line 443 of file json.hpp.

+

Definition at line 459 of file json.hpp.

@@ -253,7 +253,7 @@ 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 e1d9c6722..baac4c2f0 100644 --- a/classnlohmann_1_1basic__json_ab14e3503305622fb5ab01a7f490916e8.html +++ b/classnlohmann_1_1basic__json_ab14e3503305622fb5ab01a7f490916e8.html @@ -289,15 +289,16 @@ template<template< typename U, typename V, typename...Args > class Obje
14  std::cout << *new_pos << '\n';
15  std::cout << v << '\n';
16 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3899
+
a class to store JSON values
Definition: json.hpp:187
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3991
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 
+ 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
-

Definition at line 4046 of file json.hpp.

+

Definition at line 4146 of file json.hpp.

@@ -307,7 +308,7 @@ 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 945ef20ad..7f52350d4 100644 --- a/classnlohmann_1_1basic__json_ab2162bc76e10d8736cab9b2039956054.html +++ b/classnlohmann_1_1basic__json_ab2162bc76e10d8736cab9b2039956054.html @@ -274,14 +274,15 @@ Illustration from cppreference.com
16  // serialize the element that the iterator points to
17  std::cout << *it << '\n';
18 }
-
a class to store JSON values
Definition: json.hpp:181
-
a mutable random access iterator for the basic_json class
Definition: json.hpp:5613
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
a mutable random access iterator for the basic_json class
Definition: json.hpp:5714
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/end.cpp -o end 
+
Since
version 1.0
-

Definition at line 3365 of file json.hpp.

+

Definition at line 3431 of file json.hpp.

@@ -291,7 +292,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_ab67345ba5c81c903eddd4eb2a24ac658.html b/classnlohmann_1_1basic__json_ab67345ba5c81c903eddd4eb2a24ac658.html index 4513e8ed3..695358ade 100644 --- a/classnlohmann_1_1basic__json_ab67345ba5c81c903eddd4eb2a24ac658.html +++ b/classnlohmann_1_1basic__json_ab67345ba5c81c903eddd4eb2a24ac658.html @@ -289,15 +289,16 @@ template<template< typename U, typename V, typename...Args > class Obje
14  std::cout << *new_pos << '\n';
15  std::cout << v << '\n';
16 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3899
+
a class to store JSON values
Definition: json.hpp:187
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3991
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/insert.cpp -o insert 
+
Since
version 1.0
-

Definition at line 3925 of file json.hpp.

+

Definition at line 4017 of file json.hpp.

@@ -307,7 +308,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html b/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html index 8768a7be3..6468e72b4 100644 --- a/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html +++ b/classnlohmann_1_1basic__json_ab9a20bd1d391e9cb968db50c246f728d.html @@ -297,10 +297,10 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
size_type size() const noexcept
returns the number of elements
Definition: json.hpp:3594
+
a class to store JSON values
Definition: json.hpp:187
+
size_type size() const noexcept
returns the number of elements
Definition: json.hpp:3675
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
Output (play with this example online):
0
 1
@@ -311,9 +311,10 @@ template<template< typename U, typename V, typename...Args > class Obje
 5
 0
 1
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/size.cpp -o size 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/size.cpp -o size 
+
Since
version 1.0
-

Definition at line 3594 of file json.hpp.

+

Definition at line 3675 of file json.hpp.

@@ -323,7 +324,7 @@ 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 596e61226..dff010ba9 100644 --- a/classnlohmann_1_1basic__json_ab9da2afc6f77295f25252725fde142a6.html +++ b/classnlohmann_1_1basic__json_ab9da2afc6f77295f25252725fde142a6.html @@ -283,20 +283,21 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
+
a class to store JSON values
Definition: json.hpp:187
object (unordered set of name/value pairs)
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
namespace for Niels Lohmann
Definition: json.hpp:78
array (ordered collection of values)
-
reference back()
access the last element
Definition: json.hpp:2953
+
reference back()
access the last element
Definition: json.hpp:2981
Output (play with this example online):
true
 17
 23.42
 2
 16
 "Hello, world"
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/back.cpp -o back 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/back.cpp -o back 
+
Since
version 1.0
-

Definition at line 2963 of file json.hpp.

+

Definition at line 2991 of file json.hpp.

@@ -306,7 +307,7 @@ 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 70f2943c3..24306dcd0 100644 --- a/classnlohmann_1_1basic__json_abe8f3224ca4041908ddb466cb9caecf1.html +++ b/classnlohmann_1_1basic__json_abe8f3224ca4041908ddb466cb9caecf1.html @@ -293,9 +293,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
size_type max_size() const noexcept
returns the maximum possible number of elements
Definition: json.hpp:3651
+
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:3735
Output (play with this example online):
0
 1
 1
@@ -303,9 +303,10 @@ template<template< typename U, typename V, typename...Args > class Obje
 256204778801521550
 1152921504606846975
 1
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/max_size.cpp -o max_size 
+ 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
-

Definition at line 3651 of file json.hpp.

+

Definition at line 3735 of file json.hpp.

@@ -315,7 +316,7 @@ 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 a90a379cb..8175712ba 100644 --- a/classnlohmann_1_1basic__json_ac4011bd0781e51afe4994d2b09fd27e9.html +++ b/classnlohmann_1_1basic__json_ac4011bd0781e51afe4994d2b09fd27e9.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 209 of file json.hpp.

+

Definition at line 215 of file json.hpp.

@@ -245,7 +245,7 @@ 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 ca2301634..a8c72e067 100644 --- a/classnlohmann_1_1basic__json_ac8163abe518595f19dbee68db1caaaf7.html +++ b/classnlohmann_1_1basic__json_ac8163abe518595f19dbee68db1caaaf7.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
bool is_object() const noexcept
return whether value is an object
Definition: json.hpp:2006
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
bool is_object() const noexcept
return whether value is an object
Definition: json.hpp:2062
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
false
 false
 false
@@ -283,9 +283,10 @@ false
 true
 false
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_object.cpp -o is_object 
+ 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
-

Definition at line 2006 of file json.hpp.

+

Definition at line 2062 of file json.hpp.

@@ -295,7 +296,7 @@ false diff --git a/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html b/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html index 630f9004b..24b9a7095 100644 --- a/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html +++ b/classnlohmann_1_1basic__json_ac82abedf356d252e0589850c3d8b35ba.html @@ -237,7 +237,14 @@ template<template< typename U, typename V, typename...Args > class Obje

RFC 7159 describes JSON arrays as follows:

An array is an ordered sequence of zero or more values.

-

To store objects in C++, a type is defined by the template parameters ArrayType which chooses the container (e.g., std::vector or std::list) and AllocatorType which chooses the allocator to use.

+

To store objects in C++, a type is defined by the template parameters explained below.

+
Template Parameters
+ + + +
ArrayTypecontainer type to store arrays (e.g., std::vector or std::list)
AllocatorTypeallocator to use for arrays (e.g., std::allocator)
+
+

Default type

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

std::vector<
@@ -254,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
-

Definition at line 371 of file json.hpp.

+

Definition at line 386 of file json.hpp.

@@ -264,7 +271,7 @@ 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 b09fbe868..fb7018d9f 100644 --- a/classnlohmann_1_1basic__json_ac943391891fcde0a71a15ce990e0f7f4.html +++ b/classnlohmann_1_1basic__json_ac943391891fcde0a71a15ce990e0f7f4.html @@ -281,14 +281,14 @@ template<template< typename U, typename V, typename...Args > class Obje
14  std::cout << j1 << " = " << j2 << '\n';
15  std::cout << std::boolalpha << (j1 == j2) << '\n';
16 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-

Definition at line 1649 of file json.hpp.

+

Definition at line 1672 of file json.hpp.

@@ -298,7 +298,7 @@ true diff --git a/classnlohmann_1_1basic__json_acbf7f957ecb6ce19cdc5b40b5d6b6333.html b/classnlohmann_1_1basic__json_acbf7f957ecb6ce19cdc5b40b5d6b6333.html index d578d256b..69f0136bd 100644 --- a/classnlohmann_1_1basic__json_acbf7f957ecb6ce19cdc5b40b5d6b6333.html +++ b/classnlohmann_1_1basic__json_acbf7f957ecb6ce19cdc5b40b5d6b6333.html @@ -270,8 +270,8 @@ template<template< typename U, typename V, typename...Args > class Obje
13  // serialize the JSON numbers
14  std::cout << j << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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)
@@ -279,7 +279,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
-

Definition at line 1171 of file json.hpp.

+

Definition at line 1194 of file json.hpp.

@@ -289,7 +289,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html b/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html index 546f11fb0..12f6243b4 100644 --- a/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html +++ b/classnlohmann_1_1basic__json_acdf4445333649ec94198f09a62144884.html @@ -271,14 +271,15 @@ Illustration from cppreference.com
13  // serialize the element that the iterator points to
14  std::cout << *it << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
a mutable random access iterator for the basic_json class
Definition: json.hpp:5613
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
a mutable random access iterator for the basic_json class
Definition: json.hpp:5714
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/begin.cpp -o begin 
+
Since
version 1.0
-

Definition at line 3310 of file json.hpp.

+

Definition at line 3372 of file json.hpp.

@@ -288,7 +289,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html b/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html index 3f30ffbfc..bd78a5aa7 100644 --- a/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html +++ b/classnlohmann_1_1basic__json_ace8338e57fdb11e1955c2a0c2d782069.html @@ -237,8 +237,13 @@ template<template< typename U, typename V, typename...Args > class Obje

RFC 7159 describes JSON strings as follows:

A string is a sequence of zero or more Unicode characters.

-

To store objects in C++, a type is defined by the template parameters StringType which chooses the container (e.g., std::string) to use.

-

Unicode values are split by the JSON class into byte-sized characters during deserialization.

+

To store objects in C++, a type is defined by the template parameter described below. Unicode values are split by the JSON class into byte-sized characters during deserialization.

+
Template Parameters
+ + +
StringTypethe container to store strings (e.g., std::string). Note this container is used for keys/names in objects, see object_t.
+
+

Default type

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

std::string
@@ -251,7 +256,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
-

Definition at line 417 of file json.hpp.

+

Definition at line 433 of file json.hpp.

@@ -261,7 +266,7 @@ 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 35e561d9d..00831bda1 100644 --- a/classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html +++ b/classnlohmann_1_1basic__json_ad1f617d29e8923dd40c89153f792b1bc.html @@ -279,9 +279,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:1483
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:1506
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
{}
 {}
 {"one":1,"two":2}
@@ -291,7 +291,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
-

Definition at line 1483 of file json.hpp.

+

Definition at line 1506 of file json.hpp.

@@ -301,7 +301,7 @@ 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 241843272..c7e20e538 100644 --- a/classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html +++ b/classnlohmann_1_1basic__json_ad2c4513cef5d8db760c4b2d871eea42c.html @@ -246,7 +246,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 243 of file json.hpp.

+

Definition at line 249 of file json.hpp.

@@ -256,7 +256,7 @@ 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 0b62fdbd0..8ef4a6bf3 100644 --- a/classnlohmann_1_1basic__json_ad497cbc4f80c8d79662ee6e19bf145dd.html +++ b/classnlohmann_1_1basic__json_ad497cbc4f80c8d79662ee6e19bf145dd.html @@ -319,21 +319,27 @@ template<class InteratorType , typename std::enable_if<
28  std::cout << j_array << '\n';
29  std::cout << j_string << '\n';
30 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3234
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3009
+
a class to store JSON values
Definition: json.hpp:187
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3292
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3046
Output (play with this example online):
null
 null
 null
 {"one":1}
 [1,8,16]
 null
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/erase__IteratorType_IteratorType.cpp -o erase__IteratorType_IteratorType 
+
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 size_type) – removes the element from an array at the given index
+
Since
version 1.0
-

Definition at line 3102 of file json.hpp.

+

Definition at line 3147 of file json.hpp.

@@ -343,7 +349,7 @@ null diff --git a/classnlohmann_1_1basic__json_ad7067a1a8ad2d88125915ada6d4d79b7.html b/classnlohmann_1_1basic__json_ad7067a1a8ad2d88125915ada6d4d79b7.html index e3cd2c5e5..7d4e6ce34 100644 --- a/classnlohmann_1_1basic__json_ad7067a1a8ad2d88125915ada6d4d79b7.html +++ b/classnlohmann_1_1basic__json_ad7067a1a8ad2d88125915ada6d4d79b7.html @@ -326,8 +326,8 @@ template<class CompatibleArrayType , typename std::enable_if<
56  std::cout << j_mset << '\n';
57  std::cout << j_umset << '\n';
58 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
[1,2,3,4]
 [1.2,2.3,3.4,5.6]
 [true,true,false,true]
@@ -341,7 +341,7 @@ template<class CompatibleArrayType , typename std::enable_if<
 
See also
basic_json(const array_t&) – create an array value
Since
version 1.0
-

Definition at line 1006 of file json.hpp.

+

Definition at line 1029 of file json.hpp.

@@ -351,7 +351,7 @@ template<class CompatibleArrayType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html b/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html index 33150c645..da7c0c42f 100644 --- a/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html +++ b/classnlohmann_1_1basic__json_ad8e0c5d04f016d1b3ac7369e5c73bedf.html @@ -272,14 +272,15 @@ Illustration from cppreference.com
13  // serialize the element that the iterator points to
14  std::cout << *it << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
const_iterator cbegin() const
returns a const iterator to the first element
Definition: json.hpp:3342
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
a const random access iterator for the basic_json class
Definition: json.hpp:5111
+
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:3406
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
a const random access iterator for the basic_json class
Definition: json.hpp:5232
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 
+
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/cbegin.cpp -o cbegin 
+
Since
version 1.0
-

Definition at line 3342 of file json.hpp.

+

Definition at line 3406 of file json.hpp.

@@ -289,7 +290,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html b/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html index abde71fdf..49d1718f8 100644 --- a/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html +++ b/classnlohmann_1_1basic__json_ada8e01109a60088e4db2a670d4903b54.html @@ -290,15 +290,16 @@ template<template< typename U, typename V, typename...Args > class Obje
26  std::cout << "out of range" << '\n';
27  }
28 }
-
a class to store JSON values
Definition: json.hpp:181
-
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:2539
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2582
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
"third"
 ["first","second","third","fourth"]
 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 
+ 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
-

Definition at line 2539 of file json.hpp.

+

Definition at line 2582 of file json.hpp.

@@ -308,7 +309,7 @@ out of range diff --git a/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html b/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html index b2c05dfa5..cef72f6e2 100644 --- a/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html +++ b/classnlohmann_1_1basic__json_adbd4c16c9ac641b2a4736bc2c6787d83.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
-

Definition at line 212 of file json.hpp.

+

Definition at line 218 of file json.hpp.

@@ -245,7 +245,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_add77b50f69debb20e98d5a8c6c11c90c.html b/classnlohmann_1_1basic__json_add77b50f69debb20e98d5a8c6c11c90c.html index e591827a9..ffae7d8ec 100644 --- a/classnlohmann_1_1basic__json_add77b50f69debb20e98d5a8c6c11c90c.html +++ b/classnlohmann_1_1basic__json_add77b50f69debb20e98d5a8c6c11c90c.html @@ -282,16 +282,16 @@ template<template< typename U, typename V, typename...Args > class Obje
15  std::cout << array_1 << '\n';
16  std::cout << array_5 << '\n';
17 }
-
basic_json<> json
default JSON class
Definition: json.hpp:7425
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
basic_json<> json
default JSON class
Definition: json.hpp:7532
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-

Definition at line 1507 of file json.hpp.

+

Definition at line 1530 of file json.hpp.

@@ -301,7 +301,7 @@ 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 90889721a..8358ac414 100644 --- a/classnlohmann_1_1basic__json_ade7bd6e0fe221fec9d3fa9b430f5ce76.html +++ b/classnlohmann_1_1basic__json_ade7bd6e0fe221fec9d3fa9b430f5ce76.html @@ -275,9 +275,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
string_t dump(const int indent=-1) const
serialization
Definition: json.hpp:1835
+
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:1863
Output (play with this example online):
{"one":1,"two":2}
 
 {"one":1,"two":2}
@@ -313,9 +313,10 @@ 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/dump.cpp -o dump 
-
See also
https://docs.python.org/2/library/json.html#json.dump
+
See also
https://docs.python.org/2/library/json.html#json.dump
+
Since
version 1.0
-

Definition at line 1835 of file json.hpp.

+

Definition at line 1863 of file json.hpp.

@@ -325,7 +326,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html b/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html index 72eb3e759..80176cef9 100644 --- a/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html +++ b/classnlohmann_1_1basic__json_adf5dea6fa9d7075ff89ca0796ab47a7e.html @@ -275,13 +275,14 @@ template<template< typename U, typename V, typename...Args > class Obje
15  std::cout << a << '\n';
16  std::cout << b << '\n';
17 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ 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
-

Definition at line 1743 of file json.hpp.

+

Definition at line 1768 of file json.hpp.

@@ -291,7 +292,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ae2980ed978451f844e6e9a0890b637a6.html b/classnlohmann_1_1basic__json_ae2980ed978451f844e6e9a0890b637a6.html index 0b0314e32..987469731 100644 --- a/classnlohmann_1_1basic__json_ae2980ed978451f844e6e9a0890b637a6.html +++ b/classnlohmann_1_1basic__json_ae2980ed978451f844e6e9a0890b637a6.html @@ -268,14 +268,14 @@ template<template< typename U, typename V, typename...Args > class Obje
12  std::cout << j_truth << '\n';
13  std::cout << j_falsity << '\n';
14 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
-

Definition at line 1108 of file json.hpp.

+

Definition at line 1131 of file json.hpp.

@@ -285,7 +285,7 @@ false diff --git a/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html b/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html index 9923079ac..c26c6c9b5 100644 --- a/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html +++ b/classnlohmann_1_1basic__json_ae347859ec88176ef76a0cbe5b4514fcf.html @@ -287,15 +287,16 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78

Output (play with this example online):

[1,2,3] != nullptr true
 {"A":"a","B":"b"} != nullptr true
 17 != nullptr true
 "foo" != nullptr true
 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 
-

Definition at line 4349 of file json.hpp.

+

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
+ +

Definition at line 4467 of file json.hpp.

@@ -305,7 +306,7 @@ null != nullptr false diff --git a/classnlohmann_1_1basic__json_ae42d32c34c8014b1bf677fdb7baa5401.html b/classnlohmann_1_1basic__json_ae42d32c34c8014b1bf677fdb7baa5401.html index 911262903..95ad3bc2a 100644 --- a/classnlohmann_1_1basic__json_ae42d32c34c8014b1bf677fdb7baa5401.html +++ b/classnlohmann_1_1basic__json_ae42d32c34c8014b1bf677fdb7baa5401.html @@ -283,8 +283,8 @@ template<class CompatibleStringType , typename std::enable_if<
13  // serialize the JSON string
14  std::cout << j << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
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
@@ -292,7 +292,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
-

Definition at line 1090 of file json.hpp.

+

Definition at line 1113 of file json.hpp.

@@ -302,7 +302,7 @@ template<class CompatibleStringType , typename std::enable_if< diff --git a/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html b/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html index 98d18b927..80188cb9f 100644 --- a/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html +++ b/classnlohmann_1_1basic__json_ae50f22a1c646b8627e88f1313cceffd4.html @@ -248,7 +248,7 @@ template<typename PointerType , typename std::enable_if<

Explicit 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.
+
Warning
The pointer becomes invalid if the underlying JSON object changes.
Template Parameters
@@ -277,18 +277,19 @@ template<typename PointerType , typename std::enable_if<
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:181
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
ValueType get() const
get a value (explicit)
Definition: json.hpp:2374
-
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:511
-
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:576
+
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:2896
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
ValueType get() const
get a value (explicit)
Definition: json.hpp:2410
+
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
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
+
See also
get_ptr() for explicit pointer-member access
+
Since
version 1.0
-

Definition at line 2408 of file json.hpp.

+

Definition at line 2445 of file json.hpp.

@@ -298,7 +299,7 @@ true diff --git a/classnlohmann_1_1basic__json_ae5ae3b1c6c67f52e9495ac092f6fb43e.html b/classnlohmann_1_1basic__json_ae5ae3b1c6c67f52e9495ac092f6fb43e.html index 99ec3a71e..62401fb12 100644 --- a/classnlohmann_1_1basic__json_ae5ae3b1c6c67f52e9495ac092f6fb43e.html +++ b/classnlohmann_1_1basic__json_ae5ae3b1c6c67f52e9495ac092f6fb43e.html @@ -289,15 +289,16 @@ template<template< typename U, typename V, typename...Args > class Obje
14  std::cout << *new_pos << '\n';
15  std::cout << v << '\n';
16 }
-
a class to store JSON values
Definition: json.hpp:181
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3899
+
a class to store JSON values
Definition: json.hpp:187
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3991
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/insert.cpp -o insert 
+
Since
version 1.0
-

Definition at line 3899 of file json.hpp.

+

Definition at line 3991 of file json.hpp.

@@ -307,7 +308,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html b/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html index 05bef1c04..c74cd1e1d 100644 --- a/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html +++ b/classnlohmann_1_1basic__json_ae874cfc1746b560c53a03bcf5b7bbeed.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
bool is_structured() const noexcept
return whether type is structured
Definition: json.hpp:1901
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
bool is_structured() const noexcept
return whether type is structured
Definition: json.hpp:1935
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
false
 false
 false
@@ -283,9 +283,10 @@ false
 true
 true
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_structured.cpp -o is_structured 
+ 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
-

Definition at line 1901 of file json.hpp.

+

Definition at line 1935 of file json.hpp.

@@ -295,7 +296,7 @@ false diff --git a/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html b/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html index 16ae8a860..2fa04fbb0 100644 --- a/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html +++ b/classnlohmann_1_1basic__json_ae928414b2805cf6ef56b4e4f8d235416.html @@ -235,7 +235,7 @@ template<template< typename U, typename V, typename...Args > class Obje
PointerTypepointer type; must be a pointer to array_t, object_t, string_t, boolean_t, number_integer_t, or number_float_t.
-

Definition at line 218 of file json.hpp.

+

Definition at line 224 of file json.hpp.

@@ -245,7 +245,7 @@ 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 74f467455..f139750df 100644 --- a/classnlohmann_1_1basic__json_ae960d2d6bc7b94fe39cc5e9f106edfa9.html +++ b/classnlohmann_1_1basic__json_ae960d2d6bc7b94fe39cc5e9f106edfa9.html @@ -273,13 +273,14 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:2539
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2582
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ 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
-

Definition at line 2719 of file json.hpp.

+

Definition at line 2752 of file json.hpp.

@@ -289,7 +290,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html b/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html index 465e6ffe4..ad707df11 100644 --- a/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html +++ b/classnlohmann_1_1basic__json_aea1c863b719b4ca5b77188c171bbfafe.html @@ -265,7 +265,7 @@ template<template< typename U, typename V, typename...Args > class Obje -

Definition at line 738 of file json.hpp.

+

Definition at line 754 of file json.hpp.

@@ -275,7 +275,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_aeda4ec7473c17fae51e6d1eba0faf720.html b/classnlohmann_1_1basic__json_aeda4ec7473c17fae51e6d1eba0faf720.html index cfe653b2a..cccbb33d1 100644 --- a/classnlohmann_1_1basic__json_aeda4ec7473c17fae51e6d1eba0faf720.html +++ b/classnlohmann_1_1basic__json_aeda4ec7473c17fae51e6d1eba0faf720.html @@ -284,16 +284,17 @@ template<template< typename U, typename V, typename...Args > class Obje
22  std::cout << object << '\n';
23  std::cout << null << '\n';
24 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3770
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
+
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3858
Output (play with this example online):
{"one":1,"two":2}
 null
 {"four":4,"one":1,"three":3,"two":2}
 {"A":"a","B":"b"}
-
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 
+ 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
-

Definition at line 3852 of file json.hpp.

+

Definition at line 3942 of file json.hpp.

@@ -303,7 +304,7 @@ null diff --git a/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html b/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html index 580264c25..d25112096 100644 --- a/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html +++ b/classnlohmann_1_1basic__json_af073eec08d2e68924098aef09e9a10ba.html @@ -271,14 +271,15 @@ template<template< typename U, typename V, typename...Args > class Obje
15  std::cout << "j1 = " << j1 << '\n';
16  std::cout << "j2 = " << j2 << '\n';
17 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
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:4081
+
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:4183
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 
+ 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
-

Definition at line 4081 of file json.hpp.

+

Definition at line 4183 of file json.hpp.

@@ -288,7 +289,7 @@ j2 = [1,2,3,4,5] diff --git a/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html b/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html index 00a6f162e..484636db4 100644 --- a/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html +++ b/classnlohmann_1_1basic__json_af0ebd1757acb971a6504b4acabf88584.html @@ -271,14 +271,15 @@ Illustration from cppreference.com
13  // serialize the element that the iterator points to
14  std::cout << *it << '\n';
15 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
reverse_iterator rbegin()
returns an iterator to the reverse-beginning
Definition: json.hpp:3419
-
a template for a reverse iterator class
Definition: json.hpp:226
+
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:3489
+
a template for a reverse iterator class
Definition: json.hpp:232
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 
+ The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/rbegin.cpp -o rbegin 
+
Since
version 1.0
-

Definition at line 3419 of file json.hpp.

+

Definition at line 3489 of file json.hpp.

@@ -288,7 +289,7 @@ Illustration from cppreference.com diff --git a/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html b/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html index 34bd012b0..ece4b3ce3 100644 --- a/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html +++ b/classnlohmann_1_1basic__json_af1e3f9e079136abca2530c8191c56292.html @@ -315,21 +315,21 @@ template<template< typename U, typename V, typename...Args > class Obje
18  std::cout << j_nested_object << '\n';
19  std::cout << j_nested_array << '\n';
20 }
-
basic_json<> json
default JSON class
Definition: json.hpp:7425
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
basic_json<> json
default JSON class
Definition: json.hpp:7532
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
{}
 {"one":1,"two":2}
 [1,2,3,4]
 {"one":[1],"two":[1,2]}
 [[[1],"one"],[[1,2],"two"]]
 
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/basic_json__list_init_t.cpp -o basic_json__list_init_t 
-
See also
array(std::initializer_list<basic_json>) - create a JSON array value from an initializer list
+
See also
array(std::initializer_list<basic_json>) – create a JSON array value from an initializer list
-object(std::initializer_list<basic_json>) - create a JSON object value from an initializer list
+object(std::initializer_list<basic_json>) – create a JSON object value from an initializer list
Since
version 1.0
-

Definition at line 1353 of file json.hpp.

+

Definition at line 1376 of file json.hpp.

@@ -339,7 +339,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html b/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html index 5cd8e30fe..0b90c0f29 100644 --- a/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html +++ b/classnlohmann_1_1basic__json_af2730bc8ffa6b28916875c13ee7b83f5.html @@ -313,13 +313,13 @@ template<template< typename U, typename V, typename...Args > class Obje
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:7425
-
a class to store JSON values
Definition: json.hpp:181
-
std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
per-element parser callback type
Definition: json.hpp:803
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
basic_json<> json
default JSON class
Definition: json.hpp:7532
+
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
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:4574
-
parse_event_t
JSON callback events.
Definition: json.hpp:738
+
static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
deserialize from string
Definition: json.hpp:4704
+
parse_event_t
JSON callback events.
Definition: json.hpp:754
Output (play with this example online):
{
     "Image": {
         "Animated": false,
@@ -355,9 +355,10 @@ 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/parse__string__parser_callback_t.cpp -o parse__string__parser_callback_t 
-
See also
parse(std::istream&, parser_callback_t) for a version that reads from an input stream
+
See also
parse(std::istream&, parser_callback_t) for a version that reads from an input stream
+
Since
version 1.0
-

Definition at line 4574 of file json.hpp.

+

Definition at line 4704 of file json.hpp.

@@ -367,7 +368,7 @@ 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 a621d766b..a1b7ff9ca 100644 --- a/classnlohmann_1_1basic__json_af661bc209bf22097e2f76607a11b56bf.html +++ b/classnlohmann_1_1basic__json_af661bc209bf22097e2f76607a11b56bf.html @@ -273,9 +273,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:181
-
bool is_boolean() const noexcept
return whether value is a boolean
Definition: json.hpp:1935
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
bool is_boolean() const noexcept
return whether value is a boolean
Definition: json.hpp:1973
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
false
 true
 false
@@ -283,9 +283,10 @@ false
 false
 false
 false
-
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/is_boolean.cpp -o is_boolean 
+ 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
-

Definition at line 1935 of file json.hpp.

+

Definition at line 1973 of file json.hpp.

@@ -295,7 +296,7 @@ false diff --git a/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html b/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html index cd7704e5a..2f58ea6e5 100644 --- a/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html +++ b/classnlohmann_1_1basic__json_af6b6050ccd906dddf7c9f47fe3ad62a5.html @@ -284,14 +284,15 @@ template<template< typename U, typename V, typename...Args > class Obje
20  std::cout << "out of range" << '\n';
21  }
22 }
-
a class to store JSON values
Definition: json.hpp:181
-
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:2539
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:2582
+
namespace for Niels Lohmann
Definition: json.hpp:78
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 
+ 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
-

Definition at line 2571 of file json.hpp.

+

Definition at line 2611 of file json.hpp.

@@ -301,7 +302,7 @@ out of range diff --git a/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html b/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html index 85c66c014..9385c8466 100644 --- a/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html +++ b/classnlohmann_1_1basic__json_af709c079de0ac3507143ea2c60699bd0.html @@ -311,8 +311,8 @@ template<typename ValueType , typename std::enable_if<
47  std::cout << i.first << ": " << i.second << '\n';
48  }
49 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
1
 42 42
 17.23 17
@@ -324,9 +324,10 @@ number: {"floating-point":17.23,"integer":42}
 null: null
 boolean: true
 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 
+ 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
-

Definition at line 2504 of file json.hpp.

+

Definition at line 2545 of file json.hpp.

@@ -336,7 +337,7 @@ array: [1,2,3,4,5] diff --git a/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html b/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html index 722dc5a0d..8f7d9885c 100644 --- a/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html +++ b/classnlohmann_1_1basic__json_af74581d177dafc38df5a126ccd358999.html @@ -292,8 +292,8 @@ template<template< typename U, typename V, typename...Args > class Obje
28  // output changed object
29  std::cout << std::setw(4) << object << '\n';
30 }
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
2
 
 {
@@ -316,9 +316,10 @@ 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/operatorarray__key_type.cpp -o operatorarray__key_type 
See also
at(const typename object_t::key_type&) for access by reference with range checking
-value() for access by value with a default value
+value() for access by value with a default value +
Since
version 1.0
-

Definition at line 2756 of file json.hpp.

+

Definition at line 2786 of file json.hpp.

@@ -328,7 +329,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/classnlohmann_1_1basic__json_af93e556bf708cb81b22ce223af1aa727.html b/classnlohmann_1_1basic__json_af93e556bf708cb81b22ce223af1aa727.html index 8d9f5ffd7..811ead55c 100644 --- a/classnlohmann_1_1basic__json_af93e556bf708cb81b22ce223af1aa727.html +++ b/classnlohmann_1_1basic__json_af93e556bf708cb81b22ce223af1aa727.html @@ -275,15 +275,15 @@ template<template< typename U, typename V, typename...Args > class Obje
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:371
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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
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
-

Definition at line 969 of file json.hpp.

+

Definition at line 992 of file json.hpp.

@@ -293,7 +293,7 @@ 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 01344866b..bb12775e3 100644 --- a/classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html +++ b/classnlohmann_1_1basic__json_afc4223b5ad03b1b76e925374a8fff98e.html @@ -248,8 +248,8 @@ template<template< typename U, typename V, typename...Args > class Obje

Creates a JSON array value from a given initializer list. That is, given a list of values a, b, c, creates the JSON value [a, b, c]. If the initializer list is empty, the empty array [] is created.

Note
This function is only needed to express two edge cases that cannot be realized with the initializer list constructor (basic_json(std::initializer_list<basic_json>, bool, value_t)). These cases are:
    -
  1. creating an array whose elements are all pairs whose first element is a string - in this case, the initializer list constructor would create an object, taking the first elements as keys
  2. -
  3. creating an empty array - passing the empty initializer list to the initializer list constructor yields an empty object
  4. +
  5. creating an array whose elements are all pairs whose first element is a string – in this case, the initializer list constructor would create an object, taking the first elements as keys
  6. +
  7. creating an empty array – passing the empty initializer list to the initializer list constructor yields an empty object
Parameters
@@ -278,9 +278,9 @@ template<template< typename U, typename V, typename...Args > class Obje
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:1443
-
a class to store JSON values
Definition: json.hpp:181
-
namespace for Niels Lohmann
Definition: json.hpp:77
+
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:1466
+
a class to store JSON values
Definition: json.hpp:187
+
namespace for Niels Lohmann
Definition: json.hpp:78
Output (play with this example online):
[]
 []
 [1,2,3,4]
@@ -291,7 +291,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
-

Definition at line 1443 of file json.hpp.

+

Definition at line 1466 of file json.hpp.

@@ -301,7 +301,7 @@ template<template< typename U, typename V, typename...Args > class Obje diff --git a/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 8210e383c..2b8f4998b 100644 --- a/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -92,7 +92,7 @@ Files diff --git a/functions.html b/functions.html index a261a92e7..ea0294e62 100644 --- a/functions.html +++ b/functions.html @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_b.html b/functions_b.html index 339fb4e4a..25c997497 100644 --- a/functions_b.html +++ b/functions_b.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_c.html b/functions_c.html index 539e073ed..d754f03b2 100644 --- a/functions_c.html +++ b/functions_c.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_d.html b/functions_d.html index 9eca4985f..ccd883588 100644 --- a/functions_d.html +++ b/functions_d.html @@ -129,7 +129,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_e.html b/functions_e.html index bdbb767a9..d8bfc92e0 100644 --- a/functions_e.html +++ b/functions_e.html @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_enum.html b/functions_enum.html index 7b64e5e9c..bf6f5aa64 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_f.html b/functions_f.html index 44192a107..890284ebb 100644 --- a/functions_f.html +++ b/functions_f.html @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func.html b/functions_func.html index 1ed095c9b..f4292b115 100644 --- a/functions_func.html +++ b/functions_func.html @@ -415,7 +415,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_g.html b/functions_g.html index 59780c8a4..1ffe36926 100644 --- a/functions_g.html +++ b/functions_g.html @@ -131,7 +131,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_i.html b/functions_i.html index b637e5887..5b5f43873 100644 --- a/functions_i.html +++ b/functions_i.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_j.html b/functions_j.html index c430b0208..26fec2615 100644 --- a/functions_j.html +++ b/functions_j.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_k.html b/functions_k.html index 39a9fe921..9c96c6956 100644 --- a/functions_k.html +++ b/functions_k.html @@ -126,7 +126,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_m.html b/functions_m.html index f57334734..4c267c280 100644 --- a/functions_m.html +++ b/functions_m.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_n.html b/functions_n.html index 2cd8ebd38..2e082095a 100644 --- a/functions_n.html +++ b/functions_n.html @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_o.html b/functions_o.html index b660d15dc..042978ec6 100644 --- a/functions_o.html +++ b/functions_o.html @@ -216,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_p.html b/functions_p.html index d45f26ac6..f757134bd 100644 --- a/functions_p.html +++ b/functions_p.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_r.html b/functions_r.html index 6c6e8119f..47cda2e73 100644 --- a/functions_r.html +++ b/functions_r.html @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_rela.html b/functions_rela.html index 8f0ce0f93..36c0f51f1 100644 --- a/functions_rela.html +++ b/functions_rela.html @@ -124,7 +124,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_s.html b/functions_s.html index bacaefc61..68bc27d1d 100644 --- a/functions_s.html +++ b/functions_s.html @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_t.html b/functions_t.html index 7d448b48c..01c68b91e 100644 --- a/functions_t.html +++ b/functions_t.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_type.html b/functions_type.html index 37d1aee23..a33635063 100644 --- a/functions_type.html +++ b/functions_type.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_v.html b/functions_v.html index 1cf72653b..f3a76fdb6 100644 --- a/functions_v.html +++ b/functions_v.html @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_~.html b/functions_~.html index cb5fc68f0..883e628f3 100644 --- a/functions_~.html +++ b/functions_~.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/graph_legend.html b/graph_legend.html index edc805369..73ed535fa 100644 --- a/graph_legend.html +++ b/graph_legend.html @@ -142,7 +142,7 @@ A yellow dashed arrow denotes a relation between a template instance and the tem diff --git a/hierarchy.html b/hierarchy.html index 533de0b39..dcd607cf9 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/index.html b/index.html index 5a1f84360..777d68848 100644 --- a/index.html +++ b/index.html @@ -87,11 +87,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Author
Niels Lohmann
-
See also
https://github.com/nlohmann/json to download the source code
+
See also
https://github.com/nlohmann/json to download the source code
+
Version
1.0
diff --git a/json_8hpp_source.html b/json_8hpp_source.html index b3ec8af9f..c9ac26818 100644 --- a/json_8hpp_source.html +++ b/json_8hpp_source.html @@ -119,4728 +119,4626 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
70  using ssize_t = SSIZE_T;
71 #endif
72 
-
77 namespace nlohmann
-
78 {
-
79 
+
78 namespace nlohmann
+
79 {
80 
-
84 namespace
-
85 {
-
90 template<typename T>
-
91 struct has_mapped_type
-
92 {
-
93  private:
-
94  template<typename C> static char test(typename C::mapped_type*);
-
95  template<typename C> static int test(...);
-
96  public:
-
97  enum { value = sizeof(test<T>(0)) == sizeof(char) };
-
98 };
-
99 
-
101 template<typename T>
-
102 static bool approx(const T a, const T b)
-
103 {
-
104  return not (a > b or a < b);
-
105 }
-
106 }
-
107 
-
172 template <
-
173  template<typename U, typename V, typename... Args> class ObjectType = std::map,
-
174  template<typename U, typename... Args> class ArrayType = std::vector,
-
175  class StringType = std::string,
-
176  class BooleanType = bool,
-
177  class NumberIntegerType = int64_t,
-
178  class NumberFloatType = double,
-
179  template<typename U> class AllocatorType = std::allocator
-
180  >
- -
182 {
-
183  private:
-
185  using basic_json_t = basic_json<ObjectType,
-
186  ArrayType,
-
187  StringType,
-
188  BooleanType,
-
189  NumberIntegerType,
-
190  NumberFloatType,
-
191  AllocatorType>;
-
192 
-
193  public:
-
194 
-
196  // container types //
-
198 
-
201 
- -
204 
- +
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 
-
209  using const_reference = const value_type&;
+
210 
-
212  using difference_type = std::ptrdiff_t;
+
213 
-
215  using size_type = std::size_t;
+
215  using const_reference = const value_type&;
216 
-
218  using allocator_type = AllocatorType<basic_json>;
+
218  using difference_type = std::ptrdiff_t;
219 
-
221  using pointer = typename std::allocator_traits<allocator_type>::pointer;
-
223  using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer;
-
224 
-
225  // forward declaration
-
226  template<typename Base> class json_reverse_iterator;
-
227 
-
229  class iterator;
-
231  class const_iterator;
- - -
236 
-
238 
-
239 
- -
244  {
-
245  return allocator_type();
-
246  }
-
247 
-
248 
-
250  // JSON value data types //
-
252 
-
255 
-
324  using object_t = ObjectType<StringType,
-
325  basic_json,
-
326  std::less<StringType>,
-
327  AllocatorType<std::pair<const StringType,
-
328  basic_json>>>;
-
329 
-
371  using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
-
372 
-
417  using string_t = StringType;
-
418 
-
443  using boolean_t = BooleanType;
-
444 
-
511  using number_integer_t = NumberIntegerType;
-
512 
-
576  using number_float_t = NumberFloatType;
-
577 
-
579 
-
580 
-
582  // JSON type enumeration //
-
584 
-
595  enum class value_t : uint8_t
-
596  {
-
597  null,
-
598  object,
-
599  array,
-
600  string,
-
601  boolean,
- -
603  number_float,
-
604  discarded
-
605  };
-
606 
-
607 
-
608  private:
-
610  template<typename T, typename... Args>
-
611  static T* create(Args&& ... args)
+
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  AllocatorType<T> alloc;
-
614  auto deleter = [&](T * object)
-
615  {
-
616  alloc.deallocate(object, 1);
-
617  };
-
618  std::unique_ptr<T, decltype(deleter)> object(alloc.allocate(1), deleter);
-
619  alloc.construct(object.get(), std::forward<Args>(args)...);
-
620  return object.release();
-
621  }
+
613  null,
+
614  object,
+
615  array,
+
616  string,
+
617  boolean,
+ +
619  number_float,
+
620  discarded
+
621  };
622 
-
624  // JSON value storage //
-
626 
-
634  union json_value
-
635  {
-
637  object_t* object;
-
639  array_t* array;
-
641  string_t* string;
-
643  boolean_t boolean;
-
645  number_integer_t number_integer;
-
647  number_float_t number_float;
-
648 
-
650  json_value() noexcept = default;
-
652  json_value(boolean_t v) noexcept : boolean(v) {}
-
654  json_value(number_integer_t v) noexcept : number_integer(v) {}
-
656  json_value(number_float_t v) noexcept : number_float(v) {}
-
658  json_value(value_t t)
-
659  {
-
660  switch (t)
-
661  {
-
662  case value_t::object:
-
663  {
-
664  object = create<object_t>();
-
665  break;
-
666  }
-
667 
-
668  case value_t::array:
-
669  {
-
670  array = create<array_t>();
-
671  break;
-
672  }
-
673 
-
674  case value_t::string:
-
675  {
-
676  string = create<string_t>("");
-
677  break;
-
678  }
-
679 
-
680  case value_t::boolean:
-
681  {
-
682  boolean = boolean_t(false);
-
683  break;
-
684  }
-
685 
- -
687  {
-
688  number_integer = number_integer_t(0);
-
689  break;
-
690  }
-
691 
- -
693  {
-
694  number_float = number_float_t(0.0);
-
695  break;
-
696  }
-
697 
-
698  default:
-
699  {
-
700  break;
-
701  }
-
702  }
-
703  }
-
704 
-
706  json_value(const string_t& value)
-
707  {
-
708  string = create<string_t>(value);
-
709  }
-
710 
-
712  json_value(const object_t& value)
-
713  {
-
714  object = create<object_t>(value);
-
715  }
-
716 
-
718  json_value(const array_t& value)
-
719  {
-
720  array = create<array_t>(value);
-
721  }
-
722  };
-
723 
-
724 
-
725  public:
-
727  // JSON parser callback //
-
729 
-
738  enum class parse_event_t : uint8_t
-
739  {
-
741  object_start,
-
743  object_end,
-
745  array_start,
-
747  array_end,
-
749  key,
-
751  value
-
752  };
-
753 
-
803  using parser_callback_t = std::function<bool(int depth, parse_event_t event, basic_json& parsed)>;
-
804 
-
805 
-
807  // constructors //
-
809 
- -
844  : m_type(value), m_value(value)
-
845  {}
-
846 
-
866  basic_json() noexcept = default;
-
867 
-
887  basic_json(std::nullptr_t) noexcept
-
888  : basic_json(value_t::null)
-
889  {}
+
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), m_value(value)
+
868  {}
+
869 
+
889  basic_json() noexcept = default;
890 
- -
911  : m_type(value_t::object), m_value(value)
+
910  basic_json(std::nullptr_t) noexcept
+
911  : basic_json(value_t::null)
912  {}
913 
-
937  template <class CompatibleObjectType, typename
-
938  std::enable_if<
-
939  std::is_constructible<typename object_t::key_type, typename CompatibleObjectType::key_type>::value and
-
940  std::is_constructible<basic_json, typename CompatibleObjectType::mapped_type>::value, int>::type
-
941  = 0>
-
942  basic_json(const CompatibleObjectType& value)
-
943  : m_type(value_t::object)
-
944  {
-
945  using std::begin;
-
946  using std::end;
-
947  m_value.object = create<object_t>(begin(value), end(value));
-
948  }
-
949 
- -
970  : m_type(value_t::array), m_value(value)
-
971  {}
+ +
934  : m_type(value_t::object), m_value(value)
+
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& value)
+
966  : m_type(value_t::object)
+
967  {
+
968  using std::begin;
+
969  using std::end;
+
970  m_value.object = create<object_t>(begin(value), end(value));
+
971  }
972 
-
996  template <class CompatibleArrayType, typename
-
997  std::enable_if<
-
998  not std::is_same<CompatibleArrayType, typename basic_json_t::iterator>::value and
-
999  not std::is_same<CompatibleArrayType, typename basic_json_t::const_iterator>::value and
-
1000  not std::is_same<CompatibleArrayType, typename basic_json_t::reverse_iterator>::value and
-
1001  not std::is_same<CompatibleArrayType, typename basic_json_t::const_reverse_iterator>::value and
-
1002  not std::is_same<CompatibleArrayType, typename array_t::iterator>::value and
-
1003  not std::is_same<CompatibleArrayType, typename array_t::const_iterator>::value and
-
1004  std::is_constructible<basic_json, typename CompatibleArrayType::value_type>::value, int>::type
-
1005  = 0>
-
1006  basic_json(const CompatibleArrayType& value)
-
1007  : m_type(value_t::array)
-
1008  {
-
1009  using std::begin;
-
1010  using std::end;
-
1011  m_value.array = create<array_t>(begin(value), end(value));
-
1012  }
-
1013 
- -
1036  : m_type(value_t::string), m_value(value)
-
1037  {}
-
1038 
-
1059  basic_json(const typename string_t::value_type* value)
-
1060  : basic_json(string_t(value))
-
1061  {}
-
1062 
-
1086  template <class CompatibleStringType, typename
-
1087  std::enable_if<
-
1088  std::is_constructible<string_t, CompatibleStringType>::value, int>::type
-
1089  = 0>
-
1090  basic_json(const CompatibleStringType& value)
-
1091  : basic_json(string_t(value))
-
1092  {}
-
1093 
- -
1109  : m_type(value_t::boolean), m_value(value)
-
1110  {}
-
1111 
-
1137  template<typename T,
-
1138  typename std::enable_if<
-
1139  not (std::is_same<T, int>::value)
-
1140  and std::is_same<T, number_integer_t>::value
-
1141  , int>::type = 0>
-
1142  basic_json(const number_integer_t value)
-
1143  : m_type(value_t::number_integer), m_value(value)
-
1144  {}
-
1145 
-
1171  basic_json(const int value)
-
1172  : m_type(value_t::number_integer),
-
1173  m_value(static_cast<number_integer_t>(value))
-
1174  {}
-
1175 
-
1201  template<typename CompatibleNumberIntegerType, typename
-
1202  std::enable_if<
-
1203  std::is_constructible<number_integer_t, CompatibleNumberIntegerType>::value and
-
1204  std::numeric_limits<CompatibleNumberIntegerType>::is_integer, CompatibleNumberIntegerType>::type
-
1205  = 0>
-
1206  basic_json(const CompatibleNumberIntegerType value) noexcept
-
1207  : m_type(value_t::number_integer),
-
1208  m_value(static_cast<number_integer_t>(value))
-
1209  {}
-
1210 
- -
1236  : m_type(value_t::number_float), m_value(value)
-
1237  {
-
1238  // replace infinity and NAN by null
-
1239  if (not std::isfinite(value))
-
1240  {
-
1241  m_type = value_t::null;
-
1242  m_value = json_value();
-
1243  }
-
1244  }
-
1245 
-
1276  template<typename CompatibleNumberFloatType, typename = typename
-
1277  std::enable_if<
-
1278  std::is_constructible<number_float_t, CompatibleNumberFloatType>::value and
-
1279  std::is_floating_point<CompatibleNumberFloatType>::value>::type
-
1280  >
-
1281  basic_json(const CompatibleNumberFloatType value) noexcept
- -
1283  {}
-
1284 
-
1353  basic_json(std::initializer_list<basic_json> init,
-
1354  bool type_deduction = true,
-
1355  value_t manual_type = value_t::array)
-
1356  {
-
1357  // the initializer list could describe an object
-
1358  bool is_object = true;
-
1359 
-
1360  // check if each element is an array with two elements whose first element
-
1361  // is a string
-
1362  for (const auto& element : init)
-
1363  {
-
1364  if (not element.is_array() or element.size() != 2
-
1365  or not element[0].is_string())
-
1366  {
-
1367  // we found an element that makes it impossible to use the
-
1368  // initializer list as object
-
1369  is_object = false;
-
1370  break;
-
1371  }
-
1372  }
-
1373 
-
1374  // adjust type if type deduction is not wanted
-
1375  if (not type_deduction)
-
1376  {
-
1377  // if array is wanted, do not create an object though possible
-
1378  if (manual_type == value_t::array)
-
1379  {
-
1380  is_object = false;
-
1381  }
+ +
993  : m_type(value_t::array), m_value(value)
+
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& value)
+
1030  : m_type(value_t::array)
+
1031  {
+
1032  using std::begin;
+
1033  using std::end;
+
1034  m_value.array = create<array_t>(begin(value), end(value));
+
1035  }
+
1036 
+ +
1059  : m_type(value_t::string), m_value(value)
+
1060  {}
+
1061 
+
1082  basic_json(const typename string_t::value_type* value)
+
1083  : basic_json(string_t(value))
+
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& value)
+
1114  : basic_json(string_t(value))
+
1115  {}
+
1116 
+ +
1132  : m_type(value_t::boolean), m_value(value)
+
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 value)
+
1166  : m_type(value_t::number_integer), m_value(value)
+
1167  {}
+
1168 
+
1194  basic_json(const int value)
+
1195  : m_type(value_t::number_integer),
+
1196  m_value(static_cast<number_integer_t>(value))
+
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 value) noexcept
+
1230  : m_type(value_t::number_integer),
+
1231  m_value(static_cast<number_integer_t>(value))
+
1232  {}
+
1233 
+ +
1259  : m_type(value_t::number_float), m_value(value)
+
1260  {
+
1261  // replace infinity and NAN by null
+
1262  if (not std::isfinite(value))
+
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 value) noexcept
+ +
1306  {}
+
1307 
+
1376  basic_json(std::initializer_list<basic_json> init,
+
1377  bool type_deduction = true,
+
1378  value_t manual_type = value_t::array)
+
1379  {
+
1380  // the initializer list could describe an object
+
1381  bool is_object = true;
1382 
-
1383  // if object is wanted but impossible, throw an exception
-
1384  if (manual_type == value_t::object and not is_object)
-
1385  {
-
1386  throw std::domain_error("cannot create object from initializer list");
-
1387  }
-
1388  }
-
1389 
-
1390  if (is_object)
-
1391  {
-
1392  // the initializer list is a list of pairs -> create object
-
1393  m_type = value_t::object;
-
1394  m_value = value_t::object;
-
1395 
-
1396  for (auto& element : init)
-
1397  {
-
1398  m_value.object->emplace(std::move(*(element[0].m_value.string)), std::move(element[1]));
-
1399  }
-
1400  }
-
1401  else
-
1402  {
-
1403  // the initializer list describes an array -> create array
-
1404  m_type = value_t::array;
-
1405  m_value.array = create<array_t>(std::move(init));
-
1406  }
-
1407  }
-
1408 
-
1443  static basic_json array(std::initializer_list<basic_json> init =
-
1444  std::initializer_list<basic_json>())
-
1445  {
-
1446  return basic_json(init, false, value_t::array);
-
1447  }
-
1448 
-
1483  static basic_json object(std::initializer_list<basic_json> init =
-
1484  std::initializer_list<basic_json>())
-
1485  {
-
1486  return basic_json(init, false, value_t::object);
-
1487  }
-
1488 
-
1507  basic_json(size_type count, const basic_json& value)
-
1508  : m_type(value_t::array)
-
1509  {
-
1510  m_value.array = create<array_t>(count, value);
-
1511  }
-
1512 
-
1545  template <class InputIT, typename
-
1546  std::enable_if<
-
1547  std::is_same<InputIT, typename basic_json_t::iterator>::value or
-
1548  std::is_same<InputIT, typename basic_json_t::const_iterator>::value
-
1549  , int>::type
-
1550  = 0>
-
1551  basic_json(InputIT first, InputIT last) : m_type(first.m_object->m_type)
-
1552  {
-
1553  // make sure iterator fits the current value
-
1554  if (first.m_object != last.m_object)
-
1555  {
-
1556  throw std::domain_error("iterators are not compatible");
-
1557  }
-
1558 
-
1559  // check if iterator range is complete for primitive values
-
1560  switch (m_type)
-
1561  {
-
1562  case value_t::boolean:
-
1563  case value_t::number_float:
- -
1565  case value_t::string:
-
1566  {
-
1567  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
-
1568  {
-
1569  throw std::out_of_range("iterators out of range");
-
1570  }
-
1571  break;
-
1572  }
-
1573 
-
1574  default:
-
1575  {
-
1576  break;
-
1577  }
-
1578  }
-
1579 
-
1580  switch (m_type)
-
1581  {
- -
1583  {
-
1584  m_value.number_integer = first.m_object->m_value.number_integer;
-
1585  break;
-
1586  }
-
1587 
-
1588  case value_t::number_float:
+
1383  // check if each element is an array with two elements whose first
+
1384  // element is a string
+
1385  for (const auto& element : init)
+
1386  {
+
1387  if (not element.is_array() or element.size() != 2
+
1388  or not element[0].is_string())
+
1389  {
+
1390  // we found an element that makes it impossible to use the
+
1391  // initializer list as object
+
1392  is_object = false;
+
1393  break;
+
1394  }
+
1395  }
+
1396 
+
1397  // adjust type if type deduction is not wanted
+
1398  if (not type_deduction)
+
1399  {
+
1400  // if array is wanted, do not create an object though possible
+
1401  if (manual_type == value_t::array)
+
1402  {
+
1403  is_object = false;
+
1404  }
+
1405 
+
1406  // if object is wanted but impossible, throw an exception
+
1407  if (manual_type == value_t::object and not is_object)
+
1408  {
+
1409  throw std::domain_error("cannot create object from initializer list");
+
1410  }
+
1411  }
+
1412 
+
1413  if (is_object)
+
1414  {
+
1415  // the initializer list is a list of pairs -> create object
+
1416  m_type = value_t::object;
+
1417  m_value = value_t::object;
+
1418 
+
1419  for (auto& element : init)
+
1420  {
+
1421  m_value.object->emplace(std::move(*(element[0].m_value.string)), std::move(element[1]));
+
1422  }
+
1423  }
+
1424  else
+
1425  {
+
1426  // the initializer list describes an array -> create array
+
1427  m_type = value_t::array;
+
1428  m_value.array = create<array_t>(std::move(init));
+
1429  }
+
1430  }
+
1431 
+
1466  static basic_json array(std::initializer_list<basic_json> init =
+
1467  std::initializer_list<basic_json>())
+
1468  {
+
1469  return basic_json(init, false, value_t::array);
+
1470  }
+
1471 
+
1506  static basic_json object(std::initializer_list<basic_json> init =
+
1507  std::initializer_list<basic_json>())
+
1508  {
+
1509  return basic_json(init, false, value_t::object);
+
1510  }
+
1511 
+
1530  basic_json(size_type count, const basic_json& value)
+
1531  : m_type(value_t::array)
+
1532  {
+
1533  m_value.array = create<array_t>(count, value);
+
1534  }
+
1535 
+
1568  template <class InputIT, typename
+
1569  std::enable_if<
+
1570  std::is_same<InputIT, typename basic_json_t::iterator>::value or
+
1571  std::is_same<InputIT, typename basic_json_t::const_iterator>::value
+
1572  , int>::type
+
1573  = 0>
+
1574  basic_json(InputIT first, InputIT last) : m_type(first.m_object->m_type)
+
1575  {
+
1576  // make sure iterator fits the current value
+
1577  if (first.m_object != last.m_object)
+
1578  {
+
1579  throw std::domain_error("iterators are not compatible");
+
1580  }
+
1581 
+
1582  // check if iterator range is complete for primitive values
+
1583  switch (m_type)
+
1584  {
+
1585  case value_t::boolean:
+
1586  case value_t::number_float:
+ +
1588  case value_t::string:
1589  {
-
1590  m_value.number_float = first.m_object->m_value.number_float;
-
1591  break;
-
1592  }
-
1593 
-
1594  case value_t::boolean:
-
1595  {
-
1596  m_value.boolean = first.m_object->m_value.boolean;
-
1597  break;
-
1598  }
-
1599 
-
1600  case value_t::string:
-
1601  {
-
1602  m_value = *first.m_object->m_value.string;
-
1603  break;
-
1604  }
-
1605 
-
1606  case value_t::object:
-
1607  {
-
1608  m_value.object = create<object_t>(first.m_it.object_iterator, last.m_it.object_iterator);
-
1609  break;
-
1610  }
-
1611 
-
1612  case value_t::array:
-
1613  {
-
1614  m_value.array = create<array_t>(first.m_it.array_iterator, last.m_it.array_iterator);
-
1615  break;
-
1616  }
-
1617 
-
1618  default:
-
1619  {
-
1620  throw std::domain_error("cannot use construct with iterators from " + first.m_object->type_name());
+
1590  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
+
1591  {
+
1592  throw std::out_of_range("iterators out of range");
+
1593  }
+
1594  break;
+
1595  }
+
1596 
+
1597  default:
+
1598  {
+
1599  break;
+
1600  }
+
1601  }
+
1602 
+
1603  switch (m_type)
+
1604  {
+ +
1606  {
+
1607  m_value.number_integer = first.m_object->m_value.number_integer;
+
1608  break;
+
1609  }
+
1610 
+
1611  case value_t::number_float:
+
1612  {
+
1613  m_value.number_float = first.m_object->m_value.number_float;
+
1614  break;
+
1615  }
+
1616 
+
1617  case value_t::boolean:
+
1618  {
+
1619  m_value.boolean = first.m_object->m_value.boolean;
+
1620  break;
1621  }
-
1622  }
-
1623  }
-
1624 
-
1626  // other constructors and destructor //
-
1628 
-
1649  basic_json(const basic_json& other)
-
1650  : m_type(other.m_type)
-
1651  {
-
1652  switch (m_type)
-
1653  {
-
1654  case value_t::object:
-
1655  {
-
1656  m_value = *other.m_value.object;
-
1657  break;
-
1658  }
-
1659 
-
1660  case value_t::array:
-
1661  {
-
1662  m_value = *other.m_value.array;
-
1663  break;
-
1664  }
-
1665 
-
1666  case value_t::string:
-
1667  {
-
1668  m_value = *other.m_value.string;
-
1669  break;
-
1670  }
-
1671 
-
1672  case value_t::boolean:
-
1673  {
-
1674  m_value = other.m_value.boolean;
-
1675  break;
-
1676  }
-
1677 
- -
1679  {
-
1680  m_value = other.m_value.number_integer;
-
1681  break;
-
1682  }
-
1683 
-
1684  case value_t::number_float:
-
1685  {
-
1686  m_value = other.m_value.number_float;
-
1687  break;
-
1688  }
-
1689 
-
1690  default:
-
1691  {
+
1622 
+
1623  case value_t::string:
+
1624  {
+
1625  m_value = *first.m_object->m_value.string;
+
1626  break;
+
1627  }
+
1628 
+
1629  case value_t::object:
+
1630  {
+
1631  m_value.object = create<object_t>(first.m_it.object_iterator, last.m_it.object_iterator);
+
1632  break;
+
1633  }
+
1634 
+
1635  case value_t::array:
+
1636  {
+
1637  m_value.array = create<array_t>(first.m_it.array_iterator, last.m_it.array_iterator);
+
1638  break;
+
1639  }
+
1640 
+
1641  default:
+
1642  {
+
1643  throw std::domain_error("cannot use construct with iterators from " + first.m_object->type_name());
+
1644  }
+
1645  }
+
1646  }
+
1647 
+
1649  // other constructors and destructor //
+
1651 
+
1672  basic_json(const basic_json& other)
+
1673  : m_type(other.m_type)
+
1674  {
+
1675  switch (m_type)
+
1676  {
+
1677  case value_t::object:
+
1678  {
+
1679  m_value = *other.m_value.object;
+
1680  break;
+
1681  }
+
1682 
+
1683  case value_t::array:
+
1684  {
+
1685  m_value = *other.m_value.array;
+
1686  break;
+
1687  }
+
1688 
+
1689  case value_t::string:
+
1690  {
+
1691  m_value = *other.m_value.string;
1692  break;
1693  }
-
1694  }
-
1695  }
-
1696 
-
1715  basic_json(basic_json&& other) noexcept
-
1716  : m_type(std::move(other.m_type)),
-
1717  m_value(std::move(other.m_value))
-
1718  {
-
1719  // invalidate payload
-
1720  other.m_type = value_t::null;
-
1721  other.m_value = {};
-
1722  }
-
1723 
-
1743  reference& operator=(basic_json other) noexcept (
-
1744  std::is_nothrow_move_constructible<value_t>::value and
-
1745  std::is_nothrow_move_assignable<value_t>::value and
-
1746  std::is_nothrow_move_constructible<json_value>::value and
-
1747  std::is_nothrow_move_assignable<json_value>::value
-
1748  )
-
1749  {
-
1750  using std::swap;
-
1751  swap(m_type, other.m_type);
-
1752  swap(m_value, other.m_value);
-
1753  return *this;
-
1754  }
-
1755 
- -
1770  {
-
1771  switch (m_type)
-
1772  {
-
1773  case value_t::object:
-
1774  {
-
1775  AllocatorType<object_t> alloc;
-
1776  alloc.destroy(m_value.object);
-
1777  alloc.deallocate(m_value.object, 1);
-
1778  break;
-
1779  }
+
1694 
+
1695  case value_t::boolean:
+
1696  {
+
1697  m_value = other.m_value.boolean;
+
1698  break;
+
1699  }
+
1700 
+ +
1702  {
+
1703  m_value = other.m_value.number_integer;
+
1704  break;
+
1705  }
+
1706 
+
1707  case value_t::number_float:
+
1708  {
+
1709  m_value = other.m_value.number_float;
+
1710  break;
+
1711  }
+
1712 
+
1713  default:
+
1714  {
+
1715  break;
+
1716  }
+
1717  }
+
1718  }
+
1719 
+
1738  basic_json(basic_json&& other) noexcept
+
1739  : m_type(std::move(other.m_type)),
+
1740  m_value(std::move(other.m_value))
+
1741  {
+
1742  // invalidate payload
+
1743  other.m_type = value_t::null;
+
1744  other.m_value = {};
+
1745  }
+
1746 
+
1768  reference& operator=(basic_json other) noexcept (
+
1769  std::is_nothrow_move_constructible<value_t>::value and
+
1770  std::is_nothrow_move_assignable<value_t>::value and
+
1771  std::is_nothrow_move_constructible<json_value>::value and
+
1772  std::is_nothrow_move_assignable<json_value>::value
+
1773  )
+
1774  {
+
1775  using std::swap;
+
1776  swap(m_type, other.m_type);
+
1777  swap(m_value, other.m_value);
+
1778  return *this;
+
1779  }
1780 
-
1781  case value_t::array:
-
1782  {
-
1783  AllocatorType<array_t> alloc;
-
1784  alloc.destroy(m_value.array);
-
1785  alloc.deallocate(m_value.array, 1);
-
1786  break;
-
1787  }
-
1788 
-
1789  case value_t::string:
-
1790  {
-
1791  AllocatorType<string_t> alloc;
-
1792  alloc.destroy(m_value.string);
-
1793  alloc.deallocate(m_value.string, 1);
-
1794  break;
-
1795  }
-
1796 
-
1797  default:
-
1798  {
-
1799  // all other types need no specific destructor
-
1800  break;
-
1801  }
-
1802  }
-
1803  }
-
1804 
+ +
1795  {
+
1796  switch (m_type)
+
1797  {
+
1798  case value_t::object:
+
1799  {
+
1800  AllocatorType<object_t> alloc;
+
1801  alloc.destroy(m_value.object);
+
1802  alloc.deallocate(m_value.object, 1);
+
1803  break;
+
1804  }
1805 
-
1806  public:
-
1808  // object inspection //
-
1810 
+
1806  case value_t::array:
+
1807  {
+
1808  AllocatorType<array_t> alloc;
+
1809  alloc.destroy(m_value.array);
+
1810  alloc.deallocate(m_value.array, 1);
+
1811  break;
+
1812  }
1813 
-
1835  string_t dump(const int indent = -1) const
-
1836  {
-
1837  std::stringstream ss;
-
1838 
-
1839  if (indent >= 0)
-
1840  {
-
1841  dump(ss, true, static_cast<unsigned int>(indent));
-
1842  }
-
1843  else
-
1844  {
-
1845  dump(ss, false, 0);
-
1846  }
-
1847 
-
1848  return ss.str();
-
1849  }
-
1850 
-
1864  value_t type() const noexcept
-
1865  {
-
1866  return m_type;
-
1867  }
-
1868 
-
1883  bool is_primitive() const noexcept
-
1884  {
-
1885  return is_null() or is_string() or is_boolean() or is_number();
-
1886  }
-
1887 
-
1901  bool is_structured() const noexcept
-
1902  {
-
1903  return is_array() or is_object();
-
1904  }
-
1905 
-
1918  bool is_null() const noexcept
-
1919  {
-
1920  return m_type == value_t::null;
-
1921  }
-
1922 
-
1935  bool is_boolean() const noexcept
+
1814  case value_t::string:
+
1815  {
+
1816  AllocatorType<string_t> alloc;
+
1817  alloc.destroy(m_value.string);
+
1818  alloc.deallocate(m_value.string, 1);
+
1819  break;
+
1820  }
+
1821 
+
1822  default:
+
1823  {
+
1824  // all other types need no specific destructor
+
1825  break;
+
1826  }
+
1827  }
+
1828  }
+
1829 
+
1831 
+
1832  public:
+
1834  // object inspection //
+
1836 
+
1839 
+
1863  string_t dump(const int indent = -1) const
+
1864  {
+
1865  std::stringstream ss;
+
1866 
+
1867  if (indent >= 0)
+
1868  {
+
1869  dump(ss, true, static_cast<unsigned int>(indent));
+
1870  }
+
1871  else
+
1872  {
+
1873  dump(ss, false, 0);
+
1874  }
+
1875 
+
1876  return ss.str();
+
1877  }
+
1878 
+
1894  value_t type() const noexcept
+
1895  {
+
1896  return m_type;
+
1897  }
+
1898 
+
1915  bool is_primitive() const noexcept
+
1916  {
+
1917  return is_null() or is_string() or is_boolean() or is_number();
+
1918  }
+
1919 
+
1935  bool is_structured() const noexcept
1936  {
-
1937  return m_type == value_t::boolean;
+
1937  return is_array() or is_object();
1938  }
1939 
-
1953  bool is_number() const noexcept
-
1954  {
-
1955  return is_number_integer() or is_number_float();
-
1956  }
-
1957 
-
1971  bool is_number_integer() const noexcept
-
1972  {
-
1973  return m_type == value_t::number_integer;
-
1974  }
-
1975 
-
1989  bool is_number_float() const noexcept
-
1990  {
-
1991  return m_type == value_t::number_float;
-
1992  }
-
1993 
-
2006  bool is_object() const noexcept
-
2007  {
-
2008  return m_type == value_t::object;
-
2009  }
-
2010 
-
2023  bool is_array() const noexcept
-
2024  {
-
2025  return m_type == value_t::array;
-
2026  }
-
2027 
-
2040  bool is_string() const noexcept
-
2041  {
-
2042  return m_type == value_t::string;
-
2043  }
-
2044 
-
2062  bool is_discarded() const noexcept
+
1954  bool is_null() const noexcept
+
1955  {
+
1956  return m_type == value_t::null;
+
1957  }
+
1958 
+
1973  bool is_boolean() const noexcept
+
1974  {
+
1975  return m_type == value_t::boolean;
+
1976  }
+
1977 
+
1997  bool is_number() const noexcept
+
1998  {
+
1999  return is_number_integer() or is_number_float();
+
2000  }
+
2001 
+
2020  bool is_number_integer() const noexcept
+
2021  {
+
2022  return m_type == value_t::number_integer;
+
2023  }
+
2024 
+
2043  bool is_number_float() const noexcept
+
2044  {
+
2045  return m_type == value_t::number_float;
+
2046  }
+
2047 
+
2062  bool is_object() const noexcept
2063  {
-
2064  return m_type == value_t::discarded;
+
2064  return m_type == value_t::object;
2065  }
2066 
-
2080  operator value_t() const noexcept
-
2081  {
-
2082  return m_type;
-
2083  }
-
2084 
-
2086 
-
2087  private:
-
2089  // value access //
-
2091 
-
2093  template <class T, typename
-
2094  std::enable_if<
-
2095  std::is_convertible<typename object_t::key_type, typename T::key_type>::value and
-
2096  std::is_convertible<basic_json_t, typename T::mapped_type>::value
-
2097  , int>::type = 0>
-
2098  T get_impl(T*) const
-
2099  {
-
2100  if (is_object())
-
2101  {
-
2102  return T(m_value.object->begin(), m_value.object->end());
-
2103  }
-
2104  else
-
2105  {
-
2106  throw std::domain_error("type must be object, but is " + type_name());
-
2107  }
-
2108  }
-
2109 
-
2111  object_t get_impl(object_t*) const
-
2112  {
-
2113  if (is_object())
-
2114  {
-
2115  return *(m_value.object);
-
2116  }
-
2117  else
-
2118  {
-
2119  throw std::domain_error("type must be object, but is " + type_name());
-
2120  }
-
2121  }
-
2122 
-
2124  template <class T, typename
-
2125  std::enable_if<
-
2126  std::is_convertible<basic_json_t, typename T::value_type>::value and
-
2127  not std::is_same<basic_json_t, typename T::value_type>::value and
-
2128  not std::is_arithmetic<T>::value and
-
2129  not std::is_convertible<std::string, T>::value and
-
2130  not has_mapped_type<T>::value
-
2131  , int>::type = 0>
-
2132  T get_impl(T*) const
-
2133  {
-
2134  if (is_array())
-
2135  {
-
2136  T to_vector;
-
2137  std::transform(m_value.array->begin(), m_value.array->end(),
-
2138  std::inserter(to_vector, to_vector.end()), [](basic_json i)
-
2139  {
-
2140  return i.get<typename T::value_type>();
-
2141  });
-
2142  return to_vector;
-
2143  }
-
2144  else
-
2145  {
-
2146  throw std::domain_error("type must be array, but is " + type_name());
-
2147  }
-
2148  }
-
2149 
-
2151  template <class T, typename
-
2152  std::enable_if<
-
2153  std::is_convertible<basic_json_t, T>::value and
-
2154  not std::is_same<basic_json_t, T>::value
-
2155  , int>::type = 0>
-
2156  std::vector<T> get_impl(std::vector<T>*) const
-
2157  {
-
2158  if (is_array())
-
2159  {
-
2160  std::vector<T> to_vector;
-
2161  to_vector.reserve(m_value.array->size());
-
2162  std::transform(m_value.array->begin(), m_value.array->end(),
-
2163  std::inserter(to_vector, to_vector.end()), [](basic_json i)
-
2164  {
-
2165  return i.get<T>();
-
2166  });
-
2167  return to_vector;
-
2168  }
-
2169  else
-
2170  {
-
2171  throw std::domain_error("type must be array, but is " + type_name());
-
2172  }
-
2173  }
-
2174 
-
2176  template <class T, typename
-
2177  std::enable_if<
-
2178  std::is_same<basic_json, typename T::value_type>::value and
-
2179  not has_mapped_type<T>::value
-
2180  , int>::type = 0>
-
2181  T get_impl(T*) const
-
2182  {
-
2183  if (is_array())
-
2184  {
-
2185  return T(m_value.array->begin(), m_value.array->end());
-
2186  }
-
2187  else
-
2188  {
-
2189  throw std::domain_error("type must be array, but is " + type_name());
-
2190  }
-
2191  }
-
2192 
-
2194  array_t get_impl(array_t*) const
-
2195  {
-
2196  if (is_array())
-
2197  {
-
2198  return *(m_value.array);
-
2199  }
-
2200  else
-
2201  {
-
2202  throw std::domain_error("type must be array, but is " + type_name());
-
2203  }
-
2204  }
-
2205 
-
2207  template <typename T, typename
-
2208  std::enable_if<
-
2209  std::is_convertible<string_t, T>::value
-
2210  , int>::type = 0>
-
2211  T get_impl(T*) const
-
2212  {
-
2213  if (is_string())
-
2214  {
-
2215  return *m_value.string;
-
2216  }
-
2217  else
-
2218  {
-
2219  throw std::domain_error("type must be string, but is " + type_name());
-
2220  }
-
2221  }
-
2222 
-
2224  template<typename T, typename
-
2225  std::enable_if<
-
2226  std::is_arithmetic<T>::value
-
2227  , int>::type = 0>
-
2228  T get_impl(T*) const
-
2229  {
-
2230  switch (m_type)
-
2231  {
- -
2233  {
-
2234  return static_cast<T>(m_value.number_integer);
-
2235  }
-
2236 
-
2237  case value_t::number_float:
-
2238  {
-
2239  return static_cast<T>(m_value.number_float);
-
2240  }
+
2081  bool is_array() const noexcept
+
2082  {
+
2083  return m_type == value_t::array;
+
2084  }
+
2085 
+
2100  bool is_string() const noexcept
+
2101  {
+
2102  return m_type == value_t::string;
+
2103  }
+
2104 
+
2124  bool is_discarded() const noexcept
+
2125  {
+
2126  return m_type == value_t::discarded;
+
2127  }
+
2128 
+
2144  operator value_t() const noexcept
+
2145  {
+
2146  return m_type;
+
2147  }
+
2148 
+
2150 
+
2151  private:
+
2153  // value access //
+
2155 
+
2157  template <class T, typename
+
2158  std::enable_if<
+
2159  std::is_convertible<typename object_t::key_type, typename T::key_type>::value and
+
2160  std::is_convertible<basic_json_t, typename T::mapped_type>::value
+
2161  , int>::type = 0>
+
2162  T get_impl(T*) const
+
2163  {
+
2164  return is_object()
+
2165  ? T(m_value.object->begin(), m_value.object->end())
+
2166  : throw std::domain_error("type must be object, but is " + type_name());
+
2167  }
+
2168 
+
2170  object_t get_impl(object_t*) const
+
2171  {
+
2172  return is_object()
+
2173  ? *(m_value.object)
+
2174  : throw std::domain_error("type must be object, but is " + type_name());
+
2175  }
+
2176 
+
2178  template <class T, typename
+
2179  std::enable_if<
+
2180  std::is_convertible<basic_json_t, typename T::value_type>::value and
+
2181  not std::is_same<basic_json_t, typename T::value_type>::value and
+
2182  not std::is_arithmetic<T>::value and
+
2183  not std::is_convertible<std::string, T>::value and
+
2184  not has_mapped_type<T>::value
+
2185  , int>::type = 0>
+
2186  T get_impl(T*) const
+
2187  {
+
2188  if (is_array())
+
2189  {
+
2190  T to_vector;
+
2191  std::transform(m_value.array->begin(), m_value.array->end(),
+
2192  std::inserter(to_vector, to_vector.end()), [](basic_json i)
+
2193  {
+
2194  return i.get<typename T::value_type>();
+
2195  });
+
2196  return to_vector;
+
2197  }
+
2198  else
+
2199  {
+
2200  throw std::domain_error("type must be array, but is " + type_name());
+
2201  }
+
2202  }
+
2203 
+
2205  template <class T, typename
+
2206  std::enable_if<
+
2207  std::is_convertible<basic_json_t, T>::value and
+
2208  not std::is_same<basic_json_t, T>::value
+
2209  , int>::type = 0>
+
2210  std::vector<T> get_impl(std::vector<T>*) const
+
2211  {
+
2212  if (is_array())
+
2213  {
+
2214  std::vector<T> to_vector;
+
2215  to_vector.reserve(m_value.array->size());
+
2216  std::transform(m_value.array->begin(), m_value.array->end(),
+
2217  std::inserter(to_vector, to_vector.end()), [](basic_json i)
+
2218  {
+
2219  return i.get<T>();
+
2220  });
+
2221  return to_vector;
+
2222  }
+
2223  else
+
2224  {
+
2225  throw std::domain_error("type must be array, but is " + type_name());
+
2226  }
+
2227  }
+
2228 
+
2230  template <class T, typename
+
2231  std::enable_if<
+
2232  std::is_same<basic_json, typename T::value_type>::value and
+
2233  not has_mapped_type<T>::value
+
2234  , int>::type = 0>
+
2235  T get_impl(T*) const
+
2236  {
+
2237  return is_array()
+
2238  ? T(m_value.array->begin(), m_value.array->end())
+
2239  : throw std::domain_error("type must be array, but is " + type_name());
+
2240  }
2241 
-
2242  default:
-
2243  {
-
2244  throw std::domain_error("type must be number, but is " + type_name());
-
2245  }
-
2246  }
-
2247  }
-
2248 
-
2250  boolean_t get_impl(boolean_t*) const
-
2251  {
-
2252  if (is_boolean())
-
2253  {
-
2254  return m_value.boolean;
-
2255  }
-
2256  else
-
2257  {
-
2258  throw std::domain_error("type must be boolean, but is " + type_name());
-
2259  }
+
2243  array_t get_impl(array_t*) const
+
2244  {
+
2245  return is_array()
+
2246  ? *(m_value.array)
+
2247  : throw std::domain_error("type must be array, but is " + type_name());
+
2248  }
+
2249 
+
2251  template <typename T, typename
+
2252  std::enable_if<
+
2253  std::is_convertible<string_t, T>::value
+
2254  , int>::type = 0>
+
2255  T get_impl(T*) const
+
2256  {
+
2257  return is_string()
+
2258  ? *m_value.string
+
2259  : throw std::domain_error("type must be string, but is " + type_name());
2260  }
2261 
-
2263  object_t* get_impl_ptr(object_t*) noexcept
-
2264  {
-
2265  return is_object() ? m_value.object : nullptr;
-
2266  }
-
2267 
-
2269  const object_t* get_impl_ptr(const object_t*) const noexcept
-
2270  {
-
2271  return is_object() ? m_value.object : nullptr;
-
2272  }
-
2273 
-
2275  array_t* get_impl_ptr(array_t*) noexcept
-
2276  {
-
2277  return is_array() ? m_value.array : nullptr;
-
2278  }
-
2279 
-
2281  const array_t* get_impl_ptr(const array_t*) const noexcept
-
2282  {
-
2283  return is_array() ? m_value.array : nullptr;
-
2284  }
-
2285 
-
2287  string_t* get_impl_ptr(string_t*) noexcept
-
2288  {
-
2289  return is_string() ? m_value.string : nullptr;
-
2290  }
-
2291 
-
2293  const string_t* get_impl_ptr(const string_t*) const noexcept
-
2294  {
-
2295  return is_string() ? m_value.string : nullptr;
-
2296  }
-
2297 
-
2299  boolean_t* get_impl_ptr(boolean_t*) noexcept
-
2300  {
-
2301  return is_boolean() ? &m_value.boolean : nullptr;
-
2302  }
-
2303 
-
2305  const boolean_t* get_impl_ptr(const boolean_t*) const noexcept
-
2306  {
-
2307  return is_boolean() ? &m_value.boolean : nullptr;
-
2308  }
-
2309 
-
2311  number_integer_t* get_impl_ptr(number_integer_t*) noexcept
-
2312  {
-
2313  return is_number_integer() ? &m_value.number_integer : nullptr;
-
2314  }
-
2315 
-
2317  const number_integer_t* get_impl_ptr(const number_integer_t*) const noexcept
-
2318  {
-
2319  return is_number_integer() ? &m_value.number_integer : nullptr;
-
2320  }
-
2321 
-
2323  number_float_t* get_impl_ptr(number_float_t*) noexcept
-
2324  {
-
2325  return is_number_float() ? &m_value.number_float : nullptr;
-
2326  }
-
2327 
-
2329  const number_float_t* get_impl_ptr(const number_float_t*) const noexcept
-
2330  {
-
2331  return is_number_float() ? &m_value.number_float : nullptr;
-
2332  }
-
2333 
-
2334  public:
-
2335 
-
2338 
-
2370  template<typename ValueType, typename
-
2371  std::enable_if<
-
2372  not std::is_pointer<ValueType>::value
-
2373  , int>::type = 0>
-
2374  ValueType get() const
-
2375  {
-
2376  return get_impl(static_cast<ValueType*>(nullptr));
-
2377  }
-
2378 
-
2404  template<typename PointerType, typename
-
2405  std::enable_if<
-
2406  std::is_pointer<PointerType>::value
-
2407  , int>::type = 0>
-
2408  PointerType get() noexcept
-
2409  {
-
2410  // delegate the call to get_ptr
-
2411  return get_ptr<PointerType>();
-
2412  }
-
2413 
-
2418  template<typename PointerType, typename
-
2419  std::enable_if<
-
2420  std::is_pointer<PointerType>::value
-
2421  , int>::type = 0>
-
2422  const PointerType get() const noexcept
-
2423  {
-
2424  // delegate the call to get_ptr
-
2425  return get_ptr<PointerType>();
-
2426  }
-
2427 
-
2451  template<typename PointerType, typename
-
2452  std::enable_if<
-
2453  std::is_pointer<PointerType>::value
-
2454  , int>::type = 0>
-
2455  PointerType get_ptr() noexcept
-
2456  {
-
2457  // delegate the call to get_impl_ptr<>()
-
2458  return get_impl_ptr(static_cast<PointerType>(nullptr));
-
2459  }
-
2460 
-
2465  template<typename PointerType, typename
-
2466  std::enable_if<
-
2467  std::is_pointer<PointerType>::value
-
2468  and std::is_const<typename std::remove_pointer<PointerType>::type>::value
-
2469  , int>::type = 0>
-
2470  const PointerType get_ptr() const noexcept
-
2471  {
-
2472  // delegate the call to get_impl_ptr<>() const
-
2473  return get_impl_ptr(static_cast<const PointerType>(nullptr));
-
2474  }
-
2475 
-
2500  template<typename ValueType, typename
-
2501  std::enable_if<
-
2502  not std::is_pointer<ValueType>::value
-
2503  , int>::type = 0>
-
2504  operator ValueType() const
-
2505  {
-
2506  // delegate the call to get<>() const
-
2507  return get<ValueType>();
-
2508  }
-
2509 
-
2511 
-
2512 
-
2514  // element access //
-
2516 
-
2519 
- -
2540  {
-
2541  // at only works for arrays
-
2542  if (is_array())
-
2543  {
-
2544  return m_value.array->at(idx);
-
2545  }
-
2546  else
-
2547  {
-
2548  throw std::domain_error("cannot use at() with " + type_name());
-
2549  }
-
2550  }
-
2551 
- -
2572  {
-
2573  // at only works for arrays
-
2574  if (is_array())
-
2575  {
-
2576  return m_value.array->at(idx);
-
2577  }
-
2578  else
-
2579  {
-
2580  throw std::domain_error("cannot use at() with " + type_name());
-
2581  }
-
2582  }
-
2583 
-
2607  reference at(const typename object_t::key_type& key)
-
2608  {
-
2609  // at only works for objects
-
2610  if (is_object())
-
2611  {
-
2612  return m_value.object->at(key);
-
2613  }
-
2614  else
-
2615  {
-
2616  throw std::domain_error("cannot use at() with " + type_name());
-
2617  }
-
2618  }
-
2619 
-
2643  const_reference at(const typename object_t::key_type& key) const
-
2644  {
-
2645  // at only works for objects
-
2646  if (is_object())
-
2647  {
-
2648  return m_value.object->at(key);
-
2649  }
-
2650  else
-
2651  {
-
2652  throw std::domain_error("cannot use at() with " + type_name());
-
2653  }
-
2654  }
-
2655 
- -
2679  {
-
2680  // implicitly convert null to object
-
2681  if (is_null())
-
2682  {
-
2683  m_type = value_t::array;
-
2684  m_value.array = create<array_t>();
-
2685  }
-
2686 
-
2687  // [] only works for arrays
-
2688  if (is_array())
-
2689  {
-
2690  for (size_t i = m_value.array->size(); i <= idx; ++i)
-
2691  {
-
2692  m_value.array->push_back(basic_json());
-
2693  }
-
2694 
-
2695  return m_value.array->operator[](idx);
-
2696  }
-
2697  else
-
2698  {
-
2699  throw std::domain_error("cannot use operator[] with " + type_name());
-
2700  }
-
2701  }
-
2702 
- -
2720  {
-
2721  // at only works for arrays
-
2722  if (is_array())
-
2723  {
-
2724  return m_value.array->operator[](idx);
-
2725  }
-
2726  else
-
2727  {
-
2728  throw std::domain_error("cannot use operator[] with " + type_name());
-
2729  }
-
2730  }
-
2731 
-
2756  reference operator[](const typename object_t::key_type& key)
-
2757  {
-
2758  // implicitly convert null to object
-
2759  if (is_null())
-
2760  {
-
2761  m_type = value_t::object;
-
2762  m_value.object = create<object_t>();
-
2763  }
-
2764 
-
2765  // [] only works for objects
-
2766  if (is_object())
-
2767  {
-
2768  return m_value.object->operator[](key);
-
2769  }
-
2770  else
-
2771  {
-
2772  throw std::domain_error("cannot use operator[] with " + type_name());
-
2773  }
-
2774  }
-
2775 
-
2802  template<typename T, std::size_t n>
-
2803  reference operator[](const T (&key)[n])
-
2804  {
-
2805  // implicitly convert null to object
-
2806  if (is_null())
-
2807  {
-
2808  m_type = value_t::object;
-
2809  m_value = value_t::object;
-
2810  }
-
2811 
-
2812  // at only works for objects
-
2813  if (is_object())
-
2814  {
-
2815  return m_value.object->operator[](key);
-
2816  }
-
2817  else
-
2818  {
-
2819  throw std::domain_error("cannot use operator[] with " + type_name());
-
2820  }
-
2821  }
-
2822 
-
2868  template <class ValueType, typename
-
2869  std::enable_if<
-
2870  std::is_convertible<basic_json_t, ValueType>::value
-
2871  , int>::type = 0>
-
2872  ValueType value(const typename object_t::key_type& key, ValueType default_value) const
-
2873  {
-
2874  // at only works for objects
-
2875  if (is_object())
-
2876  {
-
2877  // if key is found, return value and given default value otherwise
-
2878  const auto it = find(key);
-
2879  if (it != end())
-
2880  {
-
2881  return *it;
-
2882  }
-
2883  else
-
2884  {
-
2885  return default_value;
-
2886  }
-
2887  }
-
2888  else
-
2889  {
-
2890  throw std::domain_error("cannot use value() with " + type_name());
-
2891  }
-
2892  }
-
2893 
-
2898  string_t value(const typename object_t::key_type& key, const char* default_value) const
-
2899  {
-
2900  return value(key, string_t(default_value));
-
2901  }
-
2902 
- -
2922  {
-
2923  return *begin();
-
2924  }
-
2925 
- -
2930  {
-
2931  return *cbegin();
-
2932  }
-
2933 
- -
2954  {
-
2955  auto tmp = end();
-
2956  --tmp;
-
2957  return *tmp;
+
2263  template<typename T, typename
+
2264  std::enable_if<
+
2265  std::is_arithmetic<T>::value
+
2266  , int>::type = 0>
+
2267  T get_impl(T*) const
+
2268  {
+
2269  switch (m_type)
+
2270  {
+ +
2272  {
+
2273  return static_cast<T>(m_value.number_integer);
+
2274  }
+
2275 
+
2276  case value_t::number_float:
+
2277  {
+
2278  return static_cast<T>(m_value.number_float);
+
2279  }
+
2280 
+
2281  default:
+
2282  {
+
2283  throw std::domain_error("type must be number, but is " + type_name());
+
2284  }
+
2285  }
+
2286  }
+
2287 
+
2289  boolean_t get_impl(boolean_t*) const
+
2290  {
+
2291  return is_boolean()
+
2292  ? m_value.boolean
+
2293  : throw std::domain_error("type must be boolean, but is " + type_name());
+
2294  }
+
2295 
+
2297  object_t* get_impl_ptr(object_t*) noexcept
+
2298  {
+
2299  return is_object() ? m_value.object : nullptr;
+
2300  }
+
2301 
+
2303  const object_t* get_impl_ptr(const object_t*) const noexcept
+
2304  {
+
2305  return is_object() ? m_value.object : nullptr;
+
2306  }
+
2307 
+
2309  array_t* get_impl_ptr(array_t*) noexcept
+
2310  {
+
2311  return is_array() ? m_value.array : nullptr;
+
2312  }
+
2313 
+
2315  const array_t* get_impl_ptr(const array_t*) const noexcept
+
2316  {
+
2317  return is_array() ? m_value.array : nullptr;
+
2318  }
+
2319 
+
2321  string_t* get_impl_ptr(string_t*) noexcept
+
2322  {
+
2323  return is_string() ? m_value.string : nullptr;
+
2324  }
+
2325 
+
2327  const string_t* get_impl_ptr(const string_t*) const noexcept
+
2328  {
+
2329  return is_string() ? m_value.string : nullptr;
+
2330  }
+
2331 
+
2333  boolean_t* get_impl_ptr(boolean_t*) noexcept
+
2334  {
+
2335  return is_boolean() ? &m_value.boolean : nullptr;
+
2336  }
+
2337 
+
2339  const boolean_t* get_impl_ptr(const boolean_t*) const noexcept
+
2340  {
+
2341  return is_boolean() ? &m_value.boolean : nullptr;
+
2342  }
+
2343 
+
2345  number_integer_t* get_impl_ptr(number_integer_t*) noexcept
+
2346  {
+
2347  return is_number_integer() ? &m_value.number_integer : nullptr;
+
2348  }
+
2349 
+
2351  const number_integer_t* get_impl_ptr(const number_integer_t*) const noexcept
+
2352  {
+
2353  return is_number_integer() ? &m_value.number_integer : nullptr;
+
2354  }
+
2355 
+
2357  number_float_t* get_impl_ptr(number_float_t*) noexcept
+
2358  {
+
2359  return is_number_float() ? &m_value.number_float : nullptr;
+
2360  }
+
2361 
+
2363  const number_float_t* get_impl_ptr(const number_float_t*) const noexcept
+
2364  {
+
2365  return is_number_float() ? &m_value.number_float : nullptr;
+
2366  }
+
2367 
+
2368  public:
+
2369 
+
2372 
+
2406  template<typename ValueType, typename
+
2407  std::enable_if<
+
2408  not std::is_pointer<ValueType>::value
+
2409  , int>::type = 0>
+
2410  ValueType get() const
+
2411  {
+
2412  return get_impl(static_cast<ValueType*>(nullptr));
+
2413  }
+
2414 
+
2441  template<typename PointerType, typename
+
2442  std::enable_if<
+
2443  std::is_pointer<PointerType>::value
+
2444  , int>::type = 0>
+
2445  PointerType get() noexcept
+
2446  {
+
2447  // delegate the call to get_ptr
+
2448  return get_ptr<PointerType>();
+
2449  }
+
2450 
+
2455  template<typename PointerType, typename
+
2456  std::enable_if<
+
2457  std::is_pointer<PointerType>::value
+
2458  , int>::type = 0>
+
2459  const PointerType get() const noexcept
+
2460  {
+
2461  // delegate the call to get_ptr
+
2462  return get_ptr<PointerType>();
+
2463  }
+
2464 
+
2490  template<typename PointerType, typename
+
2491  std::enable_if<
+
2492  std::is_pointer<PointerType>::value
+
2493  , int>::type = 0>
+
2494  PointerType get_ptr() noexcept
+
2495  {
+
2496  // delegate the call to get_impl_ptr<>()
+
2497  return get_impl_ptr(static_cast<PointerType>(nullptr));
+
2498  }
+
2499 
+
2504  template<typename PointerType, typename
+
2505  std::enable_if<
+
2506  std::is_pointer<PointerType>::value
+
2507  and std::is_const<typename std::remove_pointer<PointerType>::type>::value
+
2508  , int>::type = 0>
+
2509  const PointerType get_ptr() const noexcept
+
2510  {
+
2511  // delegate the call to get_impl_ptr<>() const
+
2512  return get_impl_ptr(static_cast<const PointerType>(nullptr));
+
2513  }
+
2514 
+
2541  template<typename ValueType, typename
+
2542  std::enable_if<
+
2543  not std::is_pointer<ValueType>::value
+
2544  , int>::type = 0>
+
2545  operator ValueType() const
+
2546  {
+
2547  // delegate the call to get<>() const
+
2548  return get<ValueType>();
+
2549  }
+
2550 
+
2552 
+
2553 
+
2555  // element access //
+
2557 
+
2560 
+ +
2583  {
+
2584  // at only works for arrays
+
2585  return is_array()
+
2586  ? m_value.array->at(idx)
+
2587  : throw std::domain_error("cannot use at() with " + type_name());
+
2588  }
+
2589 
+ +
2612  {
+
2613  // at only works for arrays
+
2614  return is_array()
+
2615  ? m_value.array->at(idx)
+
2616  : throw std::domain_error("cannot use at() with " + type_name());
+
2617  }
+
2618 
+
2644  reference at(const typename object_t::key_type& key)
+
2645  {
+
2646  // at only works for objects
+
2647  return is_object()
+
2648  ? m_value.object->at(key)
+
2649  : throw std::domain_error("cannot use at() with " + type_name());
+
2650  }
+
2651 
+
2677  const_reference at(const typename object_t::key_type& key) const
+
2678  {
+
2679  // at only works for objects
+
2680  return is_object()
+
2681  ? m_value.object->at(key)
+
2682  : throw std::domain_error("cannot use at() with " + type_name());
+
2683  }
+
2684 
+ +
2710  {
+
2711  // implicitly convert null to object
+
2712  if (is_null())
+
2713  {
+
2714  m_type = value_t::array;
+
2715  m_value.array = create<array_t>();
+
2716  }
+
2717 
+
2718  // [] only works for arrays
+
2719  if (is_array())
+
2720  {
+
2721  for (size_t i = m_value.array->size(); i <= idx; ++i)
+
2722  {
+
2723  m_value.array->push_back(basic_json());
+
2724  }
+
2725 
+
2726  return m_value.array->operator[](idx);
+
2727  }
+
2728  else
+
2729  {
+
2730  throw std::domain_error("cannot use operator[] with " + type_name());
+
2731  }
+
2732  }
+
2733 
+ +
2753  {
+
2754  // at only works for arrays
+
2755  return is_array()
+
2756  ? m_value.array->operator[](idx)
+
2757  : throw std::domain_error("cannot use operator[] with " + type_name());
+
2758  }
+
2759 
+
2786  reference operator[](const typename object_t::key_type& key)
+
2787  {
+
2788  // implicitly convert null to object
+
2789  if (is_null())
+
2790  {
+
2791  m_type = value_t::object;
+
2792  m_value.object = create<object_t>();
+
2793  }
+
2794 
+
2795  // [] only works for objects
+
2796  return is_object()
+
2797  ? m_value.object->operator[](key)
+
2798  : throw std::domain_error("cannot use operator[] with " + type_name());
+
2799  }
+
2800 
+
2829  template<typename T, std::size_t n>
+
2830  reference operator[](const T (&key)[n])
+
2831  {
+
2832  // implicitly convert null to object
+
2833  if (is_null())
+
2834  {
+
2835  m_type = value_t::object;
+
2836  m_value = value_t::object;
+
2837  }
+
2838 
+
2839  // at only works for objects
+
2840  return is_object()
+
2841  ? m_value.object->operator[](key)
+
2842  : throw std::domain_error("cannot use operator[] with " + type_name());
+
2843  }
+
2844 
+
2892  template <class ValueType, typename
+
2893  std::enable_if<
+
2894  std::is_convertible<basic_json_t, ValueType>::value
+
2895  , int>::type = 0>
+
2896  ValueType value(const typename object_t::key_type& key, ValueType default_value) const
+
2897  {
+
2898  // at only works for objects
+
2899  if (is_object())
+
2900  {
+
2901  // if key is found, return value and given default value otherwise
+
2902  const auto it = find(key);
+
2903  if (it != end())
+
2904  {
+
2905  return *it;
+
2906  }
+
2907  else
+
2908  {
+
2909  return default_value;
+
2910  }
+
2911  }
+
2912  else
+
2913  {
+
2914  throw std::domain_error("cannot use value() with " + type_name());
+
2915  }
+
2916  }
+
2917 
+
2922  string_t value(const typename object_t::key_type& key, const char* default_value) const
+
2923  {
+
2924  return value(key, string_t(default_value));
+
2925  }
+
2926 
+ +
2948  {
+
2949  return *begin();
+
2950  }
+
2951 
+ +
2956  {
+
2957  return *cbegin();
2958  }
2959 
- -
2964  {
-
2965  auto tmp = cend();
-
2966  --tmp;
-
2967  return *tmp;
-
2968  }
-
2969 
-
3003  template <class InteratorType, typename
-
3004  std::enable_if<
-
3005  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
-
3006  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
-
3007  , int>::type
-
3008  = 0>
-
3009  InteratorType erase(InteratorType pos)
-
3010  {
-
3011  // make sure iterator fits the current value
-
3012  if (this != pos.m_object)
-
3013  {
-
3014  throw std::domain_error("iterator does not fit current value");
-
3015  }
-
3016 
-
3017  InteratorType result = end();
-
3018 
-
3019  switch (m_type)
-
3020  {
-
3021  case value_t::boolean:
-
3022  case value_t::number_float:
- -
3024  case value_t::string:
-
3025  {
-
3026  if (not pos.m_it.primitive_iterator.is_begin())
-
3027  {
-
3028  throw std::out_of_range("iterator out of range");
-
3029  }
-
3030 
-
3031  if (is_string())
-
3032  {
-
3033  delete m_value.string;
-
3034  m_value.string = nullptr;
-
3035  }
-
3036 
-
3037  m_type = value_t::null;
-
3038  break;
-
3039  }
-
3040 
-
3041  case value_t::object:
-
3042  {
-
3043  result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
-
3044  break;
-
3045  }
-
3046 
-
3047  case value_t::array:
-
3048  {
-
3049  result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
-
3050  break;
-
3051  }
-
3052 
-
3053  default:
-
3054  {
-
3055  throw std::domain_error("cannot use erase() with " + type_name());
-
3056  }
-
3057  }
-
3058 
-
3059  return result;
-
3060  }
-
3061 
-
3096  template <class InteratorType, typename
-
3097  std::enable_if<
-
3098  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
-
3099  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
-
3100  , int>::type
-
3101  = 0>
-
3102  InteratorType erase(InteratorType first, InteratorType last)
-
3103  {
-
3104  // make sure iterator fits the current value
-
3105  if (this != first.m_object or this != last.m_object)
-
3106  {
-
3107  throw std::domain_error("iterators do not fit current value");
-
3108  }
-
3109 
-
3110  InteratorType result = end();
-
3111 
-
3112  switch (m_type)
-
3113  {
-
3114  case value_t::boolean:
-
3115  case value_t::number_float:
- -
3117  case value_t::string:
-
3118  {
-
3119  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
-
3120  {
-
3121  throw std::out_of_range("iterators out of range");
-
3122  }
-
3123 
-
3124  if (is_string())
-
3125  {
-
3126  delete m_value.string;
-
3127  m_value.string = nullptr;
-
3128  }
-
3129 
-
3130  m_type = value_t::null;
-
3131  break;
-
3132  }
-
3133 
-
3134  case value_t::object:
-
3135  {
-
3136  result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
-
3137  last.m_it.object_iterator);
-
3138  break;
-
3139  }
-
3140 
-
3141  case value_t::array:
-
3142  {
-
3143  result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,
-
3144  last.m_it.array_iterator);
-
3145  break;
-
3146  }
-
3147 
-
3148  default:
-
3149  {
-
3150  throw std::domain_error("cannot use erase with " + type_name());
-
3151  }
-
3152  }
-
3153 
-
3154  return result;
-
3155  }
+ +
2982  {
+
2983  auto tmp = end();
+
2984  --tmp;
+
2985  return *tmp;
+
2986  }
+
2987 
+ +
2992  {
+
2993  auto tmp = cend();
+
2994  --tmp;
+
2995  return *tmp;
+
2996  }
+
2997 
+
3040  template <class InteratorType, typename
+
3041  std::enable_if<
+
3042  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
+
3043  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
+
3044  , int>::type
+
3045  = 0>
+
3046  InteratorType erase(InteratorType pos)
+
3047  {
+
3048  // make sure iterator fits the current value
+
3049  if (this != pos.m_object)
+
3050  {
+
3051  throw std::domain_error("iterator does not fit current value");
+
3052  }
+
3053 
+
3054  InteratorType result = end();
+
3055 
+
3056  switch (m_type)
+
3057  {
+
3058  case value_t::boolean:
+
3059  case value_t::number_float:
+ +
3061  case value_t::string:
+
3062  {
+
3063  if (not pos.m_it.primitive_iterator.is_begin())
+
3064  {
+
3065  throw std::out_of_range("iterator out of range");
+
3066  }
+
3067 
+
3068  if (is_string())
+
3069  {
+
3070  delete m_value.string;
+
3071  m_value.string = nullptr;
+
3072  }
+
3073 
+
3074  m_type = value_t::null;
+
3075  break;
+
3076  }
+
3077 
+
3078  case value_t::object:
+
3079  {
+
3080  result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
+
3081  break;
+
3082  }
+
3083 
+
3084  case value_t::array:
+
3085  {
+
3086  result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
+
3087  break;
+
3088  }
+
3089 
+
3090  default:
+
3091  {
+
3092  throw std::domain_error("cannot use erase() with " + type_name());
+
3093  }
+
3094  }
+
3095 
+
3096  return result;
+
3097  }
+
3098 
+
3141  template <class InteratorType, typename
+
3142  std::enable_if<
+
3143  std::is_same<InteratorType, typename basic_json_t::iterator>::value or
+
3144  std::is_same<InteratorType, typename basic_json_t::const_iterator>::value
+
3145  , int>::type
+
3146  = 0>
+
3147  InteratorType erase(InteratorType first, InteratorType last)
+
3148  {
+
3149  // make sure iterator fits the current value
+
3150  if (this != first.m_object or this != last.m_object)
+
3151  {
+
3152  throw std::domain_error("iterators do not fit current value");
+
3153  }
+
3154 
+
3155  InteratorType result = end();
3156 
-
3174  size_type erase(const typename object_t::key_type& key)
-
3175  {
-
3176  // this erase only works for objects
-
3177  if (is_object())
-
3178  {
-
3179  return m_value.object->erase(key);
-
3180  }
-
3181  else
-
3182  {
-
3183  throw std::domain_error("cannot use erase() with " + type_name());
-
3184  }
-
3185  }
-
3186 
-
3201  void erase(const size_type idx)
-
3202  {
-
3203  // this erase only works for arrays
-
3204  if (is_array())
-
3205  {
-
3206  if (idx >= size())
-
3207  {
-
3208  throw std::out_of_range("index out of range");
-
3209  }
-
3210 
-
3211  m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));
-
3212  }
-
3213  else
-
3214  {
-
3215  throw std::domain_error("cannot use erase() with " + type_name());
-
3216  }
-
3217  }
-
3218 
-
3234  iterator find(typename object_t::key_type key)
-
3235  {
-
3236  auto result = end();
-
3237 
-
3238  if (is_object())
-
3239  {
-
3240  result.m_it.object_iterator = m_value.object->find(key);
-
3241  }
-
3242 
-
3243  return result;
-
3244  }
-
3245 
-
3250  const_iterator find(typename object_t::key_type key) const
-
3251  {
-
3252  auto result = cend();
-
3253 
-
3254  if (is_object())
-
3255  {
-
3256  result.m_it.object_iterator = m_value.object->find(key);
-
3257  }
-
3258 
-
3259  return result;
-
3260  }
-
3261 
-
3278  size_type count(typename object_t::key_type key) const
-
3279  {
-
3280  // return 0 for all nonobject types
-
3281  return (is_object()) ? m_value.object->count(key) : 0;
-
3282  }
-
3283 
-
3285 
-
3286 
-
3288  // iterators //
-
3290 
-
3293 
- -
3311  {
-
3312  iterator result(this);
-
3313  result.set_begin();
-
3314  return result;
-
3315  }
+
3157  switch (m_type)
+
3158  {
+
3159  case value_t::boolean:
+
3160  case value_t::number_float:
+ +
3162  case value_t::string:
+
3163  {
+
3164  if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())
+
3165  {
+
3166  throw std::out_of_range("iterators out of range");
+
3167  }
+
3168 
+
3169  if (is_string())
+
3170  {
+
3171  delete m_value.string;
+
3172  m_value.string = nullptr;
+
3173  }
+
3174 
+
3175  m_type = value_t::null;
+
3176  break;
+
3177  }
+
3178 
+
3179  case value_t::object:
+
3180  {
+
3181  result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
+
3182  last.m_it.object_iterator);
+
3183  break;
+
3184  }
+
3185 
+
3186  case value_t::array:
+
3187  {
+
3188  result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,
+
3189  last.m_it.array_iterator);
+
3190  break;
+
3191  }
+
3192 
+
3193  default:
+
3194  {
+
3195  throw std::domain_error("cannot use erase with " + type_name());
+
3196  }
+
3197  }
+
3198 
+
3199  return result;
+
3200  }
+
3201 
+
3227  size_type erase(const typename object_t::key_type& key)
+
3228  {
+
3229  // this erase only works for objects
+
3230  return is_object()
+
3231  ? m_value.object->erase(key)
+
3232  : throw std::domain_error("cannot use erase() with " + type_name());
+
3233  }
+
3234 
+
3257  void erase(const size_type idx)
+
3258  {
+
3259  // this erase only works for arrays
+
3260  if (is_array())
+
3261  {
+
3262  if (idx >= size())
+
3263  {
+
3264  throw std::out_of_range("index out of range");
+
3265  }
+
3266 
+
3267  m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));
+
3268  }
+
3269  else
+
3270  {
+
3271  throw std::domain_error("cannot use erase() with " + type_name());
+
3272  }
+
3273  }
+
3274 
+
3292  iterator find(typename object_t::key_type key)
+
3293  {
+
3294  auto result = end();
+
3295 
+
3296  if (is_object())
+
3297  {
+
3298  result.m_it.object_iterator = m_value.object->find(key);
+
3299  }
+
3300 
+
3301  return result;
+
3302  }
+
3303 
+
3308  const_iterator find(typename object_t::key_type key) const
+
3309  {
+
3310  auto result = cend();
+
3311 
+
3312  if (is_object())
+
3313  {
+
3314  result.m_it.object_iterator = m_value.object->find(key);
+
3315  }
3316 
- -
3321  {
-
3322  return cbegin();
-
3323  }
-
3324 
- -
3343  {
-
3344  const_iterator result(this);
-
3345  result.set_begin();
-
3346  return result;
-
3347  }
-
3348 
- -
3366  {
-
3367  iterator result(this);
-
3368  result.set_end();
-
3369  return result;
-
3370  }
-
3371 
- -
3376  {
-
3377  return cend();
-
3378  }
-
3379 
- -
3398  {
-
3399  const_iterator result(this);
-
3400  result.set_end();
-
3401  return result;
-
3402  }
-
3403 
- -
3420  {
-
3421  return reverse_iterator(end());
-
3422  }
-
3423 
- -
3428  {
-
3429  return crbegin();
-
3430  }
-
3431 
- -
3449  {
-
3450  return reverse_iterator(begin());
-
3451  }
-
3452 
- -
3457  {
-
3458  return crend();
-
3459  }
-
3460 
- -
3478  {
-
3479  return const_reverse_iterator(cend());
-
3480  }
-
3481 
- -
3499  {
-
3500  return const_reverse_iterator(cbegin());
-
3501  }
-
3502 
-
3504 
-
3505 
-
3507  // capacity //
-
3509 
-
3512 
-
3540  bool empty() const noexcept
-
3541  {
-
3542  switch (m_type)
-
3543  {
-
3544  case value_t::null:
-
3545  {
-
3546  return true;
-
3547  }
-
3548 
-
3549  case value_t::array:
-
3550  {
-
3551  return m_value.array->empty();
-
3552  }
-
3553 
-
3554  case value_t::object:
-
3555  {
-
3556  return m_value.object->empty();
-
3557  }
-
3558 
-
3559  default:
-
3560  {
-
3561  // all other types are nonempty
-
3562  return false;
-
3563  }
-
3564  }
-
3565  }
-
3566 
-
3594  size_type size() const noexcept
-
3595  {
-
3596  switch (m_type)
-
3597  {
-
3598  case value_t::null:
-
3599  {
-
3600  return 0;
-
3601  }
-
3602 
-
3603  case value_t::array:
-
3604  {
-
3605  return m_value.array->size();
-
3606  }
-
3607 
-
3608  case value_t::object:
-
3609  {
-
3610  return m_value.object->size();
-
3611  }
-
3612 
-
3613  default:
-
3614  {
-
3615  // all other types have size 1
-
3616  return 1;
-
3617  }
-
3618  }
-
3619  }
-
3620 
-
3651  size_type max_size() const noexcept
-
3652  {
-
3653  switch (m_type)
-
3654  {
-
3655  case value_t::array:
-
3656  {
-
3657  return m_value.array->max_size();
-
3658  }
-
3659 
-
3660  case value_t::object:
-
3661  {
-
3662  return m_value.object->max_size();
-
3663  }
-
3664 
-
3665  default:
-
3666  {
-
3667  // all other types have max_size() == size()
-
3668  return size();
-
3669  }
-
3670  }
-
3671  }
-
3672 
-
3674 
-
3675 
-
3677  // modifiers //
-
3679 
-
3682 
-
3706  void clear() noexcept
-
3707  {
-
3708  switch (m_type)
-
3709  {
- -
3711  {
-
3712  m_value.number_integer = 0;
-
3713  break;
-
3714  }
-
3715 
-
3716  case value_t::number_float:
-
3717  {
-
3718  m_value.number_float = 0.0;
-
3719  break;
-
3720  }
-
3721 
-
3722  case value_t::boolean:
-
3723  {
-
3724  m_value.boolean = false;
-
3725  break;
-
3726  }
-
3727 
-
3728  case value_t::string:
-
3729  {
-
3730  m_value.string->clear();
-
3731  break;
-
3732  }
-
3733 
-
3734  case value_t::array:
-
3735  {
-
3736  m_value.array->clear();
-
3737  break;
-
3738  }
-
3739 
-
3740  case value_t::object:
-
3741  {
-
3742  m_value.object->clear();
-
3743  break;
-
3744  }
-
3745 
-
3746  default:
-
3747  {
-
3748  break;
-
3749  }
-
3750  }
-
3751  }
-
3752 
-
3770  void push_back(basic_json&& value)
-
3771  {
-
3772  // push_back only works for null objects or arrays
-
3773  if (not(is_null() or is_array()))
-
3774  {
-
3775  throw std::domain_error("cannot use push_back() with " + type_name());
-
3776  }
-
3777 
-
3778  // transform null object into an array
-
3779  if (is_null())
-
3780  {
-
3781  m_type = value_t::array;
-
3782  m_value = value_t::array;
-
3783  }
-
3784 
-
3785  // add element to array (move semantics)
-
3786  m_value.array->push_back(std::move(value));
-
3787  // invalidate object
-
3788  value.m_type = value_t::null;
-
3789  }
-
3790 
- -
3796  {
-
3797  push_back(std::move(value));
-
3798  return *this;
-
3799  }
-
3800 
-
3805  void push_back(const basic_json& value)
-
3806  {
-
3807  // push_back only works for null objects or arrays
-
3808  if (not(is_null() or is_array()))
-
3809  {
-
3810  throw std::domain_error("cannot use push_back() with " + type_name());
-
3811  }
-
3812 
-
3813  // transform null object into an array
-
3814  if (is_null())
-
3815  {
-
3816  m_type = value_t::array;
-
3817  m_value = value_t::array;
-
3818  }
+
3317  return result;
+
3318  }
+
3319 
+
3338  size_type count(typename object_t::key_type key) const
+
3339  {
+
3340  // return 0 for all nonobject types
+
3341  return is_object() ? m_value.object->count(key) : 0;
+
3342  }
+
3343 
+
3345 
+
3346 
+
3348  // iterators //
+
3350 
+
3353 
+ +
3373  {
+
3374  iterator result(this);
+
3375  result.set_begin();
+
3376  return result;
+
3377  }
+
3378 
+ +
3383  {
+
3384  return cbegin();
+
3385  }
+
3386 
+ +
3407  {
+
3408  const_iterator result(this);
+
3409  result.set_begin();
+
3410  return result;
+
3411  }
+
3412 
+ +
3432  {
+
3433  iterator result(this);
+
3434  result.set_end();
+
3435  return result;
+
3436  }
+
3437 
+ +
3442  {
+
3443  return cend();
+
3444  }
+
3445 
+ +
3466  {
+
3467  const_iterator result(this);
+
3468  result.set_end();
+
3469  return result;
+
3470  }
+
3471 
+ +
3490  {
+
3491  return reverse_iterator(end());
+
3492  }
+
3493 
+ +
3498  {
+
3499  return crbegin();
+
3500  }
+
3501 
+ +
3521  {
+
3522  return reverse_iterator(begin());
+
3523  }
+
3524 
+ +
3529  {
+
3530  return crend();
+
3531  }
+
3532 
+ +
3552  {
+
3553  return const_reverse_iterator(cend());
+
3554  }
+
3555 
+ +
3575  {
+
3576  return const_reverse_iterator(cbegin());
+
3577  }
+
3578 
+
3580 
+
3581 
+
3583  // capacity //
+
3585 
+
3588 
+
3618  bool empty() const noexcept
+
3619  {
+
3620  switch (m_type)
+
3621  {
+
3622  case value_t::null:
+
3623  {
+
3624  // null values are empty
+
3625  return true;
+
3626  }
+
3627 
+
3628  case value_t::array:
+
3629  {
+
3630  return m_value.array->empty();
+
3631  }
+
3632 
+
3633  case value_t::object:
+
3634  {
+
3635  return m_value.object->empty();
+
3636  }
+
3637 
+
3638  default:
+
3639  {
+
3640  // all other types are nonempty
+
3641  return false;
+
3642  }
+
3643  }
+
3644  }
+
3645 
+
3675  size_type size() const noexcept
+
3676  {
+
3677  switch (m_type)
+
3678  {
+
3679  case value_t::null:
+
3680  {
+
3681  // null values are empty
+
3682  return 0;
+
3683  }
+
3684 
+
3685  case value_t::array:
+
3686  {
+
3687  return m_value.array->size();
+
3688  }
+
3689 
+
3690  case value_t::object:
+
3691  {
+
3692  return m_value.object->size();
+
3693  }
+
3694 
+
3695  default:
+
3696  {
+
3697  // all other types have size 1
+
3698  return 1;
+
3699  }
+
3700  }
+
3701  }
+
3702 
+
3735  size_type max_size() const noexcept
+
3736  {
+
3737  switch (m_type)
+
3738  {
+
3739  case value_t::array:
+
3740  {
+
3741  return m_value.array->max_size();
+
3742  }
+
3743 
+
3744  case value_t::object:
+
3745  {
+
3746  return m_value.object->max_size();
+
3747  }
+
3748 
+
3749  default:
+
3750  {
+
3751  // all other types have max_size() == size()
+
3752  return size();
+
3753  }
+
3754  }
+
3755  }
+
3756 
+
3758 
+
3759 
+
3761  // modifiers //
+
3763 
+
3766 
+
3792  void clear() noexcept
+
3793  {
+
3794  switch (m_type)
+
3795  {
+ +
3797  {
+
3798  m_value.number_integer = 0;
+
3799  break;
+
3800  }
+
3801 
+
3802  case value_t::number_float:
+
3803  {
+
3804  m_value.number_float = 0.0;
+
3805  break;
+
3806  }
+
3807 
+
3808  case value_t::boolean:
+
3809  {
+
3810  m_value.boolean = false;
+
3811  break;
+
3812  }
+
3813 
+
3814  case value_t::string:
+
3815  {
+
3816  m_value.string->clear();
+
3817  break;
+
3818  }
3819 
-
3820  // add element to array
-
3821  m_value.array->push_back(value);
-
3822  }
-
3823 
-
3828  reference operator+=(const basic_json& value)
-
3829  {
-
3830  push_back(value);
-
3831  return *this;
-
3832  }
-
3833 
-
3852  void push_back(const typename object_t::value_type& value)
-
3853  {
-
3854  // push_back only works for null objects or objects
-
3855  if (not(is_null() or is_object()))
-
3856  {
-
3857  throw std::domain_error("cannot use push_back() with " + type_name());
-
3858  }
-
3859 
-
3860  // transform null object into an object
-
3861  if (is_null())
+
3820  case value_t::array:
+
3821  {
+
3822  m_value.array->clear();
+
3823  break;
+
3824  }
+
3825 
+
3826  case value_t::object:
+
3827  {
+
3828  m_value.object->clear();
+
3829  break;
+
3830  }
+
3831 
+
3832  default:
+
3833  {
+
3834  break;
+
3835  }
+
3836  }
+
3837  }
+
3838 
+
3858  void push_back(basic_json&& value)
+
3859  {
+
3860  // push_back only works for null objects or arrays
+
3861  if (not(is_null() or is_array()))
3862  {
-
3863  m_type = value_t::object;
-
3864  m_value = value_t::object;
-
3865  }
-
3866 
-
3867  // add element to array
-
3868  m_value.object->insert(value);
-
3869  }
-
3870 
-
3875  reference operator+=(const typename object_t::value_type& value)
-
3876  {
-
3877  push_back(value);
-
3878  return operator[](value.first);
-
3879  }
-
3880 
-
3899  iterator insert(const_iterator pos, const basic_json& value)
-
3900  {
-
3901  // insert only works for arrays
-
3902  if (is_array())
+
3863  throw std::domain_error("cannot use push_back() with " + type_name());
+
3864  }
+
3865 
+
3866  // transform null object into an array
+
3867  if (is_null())
+
3868  {
+
3869  m_type = value_t::array;
+
3870  m_value = value_t::array;
+
3871  }
+
3872 
+
3873  // add element to array (move semantics)
+
3874  m_value.array->push_back(std::move(value));
+
3875  // invalidate object
+
3876  value.m_type = value_t::null;
+
3877  }
+
3878 
+ +
3884  {
+
3885  push_back(std::move(value));
+
3886  return *this;
+
3887  }
+
3888 
+
3893  void push_back(const basic_json& value)
+
3894  {
+
3895  // push_back only works for null objects or arrays
+
3896  if (not(is_null() or is_array()))
+
3897  {
+
3898  throw std::domain_error("cannot use push_back() with " + type_name());
+
3899  }
+
3900 
+
3901  // transform null object into an array
+
3902  if (is_null())
3903  {
-
3904  // check if iterator pos fits to this JSON value
-
3905  if (pos.m_object != this)
-
3906  {
-
3907  throw std::domain_error("iterator does not fit current value");
-
3908  }
-
3909 
-
3910  // insert to array and return iterator
-
3911  iterator result(this);
-
3912  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, value);
-
3913  return result;
-
3914  }
-
3915  else
-
3916  {
-
3917  throw std::domain_error("cannot use insert() with " + type_name());
-
3918  }
-
3919  }
-
3920 
- -
3926  {
-
3927  return insert(pos, value);
-
3928  }
-
3929 
- -
3951  {
-
3952  // insert only works for arrays
-
3953  if (is_array())
-
3954  {
-
3955  // check if iterator pos fits to this JSON value
-
3956  if (pos.m_object != this)
-
3957  {
-
3958  throw std::domain_error("iterator does not fit current value");
-
3959  }
+
3904  m_type = value_t::array;
+
3905  m_value = value_t::array;
+
3906  }
+
3907 
+
3908  // add element to array
+
3909  m_value.array->push_back(value);
+
3910  }
+
3911 
+
3916  reference operator+=(const basic_json& value)
+
3917  {
+
3918  push_back(value);
+
3919  return *this;
+
3920  }
+
3921 
+
3942  void push_back(const typename object_t::value_type& value)
+
3943  {
+
3944  // push_back only works for null objects or objects
+
3945  if (not(is_null() or is_object()))
+
3946  {
+
3947  throw std::domain_error("cannot use push_back() with " + type_name());
+
3948  }
+
3949 
+
3950  // transform null object into an object
+
3951  if (is_null())
+
3952  {
+
3953  m_type = value_t::object;
+
3954  m_value = value_t::object;
+
3955  }
+
3956 
+
3957  // add element to array
+
3958  m_value.object->insert(value);
+
3959  }
3960 
-
3961  // insert to array and return iterator
-
3962  iterator result(this);
-
3963  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, count, value);
-
3964  return result;
-
3965  }
-
3966  else
-
3967  {
-
3968  throw std::domain_error("cannot use insert() with " + type_name());
-
3969  }
-
3970  }
-
3971 
- -
3997  {
-
3998  // insert only works for arrays
-
3999  if (not is_array())
-
4000  {
-
4001  throw std::domain_error("cannot use insert() with " + type_name());
-
4002  }
-
4003 
-
4004  // check if iterator pos fits to this JSON value
-
4005  if (pos.m_object != this)
-
4006  {
-
4007  throw std::domain_error("iterator does not fit current value");
-
4008  }
-
4009 
-
4010  if (first.m_object != last.m_object)
-
4011  {
-
4012  throw std::domain_error("iterators does not fit");
-
4013  }
-
4014 
-
4015  if (first.m_object == this or last.m_object == this)
-
4016  {
-
4017  throw std::domain_error("passed iterators may not belong to container");
-
4018  }
-
4019 
-
4020  // insert to array and return iterator
-
4021  iterator result(this);
-
4022  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator,
-
4023  first.m_it.array_iterator, last.m_it.array_iterator);
-
4024  return result;
-
4025  }
-
4026 
-
4046  iterator insert(const_iterator pos, std::initializer_list<basic_json> ilist)
-
4047  {
-
4048  // insert only works for arrays
-
4049  if (not is_array())
-
4050  {
-
4051  throw std::domain_error("cannot use insert() with " + type_name());
-
4052  }
-
4053 
-
4054  // check if iterator pos fits to this JSON value
-
4055  if (pos.m_object != this)
-
4056  {
-
4057  throw std::domain_error("iterator does not fit current value");
-
4058  }
-
4059 
-
4060  // insert to array and return iterator
-
4061  iterator result(this);
-
4062  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
-
4063  return result;
+
3965  reference operator+=(const typename object_t::value_type& value)
+
3966  {
+
3967  push_back(value);
+
3968  return operator[](value.first);
+
3969  }
+
3970 
+
3991  iterator insert(const_iterator pos, const basic_json& value)
+
3992  {
+
3993  // insert only works for arrays
+
3994  if (is_array())
+
3995  {
+
3996  // check if iterator pos fits to this JSON value
+
3997  if (pos.m_object != this)
+
3998  {
+
3999  throw std::domain_error("iterator does not fit current value");
+
4000  }
+
4001 
+
4002  // insert to array and return iterator
+
4003  iterator result(this);
+
4004  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, value);
+
4005  return result;
+
4006  }
+
4007  else
+
4008  {
+
4009  throw std::domain_error("cannot use insert() with " + type_name());
+
4010  }
+
4011  }
+
4012 
+ +
4018  {
+
4019  return insert(pos, value);
+
4020  }
+
4021 
+ +
4045  {
+
4046  // insert only works for arrays
+
4047  if (is_array())
+
4048  {
+
4049  // check if iterator pos fits to this JSON value
+
4050  if (pos.m_object != this)
+
4051  {
+
4052  throw std::domain_error("iterator does not fit current value");
+
4053  }
+
4054 
+
4055  // insert to array and return iterator
+
4056  iterator result(this);
+
4057  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, count, value);
+
4058  return result;
+
4059  }
+
4060  else
+
4061  {
+
4062  throw std::domain_error("cannot use insert() with " + type_name());
+
4063  }
4064  }
4065 
-
4081  void swap(reference other) noexcept (
-
4082  std::is_nothrow_move_constructible<value_t>::value and
-
4083  std::is_nothrow_move_assignable<value_t>::value and
-
4084  std::is_nothrow_move_constructible<json_value>::value and
-
4085  std::is_nothrow_move_assignable<json_value>::value
-
4086  )
-
4087  {
-
4088  std::swap(m_type, other.m_type);
-
4089  std::swap(m_value, other.m_value);
-
4090  }
-
4091 
-
4109  void swap(array_t& other)
-
4110  {
-
4111  // swap only works for arrays
-
4112  if (is_array())
-
4113  {
-
4114  std::swap(*(m_value.array), other);
-
4115  }
-
4116  else
-
4117  {
-
4118  throw std::domain_error("cannot use swap() with " + type_name());
-
4119  }
-
4120  }
-
4121 
-
4139  void swap(object_t& other)
-
4140  {
-
4141  // swap only works for objects
-
4142  if (is_object())
-
4143  {
-
4144  std::swap(*(m_value.object), other);
-
4145  }
-
4146  else
-
4147  {
-
4148  throw std::domain_error("cannot use swap() with " + type_name());
-
4149  }
-
4150  }
-
4151 
-
4169  void swap(string_t& other)
-
4170  {
-
4171  // swap only works for strings
-
4172  if (is_string())
-
4173  {
-
4174  std::swap(*(m_value.string), other);
-
4175  }
-
4176  else
-
4177  {
-
4178  throw std::domain_error("cannot use swap() with " + type_name());
-
4179  }
-
4180  }
-
4181 
-
4183 
-
4184 
-
4186  // lexicographical comparison operators //
-
4188 
-
4191 
-
4192  private:
-
4200  friend bool operator<(const value_t lhs, const value_t rhs)
-
4201  {
-
4202  static constexpr std::array<uint8_t, 7> order = {{
-
4203  0, // null
-
4204  3, // object
-
4205  4, // array
-
4206  5, // string
-
4207  1, // boolean
-
4208  2, // integer
-
4209  2 // float
-
4210  }
-
4211  };
-
4212 
-
4213  // discarded values are not comparable
-
4214  if (lhs == value_t::discarded or rhs == value_t::discarded)
-
4215  {
-
4216  return false;
-
4217  }
-
4218 
-
4219  return order[static_cast<std::size_t>(lhs)] < order[static_cast<std::size_t>(rhs)];
-
4220  }
-
4221 
-
4222  public:
-
4244  friend bool operator==(const_reference lhs, const_reference rhs) noexcept
-
4245  {
-
4246  const auto lhs_type = lhs.type();
-
4247  const auto rhs_type = rhs.type();
-
4248 
-
4249  if (lhs_type == rhs_type)
-
4250  {
-
4251  switch (lhs_type)
-
4252  {
-
4253  case value_t::array:
-
4254  return *lhs.m_value.array == *rhs.m_value.array;
-
4255  case value_t::object:
-
4256  return *lhs.m_value.object == *rhs.m_value.object;
-
4257  case value_t::null:
-
4258  return true;
-
4259  case value_t::string:
-
4260  return *lhs.m_value.string == *rhs.m_value.string;
-
4261  case value_t::boolean:
-
4262  return lhs.m_value.boolean == rhs.m_value.boolean;
- -
4264  return lhs.m_value.number_integer == rhs.m_value.number_integer;
-
4265  case value_t::number_float:
-
4266  return approx(lhs.m_value.number_float, rhs.m_value.number_float);
-
4267  default:
-
4268  return false;
-
4269  }
-
4270  }
-
4271  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
-
4272  {
-
4273  return approx(static_cast<number_float_t>(lhs.m_value.number_integer),
-
4274  rhs.m_value.number_float);
-
4275  }
-
4276  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
-
4277  {
-
4278  return approx(lhs.m_value.number_float,
-
4279  static_cast<number_float_t>(rhs.m_value.number_integer));
-
4280  }
-
4281  return false;
-
4282  }
-
4283 
-
4300  friend bool operator==(const_reference v, std::nullptr_t) noexcept
-
4301  {
-
4302  return v.is_null();
-
4303  }
-
4304 
-
4309  friend bool operator==(std::nullptr_t, const_reference v) noexcept
-
4310  {
-
4311  return v.is_null();
-
4312  }
-
4313 
-
4328  friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
-
4329  {
-
4330  return not (lhs == rhs);
-
4331  }
-
4332 
-
4349  friend bool operator!=(const_reference v, std::nullptr_t) noexcept
-
4350  {
-
4351  return not v.is_null();
-
4352  }
-
4353 
-
4358  friend bool operator!=(std::nullptr_t, const_reference v) noexcept
-
4359  {
-
4360  return not v.is_null();
-
4361  }
-
4362 
-
4385  friend bool operator<(const_reference lhs, const_reference rhs) noexcept
-
4386  {
-
4387  const auto lhs_type = lhs.type();
-
4388  const auto rhs_type = rhs.type();
-
4389 
-
4390  if (lhs_type == rhs_type)
-
4391  {
-
4392  switch (lhs_type)
-
4393  {
-
4394  case value_t::array:
-
4395  return *lhs.m_value.array < *rhs.m_value.array;
-
4396  case value_t::object:
-
4397  return *lhs.m_value.object < *rhs.m_value.object;
-
4398  case value_t::null:
-
4399  return false;
-
4400  case value_t::string:
-
4401  return *lhs.m_value.string < *rhs.m_value.string;
-
4402  case value_t::boolean:
-
4403  return lhs.m_value.boolean < rhs.m_value.boolean;
- -
4405  return lhs.m_value.number_integer < rhs.m_value.number_integer;
-
4406  case value_t::number_float:
-
4407  return lhs.m_value.number_float < rhs.m_value.number_float;
-
4408  default:
-
4409  return false;
-
4410  }
-
4411  }
-
4412  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
-
4413  {
-
4414  return static_cast<number_float_t>(lhs.m_value.number_integer) <
-
4415  rhs.m_value.number_float;
-
4416  }
-
4417  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
-
4418  {
-
4419  return lhs.m_value.number_float <
-
4420  static_cast<number_float_t>(rhs.m_value.number_integer);
-
4421  }
-
4422 
-
4423  // We only reach this line if we cannot compare values. In that case,
-
4424  // we compare types. Note we have to call the operator explicitly,
-
4425  // because MSVC has problems otherwise.
-
4426  return operator<(lhs_type, rhs_type);
-
4427  }
-
4428 
-
4444  friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
+ +
4093  {
+
4094  // insert only works for arrays
+
4095  if (not is_array())
+
4096  {
+
4097  throw std::domain_error("cannot use insert() with " + type_name());
+
4098  }
+
4099 
+
4100  // check if iterator pos fits to this JSON value
+
4101  if (pos.m_object != this)
+
4102  {
+
4103  throw std::domain_error("iterator does not fit current value");
+
4104  }
+
4105 
+
4106  if (first.m_object != last.m_object)
+
4107  {
+
4108  throw std::domain_error("iterators do not fit");
+
4109  }
+
4110 
+
4111  if (first.m_object == this or last.m_object == this)
+
4112  {
+
4113  throw std::domain_error("passed iterators may not belong to container");
+
4114  }
+
4115 
+
4116  // insert to array and return iterator
+
4117  iterator result(this);
+
4118  result.m_it.array_iterator = m_value.array->insert(
+
4119  pos.m_it.array_iterator,
+
4120  first.m_it.array_iterator,
+
4121  last.m_it.array_iterator);
+
4122  return result;
+
4123  }
+
4124 
+
4146  iterator insert(const_iterator pos, std::initializer_list<basic_json> ilist)
+
4147  {
+
4148  // insert only works for arrays
+
4149  if (not is_array())
+
4150  {
+
4151  throw std::domain_error("cannot use insert() with " + type_name());
+
4152  }
+
4153 
+
4154  // check if iterator pos fits to this JSON value
+
4155  if (pos.m_object != this)
+
4156  {
+
4157  throw std::domain_error("iterator does not fit current value");
+
4158  }
+
4159 
+
4160  // insert to array and return iterator
+
4161  iterator result(this);
+
4162  result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
+
4163  return result;
+
4164  }
+
4165 
+
4183  void swap(reference other) noexcept (
+
4184  std::is_nothrow_move_constructible<value_t>::value and
+
4185  std::is_nothrow_move_assignable<value_t>::value and
+
4186  std::is_nothrow_move_constructible<json_value>::value and
+
4187  std::is_nothrow_move_assignable<json_value>::value
+
4188  )
+
4189  {
+
4190  std::swap(m_type, other.m_type);
+
4191  std::swap(m_value, other.m_value);
+
4192  }
+
4193 
+
4213  void swap(array_t& other)
+
4214  {
+
4215  // swap only works for arrays
+
4216  if (is_array())
+
4217  {
+
4218  std::swap(*(m_value.array), other);
+
4219  }
+
4220  else
+
4221  {
+
4222  throw std::domain_error("cannot use swap() with " + type_name());
+
4223  }
+
4224  }
+
4225 
+
4245  void swap(object_t& other)
+
4246  {
+
4247  // swap only works for objects
+
4248  if (is_object())
+
4249  {
+
4250  std::swap(*(m_value.object), other);
+
4251  }
+
4252  else
+
4253  {
+
4254  throw std::domain_error("cannot use swap() with " + type_name());
+
4255  }
+
4256  }
+
4257 
+
4277  void swap(string_t& other)
+
4278  {
+
4279  // swap only works for strings
+
4280  if (is_string())
+
4281  {
+
4282  std::swap(*(m_value.string), other);
+
4283  }
+
4284  else
+
4285  {
+
4286  throw std::domain_error("cannot use swap() with " + type_name());
+
4287  }
+
4288  }
+
4289 
+
4291 
+
4292 
+
4294  // lexicographical comparison operators //
+
4296 
+
4299 
+
4300  private:
+
4310  friend bool operator<(const value_t lhs, const value_t rhs)
+
4311  {
+
4312  static constexpr std::array<uint8_t, 7> order = {{
+
4313  0, // null
+
4314  3, // object
+
4315  4, // array
+
4316  5, // string
+
4317  1, // boolean
+
4318  2, // integer
+
4319  2 // float
+
4320  }
+
4321  };
+
4322 
+
4323  // discarded values are not comparable
+
4324  if (lhs == value_t::discarded or rhs == value_t::discarded)
+
4325  {
+
4326  return false;
+
4327  }
+
4328 
+
4329  return order[static_cast<std::size_t>(lhs)] < order[static_cast<std::size_t>(rhs)];
+
4330  }
+
4331 
+
4332  public:
+
4356  friend bool operator==(const_reference lhs, const_reference rhs) noexcept
+
4357  {
+
4358  const auto lhs_type = lhs.type();
+
4359  const auto rhs_type = rhs.type();
+
4360 
+
4361  if (lhs_type == rhs_type)
+
4362  {
+
4363  switch (lhs_type)
+
4364  {
+
4365  case value_t::array:
+
4366  return *lhs.m_value.array == *rhs.m_value.array;
+
4367  case value_t::object:
+
4368  return *lhs.m_value.object == *rhs.m_value.object;
+
4369  case value_t::null:
+
4370  return true;
+
4371  case value_t::string:
+
4372  return *lhs.m_value.string == *rhs.m_value.string;
+
4373  case value_t::boolean:
+
4374  return lhs.m_value.boolean == rhs.m_value.boolean;
+ +
4376  return lhs.m_value.number_integer == rhs.m_value.number_integer;
+
4377  case value_t::number_float:
+
4378  return approx(lhs.m_value.number_float, rhs.m_value.number_float);
+
4379  default:
+
4380  return false;
+
4381  }
+
4382  }
+
4383  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
+
4384  {
+
4385  return approx(static_cast<number_float_t>(lhs.m_value.number_integer),
+
4386  rhs.m_value.number_float);
+
4387  }
+
4388  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
+
4389  {
+
4390  return approx(lhs.m_value.number_float,
+
4391  static_cast<number_float_t>(rhs.m_value.number_integer));
+
4392  }
+
4393  return false;
+
4394  }
+
4395 
+
4414  friend bool operator==(const_reference v, std::nullptr_t) noexcept
+
4415  {
+
4416  return v.is_null();
+
4417  }
+
4418 
+
4423  friend bool operator==(std::nullptr_t, const_reference v) noexcept
+
4424  {
+
4425  return v.is_null();
+
4426  }
+
4427 
+
4444  friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
4445  {
-
4446  return not (rhs < lhs);
+
4446  return not (lhs == rhs);
4447  }
4448 
-
4464  friend bool operator>(const_reference lhs, const_reference rhs) noexcept
-
4465  {
-
4466  return not (lhs <= rhs);
-
4467  }
-
4468 
-
4484  friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
-
4485  {
-
4486  return not (lhs < rhs);
-
4487  }
-
4488 
-
4490 
-
4491 
-
4493  // serialization //
-
4495 
-
4498 
-
4519  friend std::ostream& operator<<(std::ostream& o, const basic_json& j)
-
4520  {
-
4521  // read width member and use it as indentation parameter if nonzero
-
4522  const bool pretty_print = (o.width() > 0);
-
4523  const auto indentation = (pretty_print ? o.width() : 0);
-
4524 
-
4525  // reset width to 0 for subsequent calls to this stream
-
4526  o.width(0);
-
4527 
-
4528  // do the actual serialization
-
4529  j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
-
4530  return o;
-
4531  }
-
4532 
-
4537  friend std::ostream& operator>>(const basic_json& j, std::ostream& o)
-
4538  {
-
4539  return o << j;
-
4540  }
-
4541 
-
4543 
-
4544 
-
4546  // deserialization //
-
4548 
-
4551 
-
4574  static basic_json parse(const string_t& s, parser_callback_t cb = nullptr)
-
4575  {
-
4576  return parser(s, cb).parse();
-
4577  }
-
4578 
-
4601  static basic_json parse(std::istream& i, parser_callback_t cb = nullptr)
-
4602  {
-
4603  return parser(i, cb).parse();
-
4604  }
-
4605 
-
4606  static basic_json parse(std::istream&& i, parser_callback_t cb = nullptr)
-
4607  {
-
4608  return parser(i, cb).parse();
-
4609  }
-
4610 
-
4632  friend std::istream& operator<<(basic_json& j, std::istream& i)
-
4633  {
-
4634  j = parser(i).parse();
-
4635  return i;
-
4636  }
-
4637 
-
4642  friend std::istream& operator>>(std::istream& i, basic_json& j)
-
4643  {
-
4644  j = parser(i).parse();
-
4645  return i;
-
4646  }
-
4647 
-
4649 
-
4650 
-
4651  private:
-
4653  // convenience functions //
-
4655 
-
4657  string_t type_name() const
-
4658  {
-
4659  switch (m_type)
-
4660  {
-
4661  case value_t::null:
-
4662  {
-
4663  return "null";
-
4664  }
-
4665 
-
4666  case value_t::object:
-
4667  {
-
4668  return "object";
-
4669  }
-
4670 
-
4671  case value_t::array:
-
4672  {
-
4673  return "array";
-
4674  }
-
4675 
-
4676  case value_t::string:
-
4677  {
-
4678  return "string";
-
4679  }
-
4680 
-
4681  case value_t::boolean:
-
4682  {
-
4683  return "boolean";
-
4684  }
-
4685 
-
4686  case value_t::discarded:
-
4687  {
-
4688  return "discarded";
-
4689  }
-
4690 
-
4691  default:
-
4692  {
-
4693  return "number";
-
4694  }
-
4695  }
-
4696  }
-
4697 
-
4706  static std::size_t extra_space(const string_t& s) noexcept
-
4707  {
-
4708  std::size_t result = 0;
-
4709 
-
4710  for (const auto& c : s)
-
4711  {
-
4712  switch (c)
-
4713  {
-
4714  case '"':
-
4715  case '\\':
-
4716  case '\b':
-
4717  case '\f':
-
4718  case '\n':
-
4719  case '\r':
-
4720  case '\t':
-
4721  {
-
4722  // from c (1 byte) to \x (2 bytes)
-
4723  result += 1;
-
4724  break;
-
4725  }
-
4726 
-
4727  default:
-
4728  {
-
4729  if (c >= 0x00 and c <= 0x1f)
-
4730  {
-
4731  // from c (1 byte) to \uxxxx (6 bytes)
-
4732  result += 5;
-
4733  }
-
4734  break;
-
4735  }
-
4736  }
-
4737  }
-
4738 
-
4739  return result;
-
4740  }
-
4741 
-
4755  static string_t escape_string(const string_t& s) noexcept
-
4756  {
-
4757  const auto space = extra_space(s);
-
4758  if (space == 0)
-
4759  {
-
4760  return s;
-
4761  }
-
4762 
-
4763  // create a result string of necessary size
-
4764  string_t result(s.size() + space, '\\');
-
4765  std::size_t pos = 0;
-
4766 
-
4767  for (const auto& c : s)
-
4768  {
-
4769  switch (c)
-
4770  {
-
4771  // quotation mark (0x22)
-
4772  case '"':
-
4773  {
-
4774  result[pos + 1] = '"';
-
4775  pos += 2;
-
4776  break;
-
4777  }
-
4778 
-
4779  // reverse solidus (0x5c)
-
4780  case '\\':
-
4781  {
-
4782  // nothing to change
-
4783  pos += 2;
-
4784  break;
-
4785  }
+
4467  friend bool operator!=(const_reference v, std::nullptr_t) noexcept
+
4468  {
+
4469  return not v.is_null();
+
4470  }
+
4471 
+
4476  friend bool operator!=(std::nullptr_t, const_reference v) noexcept
+
4477  {
+
4478  return not v.is_null();
+
4479  }
+
4480 
+
4505  friend bool operator<(const_reference lhs, const_reference rhs) noexcept
+
4506  {
+
4507  const auto lhs_type = lhs.type();
+
4508  const auto rhs_type = rhs.type();
+
4509 
+
4510  if (lhs_type == rhs_type)
+
4511  {
+
4512  switch (lhs_type)
+
4513  {
+
4514  case value_t::array:
+
4515  return *lhs.m_value.array < *rhs.m_value.array;
+
4516  case value_t::object:
+
4517  return *lhs.m_value.object < *rhs.m_value.object;
+
4518  case value_t::null:
+
4519  return false;
+
4520  case value_t::string:
+
4521  return *lhs.m_value.string < *rhs.m_value.string;
+
4522  case value_t::boolean:
+
4523  return lhs.m_value.boolean < rhs.m_value.boolean;
+ +
4525  return lhs.m_value.number_integer < rhs.m_value.number_integer;
+
4526  case value_t::number_float:
+
4527  return lhs.m_value.number_float < rhs.m_value.number_float;
+
4528  default:
+
4529  return false;
+
4530  }
+
4531  }
+
4532  else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
+
4533  {
+
4534  return static_cast<number_float_t>(lhs.m_value.number_integer) <
+
4535  rhs.m_value.number_float;
+
4536  }
+
4537  else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
+
4538  {
+
4539  return lhs.m_value.number_float <
+
4540  static_cast<number_float_t>(rhs.m_value.number_integer);
+
4541  }
+
4542 
+
4543  // We only reach this line if we cannot compare values. In that case,
+
4544  // we compare types. Note we have to call the operator explicitly,
+
4545  // because MSVC has problems otherwise.
+
4546  return operator<(lhs_type, rhs_type);
+
4547  }
+
4548 
+
4566  friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
+
4567  {
+
4568  return not (rhs < lhs);
+
4569  }
+
4570 
+
4588  friend bool operator>(const_reference lhs, const_reference rhs) noexcept
+
4589  {
+
4590  return not (lhs <= rhs);
+
4591  }
+
4592 
+
4610  friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
+
4611  {
+
4612  return not (lhs < rhs);
+
4613  }
+
4614 
+
4616 
+
4617 
+
4619  // serialization //
+
4621 
+
4624 
+
4647  friend std::ostream& operator<<(std::ostream& o, const basic_json& j)
+
4648  {
+
4649  // read width member and use it as indentation parameter if nonzero
+
4650  const bool pretty_print = (o.width() > 0);
+
4651  const auto indentation = (pretty_print ? o.width() : 0);
+
4652 
+
4653  // reset width to 0 for subsequent calls to this stream
+
4654  o.width(0);
+
4655 
+
4656  // do the actual serialization
+
4657  j.dump(o, pretty_print, static_cast<unsigned int>(indentation));
+
4658  return o;
+
4659  }
+
4660 
+
4665  friend std::ostream& operator>>(const basic_json& j, std::ostream& o)
+
4666  {
+
4667  return o << j;
+
4668  }
+
4669 
+
4671 
+
4672 
+
4674  // deserialization //
+
4676 
+
4679 
+
4704  static basic_json parse(const string_t& s, parser_callback_t cb = nullptr)
+
4705  {
+
4706  return parser(s, cb).parse();
+
4707  }
+
4708 
+
4733  static basic_json parse(std::istream& i, parser_callback_t cb = nullptr)
+
4734  {
+
4735  return parser(i, cb).parse();
+
4736  }
+
4737 
+
4741  static basic_json parse(std::istream&& i, parser_callback_t cb = nullptr)
+
4742  {
+
4743  return parser(i, cb).parse();
+
4744  }
+
4745 
+
4769  friend std::istream& operator<<(basic_json& j, std::istream& i)
+
4770  {
+
4771  j = parser(i).parse();
+
4772  return i;
+
4773  }
+
4774 
+
4779  friend std::istream& operator>>(std::istream& i, basic_json& j)
+
4780  {
+
4781  j = parser(i).parse();
+
4782  return i;
+
4783  }
+
4784 
4786 
-
4787  // backspace (0x08)
-
4788  case '\b':
-
4789  {
-
4790  result[pos + 1] = 'b';
-
4791  pos += 2;
-
4792  break;
-
4793  }
-
4794 
-
4795  // formfeed (0x0c)
-
4796  case '\f':
-
4797  {
-
4798  result[pos + 1] = 'f';
-
4799  pos += 2;
-
4800  break;
-
4801  }
-
4802 
-
4803  // newline (0x0a)
-
4804  case '\n':
-
4805  {
-
4806  result[pos + 1] = 'n';
-
4807  pos += 2;
-
4808  break;
-
4809  }
-
4810 
-
4811  // carriage return (0x0d)
-
4812  case '\r':
-
4813  {
-
4814  result[pos + 1] = 'r';
-
4815  pos += 2;
-
4816  break;
-
4817  }
-
4818 
-
4819  // horizontal tab (0x09)
-
4820  case '\t':
-
4821  {
-
4822  result[pos + 1] = 't';
-
4823  pos += 2;
-
4824  break;
-
4825  }
+
4787 
+
4788  private:
+
4790  // convenience functions //
+
4792 
+
4794  string_t type_name() const
+
4795  {
+
4796  switch (m_type)
+
4797  {
+
4798  case value_t::null:
+
4799  return "null";
+
4800  case value_t::object:
+
4801  return "object";
+
4802  case value_t::array:
+
4803  return "array";
+
4804  case value_t::string:
+
4805  return "string";
+
4806  case value_t::boolean:
+
4807  return "boolean";
+
4808  case value_t::discarded:
+
4809  return "discarded";
+
4810  default:
+
4811  return "number";
+
4812  }
+
4813  }
+
4814 
+
4823  static std::size_t extra_space(const string_t& s) noexcept
+
4824  {
+
4825  std::size_t result = 0;
4826 
-
4827  default:
-
4828  {
-
4829  if (c >= 0x00 and c <= 0x1f)
-
4830  {
-
4831  // convert a number 0..15 to its hex representation (0..f)
-
4832  auto hexify = [](const char v) -> char
-
4833  {
-
4834  return (v < 10) ? ('0' + v) : ('a' + v - 10);
-
4835  };
-
4836 
-
4837  // print character c as \uxxxx
-
4838  for (const char m :
-
4839  { 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f)
-
4840  })
-
4841  {
-
4842  result[++pos] = m;
-
4843  }
-
4844 
-
4845  ++pos;
-
4846  }
-
4847  else
-
4848  {
-
4849  // all other characters are added as-is
-
4850  result[pos++] = c;
-
4851  }
-
4852  break;
-
4853  }
-
4854  }
-
4855  }
-
4856 
-
4857  return result;
-
4858  }
-
4859 
-
4877  void dump(std::ostream& o, const bool pretty_print, const unsigned int indent_step,
-
4878  const unsigned int current_indent = 0) const
-
4879  {
-
4880  // variable to hold indentation for recursive calls
-
4881  unsigned int new_indent = current_indent;
-
4882 
-
4883  switch (m_type)
-
4884  {
-
4885  case value_t::object:
-
4886  {
-
4887  if (m_value.object->empty())
-
4888  {
-
4889  o << "{}";
-
4890  return;
-
4891  }
-
4892 
-
4893  o << "{";
-
4894 
-
4895  // increase indentation
-
4896  if (pretty_print)
-
4897  {
-
4898  new_indent += indent_step;
-
4899  o << "\n";
-
4900  }
-
4901 
-
4902  for (auto i = m_value.object->cbegin(); i != m_value.object->cend(); ++i)
-
4903  {
-
4904  if (i != m_value.object->cbegin())
-
4905  {
-
4906  o << (pretty_print ? ",\n" : ",");
-
4907  }
-
4908  o << string_t(new_indent, ' ') << "\""
-
4909  << escape_string(i->first) << "\":"
-
4910  << (pretty_print ? " " : "");
-
4911  i->second.dump(o, pretty_print, indent_step, new_indent);
-
4912  }
-
4913 
-
4914  // decrease indentation
-
4915  if (pretty_print)
-
4916  {
-
4917  new_indent -= indent_step;
-
4918  o << "\n";
-
4919  }
-
4920 
-
4921  o << string_t(new_indent, ' ') + "}";
-
4922  return;
-
4923  }
-
4924 
-
4925  case value_t::array:
-
4926  {
-
4927  if (m_value.array->empty())
-
4928  {
-
4929  o << "[]";
-
4930  return;
-
4931  }
-
4932 
-
4933  o << "[";
-
4934 
-
4935  // increase indentation
-
4936  if (pretty_print)
-
4937  {
-
4938  new_indent += indent_step;
-
4939  o << "\n";
-
4940  }
-
4941 
-
4942  for (auto i = m_value.array->cbegin(); i != m_value.array->cend(); ++i)
-
4943  {
-
4944  if (i != m_value.array->cbegin())
-
4945  {
-
4946  o << (pretty_print ? ",\n" : ",");
-
4947  }
-
4948  o << string_t(new_indent, ' ');
-
4949  i->dump(o, pretty_print, indent_step, new_indent);
-
4950  }
-
4951 
-
4952  // decrease indentation
-
4953  if (pretty_print)
-
4954  {
-
4955  new_indent -= indent_step;
-
4956  o << "\n";
-
4957  }
-
4958 
-
4959  o << string_t(new_indent, ' ') << "]";
-
4960  return;
-
4961  }
-
4962 
-
4963  case value_t::string:
-
4964  {
-
4965  o << string_t("\"") << escape_string(*m_value.string) << "\"";
-
4966  return;
-
4967  }
-
4968 
-
4969  case value_t::boolean:
-
4970  {
-
4971  o << (m_value.boolean ? "true" : "false");
-
4972  return;
-
4973  }
-
4974 
- -
4976  {
-
4977  o << m_value.number_integer;
-
4978  return;
-
4979  }
-
4980 
-
4981  case value_t::number_float:
-
4982  {
-
4983  // 15 digits of precision allows round-trip IEEE 754
-
4984  // string->double->string; to be safe, we read this value from
-
4985  // std::numeric_limits<number_float_t>::digits10
-
4986  o << std::setprecision(std::numeric_limits<number_float_t>::digits10) << m_value.number_float;
-
4987  return;
-
4988  }
-
4989 
-
4990  case value_t::discarded:
-
4991  {
-
4992  o << "<discarded>";
-
4993  return;
-
4994  }
-
4995 
-
4996  case value_t::null:
-
4997  {
-
4998  o << "null";
-
4999  return;
-
5000  }
-
5001  }
-
5002  }
-
5003 
-
5004  private:
-
5006  // member variables //
-
5008 
-
5010  value_t m_type = value_t::null;
+
4827  for (const auto& c : s)
+
4828  {
+
4829  switch (c)
+
4830  {
+
4831  case '"':
+
4832  case '\\':
+
4833  case '\b':
+
4834  case '\f':
+
4835  case '\n':
+
4836  case '\r':
+
4837  case '\t':
+
4838  {
+
4839  // from c (1 byte) to \x (2 bytes)
+
4840  result += 1;
+
4841  break;
+
4842  }
+
4843 
+
4844  default:
+
4845  {
+
4846  if (c >= 0x00 and c <= 0x1f)
+
4847  {
+
4848  // from c (1 byte) to \uxxxx (6 bytes)
+
4849  result += 5;
+
4850  }
+
4851  break;
+
4852  }
+
4853  }
+
4854  }
+
4855 
+
4856  return result;
+
4857  }
+
4858 
+
4872  static string_t escape_string(const string_t& s) noexcept
+
4873  {
+
4874  const auto space = extra_space(s);
+
4875  if (space == 0)
+
4876  {
+
4877  return s;
+
4878  }
+
4879 
+
4880  // create a result string of necessary size
+
4881  string_t result(s.size() + space, '\\');
+
4882  std::size_t pos = 0;
+
4883 
+
4884  for (const auto& c : s)
+
4885  {
+
4886  switch (c)
+
4887  {
+
4888  // quotation mark (0x22)
+
4889  case '"':
+
4890  {
+
4891  result[pos + 1] = '"';
+
4892  pos += 2;
+
4893  break;
+
4894  }
+
4895 
+
4896  // reverse solidus (0x5c)
+
4897  case '\\':
+
4898  {
+
4899  // nothing to change
+
4900  pos += 2;
+
4901  break;
+
4902  }
+
4903 
+
4904  // backspace (0x08)
+
4905  case '\b':
+
4906  {
+
4907  result[pos + 1] = 'b';
+
4908  pos += 2;
+
4909  break;
+
4910  }
+
4911 
+
4912  // formfeed (0x0c)
+
4913  case '\f':
+
4914  {
+
4915  result[pos + 1] = 'f';
+
4916  pos += 2;
+
4917  break;
+
4918  }
+
4919 
+
4920  // newline (0x0a)
+
4921  case '\n':
+
4922  {
+
4923  result[pos + 1] = 'n';
+
4924  pos += 2;
+
4925  break;
+
4926  }
+
4927 
+
4928  // carriage return (0x0d)
+
4929  case '\r':
+
4930  {
+
4931  result[pos + 1] = 'r';
+
4932  pos += 2;
+
4933  break;
+
4934  }
+
4935 
+
4936  // horizontal tab (0x09)
+
4937  case '\t':
+
4938  {
+
4939  result[pos + 1] = 't';
+
4940  pos += 2;
+
4941  break;
+
4942  }
+
4943 
+
4944  default:
+
4945  {
+
4946  if (c >= 0x00 and c <= 0x1f)
+
4947  {
+
4948  // convert a number 0..15 to its hex representation (0..f)
+
4949  auto hexify = [](const char v) -> char
+
4950  {
+
4951  return (v < 10) ? ('0' + v) : ('a' + v - 10);
+
4952  };
+
4953 
+
4954  // print character c as \uxxxx
+
4955  for (const char m :
+
4956  { 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f)
+
4957  })
+
4958  {
+
4959  result[++pos] = m;
+
4960  }
+
4961 
+
4962  ++pos;
+
4963  }
+
4964  else
+
4965  {
+
4966  // all other characters are added as-is
+
4967  result[pos++] = c;
+
4968  }
+
4969  break;
+
4970  }
+
4971  }
+
4972  }
+
4973 
+
4974  return result;
+
4975  }
+
4976 
+
4994  void dump(std::ostream& o,
+
4995  const bool pretty_print,
+
4996  const unsigned int indent_step,
+
4997  const unsigned int current_indent = 0) const
+
4998  {
+
4999  // variable to hold indentation for recursive calls
+
5000  unsigned int new_indent = current_indent;
+
5001 
+
5002  switch (m_type)
+
5003  {
+
5004  case value_t::object:
+
5005  {
+
5006  if (m_value.object->empty())
+
5007  {
+
5008  o << "{}";
+
5009  return;
+
5010  }
5011 
-
5013  json_value m_value = {};
-
5014 
-
5015 
-
5016  private:
-
5018  // iterators //
-
5020 
-
5030  class primitive_iterator_t
-
5031  {
-
5032  public:
-
5034  void set_begin()
-
5035  {
-
5036  m_it = begin_value;
-
5037  }
-
5038 
-
5040  void set_end()
-
5041  {
-
5042  m_it = end_value;
-
5043  }
-
5044 
-
5046  bool is_begin() const
-
5047  {
-
5048  return (m_it == begin_value);
-
5049  }
-
5050 
-
5052  bool is_end() const
-
5053  {
-
5054  return (m_it == end_value);
-
5055  }
-
5056 
-
5058  operator difference_type& ()
-
5059  {
-
5060  return m_it;
-
5061  }
-
5062 
-
5064  operator difference_type () const
-
5065  {
-
5066  return m_it;
-
5067  }
-
5068 
-
5069  private:
-
5070  static constexpr difference_type begin_value = 0;
-
5071  static constexpr difference_type end_value = begin_value + 1;
-
5072 
-
5074  difference_type m_it = std::numeric_limits<std::ptrdiff_t>::denorm_min();
-
5075  };
-
5076 
-
5084  struct internal_iterator
-
5085  {
-
5087  typename object_t::iterator object_iterator;
-
5089  typename array_t::iterator array_iterator;
-
5091  primitive_iterator_t primitive_iterator;
-
5092 
-
5094  internal_iterator()
-
5095  : object_iterator(), array_iterator(), primitive_iterator()
-
5096  {}
-
5097  };
-
5098 
-
5099  public:
-
5111  class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
-
5112  {
-
5114  friend class basic_json;
-
5115 
-
5116  public:
- - - - -
5126  using iterator_category = std::bidirectional_iterator_tag;
-
5127 
-
5129  const_iterator() = default;
+
5012  o << "{";
+
5013 
+
5014  // increase indentation
+
5015  if (pretty_print)
+
5016  {
+
5017  new_indent += indent_step;
+
5018  o << "\n";
+
5019  }
+
5020 
+
5021  for (auto i = m_value.object->cbegin(); i != m_value.object->cend(); ++i)
+
5022  {
+
5023  if (i != m_value.object->cbegin())
+
5024  {
+
5025  o << (pretty_print ? ",\n" : ",");
+
5026  }
+
5027  o << string_t(new_indent, ' ') << "\""
+
5028  << escape_string(i->first) << "\":"
+
5029  << (pretty_print ? " " : "");
+
5030  i->second.dump(o, pretty_print, indent_step, new_indent);
+
5031  }
+
5032 
+
5033  // decrease indentation
+
5034  if (pretty_print)
+
5035  {
+
5036  new_indent -= indent_step;
+
5037  o << "\n";
+
5038  }
+
5039 
+
5040  o << string_t(new_indent, ' ') + "}";
+
5041  return;
+
5042  }
+
5043 
+
5044  case value_t::array:
+
5045  {
+
5046  if (m_value.array->empty())
+
5047  {
+
5048  o << "[]";
+
5049  return;
+
5050  }
+
5051 
+
5052  o << "[";
+
5053 
+
5054  // increase indentation
+
5055  if (pretty_print)
+
5056  {
+
5057  new_indent += indent_step;
+
5058  o << "\n";
+
5059  }
+
5060 
+
5061  for (auto i = m_value.array->cbegin(); i != m_value.array->cend(); ++i)
+
5062  {
+
5063  if (i != m_value.array->cbegin())
+
5064  {
+
5065  o << (pretty_print ? ",\n" : ",");
+
5066  }
+
5067  o << string_t(new_indent, ' ');
+
5068  i->dump(o, pretty_print, indent_step, new_indent);
+
5069  }
+
5070 
+
5071  // decrease indentation
+
5072  if (pretty_print)
+
5073  {
+
5074  new_indent -= indent_step;
+
5075  o << "\n";
+
5076  }
+
5077 
+
5078  o << string_t(new_indent, ' ') << "]";
+
5079  return;
+
5080  }
+
5081 
+
5082  case value_t::string:
+
5083  {
+
5084  o << string_t("\"") << escape_string(*m_value.string) << "\"";
+
5085  return;
+
5086  }
+
5087 
+
5088  case value_t::boolean:
+
5089  {
+
5090  o << (m_value.boolean ? "true" : "false");
+
5091  return;
+
5092  }
+
5093 
+ +
5095  {
+
5096  o << m_value.number_integer;
+
5097  return;
+
5098  }
+
5099 
+
5100  case value_t::number_float:
+
5101  {
+
5102  // 15 digits of precision allows round-trip IEEE 754
+
5103  // string->double->string; to be safe, we read this value from
+
5104  // std::numeric_limits<number_float_t>::digits10
+
5105  o << std::setprecision(std::numeric_limits<number_float_t>::digits10) << m_value.number_float;
+
5106  return;
+
5107  }
+
5108 
+
5109  case value_t::discarded:
+
5110  {
+
5111  o << "<discarded>";
+
5112  return;
+
5113  }
+
5114 
+
5115  case value_t::null:
+
5116  {
+
5117  o << "null";
+
5118  return;
+
5119  }
+
5120  }
+
5121  }
+
5122 
+
5123  private:
+
5125  // member variables //
+
5127 
+
5129  value_t m_type = value_t::null;
5130 
-
5132  const_iterator(pointer object) : m_object(object)
-
5133  {
-
5134  switch (m_object->m_type)
-
5135  {
- -
5137  {
-
5138  m_it.object_iterator = typename object_t::iterator();
-
5139  break;
-
5140  }
-
5141 
- -
5143  {
-
5144  m_it.array_iterator = typename array_t::iterator();
-
5145  break;
-
5146  }
-
5147 
-
5148  default:
-
5149  {
-
5150  m_it.primitive_iterator = primitive_iterator_t();
-
5151  break;
-
5152  }
-
5153  }
-
5154  }
-
5155 
-
5157  const_iterator(const iterator& other) : m_object(other.m_object)
-
5158  {
-
5159  switch (m_object->m_type)
-
5160  {
- -
5162  {
-
5163  m_it.object_iterator = other.m_it.object_iterator;
-
5164  break;
-
5165  }
-
5166 
- -
5168  {
-
5169  m_it.array_iterator = other.m_it.array_iterator;
-
5170  break;
-
5171  }
-
5172 
-
5173  default:
-
5174  {
-
5175  m_it.primitive_iterator = other.m_it.primitive_iterator;
-
5176  break;
-
5177  }
-
5178  }
-
5179  }
-
5180 
-
5182  const_iterator(const const_iterator& other) noexcept
-
5183  : m_object(other.m_object), m_it(other.m_it)
-
5184  {}
-
5185 
- -
5188  std::is_nothrow_move_constructible<pointer>::value and
-
5189  std::is_nothrow_move_assignable<pointer>::value and
-
5190  std::is_nothrow_move_constructible<internal_iterator>::value and
-
5191  std::is_nothrow_move_assignable<internal_iterator>::value
-
5192  )
-
5193  {
-
5194  std::swap(m_object, other.m_object);
-
5195  std::swap(m_it, other.m_it);
-
5196  return *this;
-
5197  }
-
5198 
-
5199  private:
-
5201  void set_begin()
-
5202  {
-
5203  switch (m_object->m_type)
-
5204  {
- -
5206  {
-
5207  m_it.object_iterator = m_object->m_value.object->begin();
-
5208  break;
-
5209  }
-
5210 
- -
5212  {
-
5213  m_it.array_iterator = m_object->m_value.array->begin();
-
5214  break;
-
5215  }
-
5216 
- -
5218  {
-
5219  // set to end so begin()==end() is true: null is empty
-
5220  m_it.primitive_iterator.set_end();
-
5221  break;
-
5222  }
-
5223 
-
5224  default:
-
5225  {
-
5226  m_it.primitive_iterator.set_begin();
-
5227  break;
-
5228  }
-
5229  }
-
5230  }
-
5231 
-
5233  void set_end()
-
5234  {
-
5235  switch (m_object->m_type)
-
5236  {
- -
5238  {
-
5239  m_it.object_iterator = m_object->m_value.object->end();
-
5240  break;
-
5241  }
-
5242 
- -
5244  {
-
5245  m_it.array_iterator = m_object->m_value.array->end();
-
5246  break;
-
5247  }
+
5132  json_value m_value = {};
+
5133 
+
5134 
+
5135  private:
+
5137  // iterators //
+
5139 
+
5149  class primitive_iterator_t
+
5150  {
+
5151  public:
+
5153  void set_begin()
+
5154  {
+
5155  m_it = begin_value;
+
5156  }
+
5157 
+
5159  void set_end()
+
5160  {
+
5161  m_it = end_value;
+
5162  }
+
5163 
+
5165  bool is_begin() const
+
5166  {
+
5167  return (m_it == begin_value);
+
5168  }
+
5169 
+
5171  bool is_end() const
+
5172  {
+
5173  return (m_it == end_value);
+
5174  }
+
5175 
+
5177  operator difference_type& ()
+
5178  {
+
5179  return m_it;
+
5180  }
+
5181 
+
5183  operator difference_type () const
+
5184  {
+
5185  return m_it;
+
5186  }
+
5187 
+
5188  private:
+
5189  static constexpr difference_type begin_value = 0;
+
5190  static constexpr difference_type end_value = begin_value + 1;
+
5191 
+
5193  difference_type m_it = std::numeric_limits<std::ptrdiff_t>::denorm_min();
+
5194  };
+
5195 
+
5203  struct internal_iterator
+
5204  {
+
5206  typename object_t::iterator object_iterator;
+
5208  typename array_t::iterator array_iterator;
+
5210  primitive_iterator_t primitive_iterator;
+
5211 
+
5213  internal_iterator()
+
5214  : object_iterator(), array_iterator(), primitive_iterator()
+
5215  {}
+
5216  };
+
5217 
+
5218  public:
+
5232  class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
+
5233  {
+
5235  friend class basic_json;
+
5236 
+
5237  public:
+ + + + +
5247  using iterator_category = std::bidirectional_iterator_tag;
5248 
-
5249  default:
-
5250  {
-
5251  m_it.primitive_iterator.set_end();
-
5252  break;
-
5253  }
-
5254  }
-
5255  }
-
5256 
-
5257  public:
- -
5260  {
-
5261  switch (m_object->m_type)
-
5262  {
- +
5250  const_iterator() = default;
+
5251 
+
5253  const_iterator(pointer object) : m_object(object)
+
5254  {
+
5255  switch (m_object->m_type)
+
5256  {
+ +
5258  {
+
5259  m_it.object_iterator = typename object_t::iterator();
+
5260  break;
+
5261  }
+
5262 
+
5264  {
-
5265  return m_it.object_iterator->second;
-
5266  }
-
5267 
- -
5269  {
-
5270  return *m_it.array_iterator;
-
5271  }
-
5272 
- -
5274  {
-
5275  throw std::out_of_range("cannot get value");
-
5276  }
-
5277 
-
5278  default:
-
5279  {
-
5280  if (m_it.primitive_iterator.is_begin())
-
5281  {
-
5282  return *m_object;
-
5283  }
-
5284  else
-
5285  {
-
5286  throw std::out_of_range("cannot get value");
-
5287  }
-
5288  }
-
5289  }
-
5290  }
-
5291 
- -
5294  {
-
5295  switch (m_object->m_type)
-
5296  {
- -
5298  {
-
5299  return &(m_it.object_iterator->second);
-
5300  }
+
5265  m_it.array_iterator = typename array_t::iterator();
+
5266  break;
+
5267  }
+
5268 
+
5269  default:
+
5270  {
+
5271  m_it.primitive_iterator = primitive_iterator_t();
+
5272  break;
+
5273  }
+
5274  }
+
5275  }
+
5276 
+
5278  const_iterator(const iterator& other) : m_object(other.m_object)
+
5279  {
+
5280  switch (m_object->m_type)
+
5281  {
+ +
5283  {
+
5284  m_it.object_iterator = other.m_it.object_iterator;
+
5285  break;
+
5286  }
+
5287 
+ +
5289  {
+
5290  m_it.array_iterator = other.m_it.array_iterator;
+
5291  break;
+
5292  }
+
5293 
+
5294  default:
+
5295  {
+
5296  m_it.primitive_iterator = other.m_it.primitive_iterator;
+
5297  break;
+
5298  }
+
5299  }
+
5300  }
5301 
- -
5303  {
-
5304  return &*m_it.array_iterator;
-
5305  }
+
5303  const_iterator(const const_iterator& other) noexcept
+
5304  : m_object(other.m_object), m_it(other.m_it)
+
5305  {}
5306 
-
5307  default:
-
5308  {
-
5309  if (m_it.primitive_iterator.is_begin())
-
5310  {
-
5311  return m_object;
-
5312  }
-
5313  else
-
5314  {
-
5315  throw std::out_of_range("cannot get value");
-
5316  }
-
5317  }
-
5318  }
-
5319  }
-
5320 
- + +
5309  std::is_nothrow_move_constructible<pointer>::value and
+
5310  std::is_nothrow_move_assignable<pointer>::value and
+
5311  std::is_nothrow_move_constructible<internal_iterator>::value and
+
5312  std::is_nothrow_move_assignable<internal_iterator>::value
+
5313  )
+
5314  {
+
5315  std::swap(m_object, other.m_object);
+
5316  std::swap(m_it, other.m_it);
+
5317  return *this;
+
5318  }
+
5319 
+
5320  private:
+
5322  void set_begin()
5323  {
-
5324  auto result = *this;
-
5325  ++(*this);
-
5326 
-
5327  return result;
-
5328  }
-
5329 
- -
5332  {
-
5333  switch (m_object->m_type)
-
5334  {
- -
5336  {
-
5337  ++m_it.object_iterator;
-
5338  break;
-
5339  }
-
5340 
- -
5342  {
-
5343  ++m_it.array_iterator;
-
5344  break;
-
5345  }
-
5346 
-
5347  default:
-
5348  {
-
5349  ++m_it.primitive_iterator;
-
5350  break;
-
5351  }
-
5352  }
-
5353 
-
5354  return *this;
-
5355  }
-
5356 
- -
5359  {
-
5360  auto result = *this;
-
5361  --(*this);
-
5362 
-
5363  return result;
-
5364  }
-
5365 
- -
5368  {
-
5369  switch (m_object->m_type)
-
5370  {
- -
5372  {
-
5373  --m_it.object_iterator;
-
5374  break;
-
5375  }
-
5376 
- -
5378  {
-
5379  --m_it.array_iterator;
-
5380  break;
-
5381  }
-
5382 
-
5383  default:
-
5384  {
-
5385  --m_it.primitive_iterator;
-
5386  break;
+
5324  switch (m_object->m_type)
+
5325  {
+ +
5327  {
+
5328  m_it.object_iterator = m_object->m_value.object->begin();
+
5329  break;
+
5330  }
+
5331 
+ +
5333  {
+
5334  m_it.array_iterator = m_object->m_value.array->begin();
+
5335  break;
+
5336  }
+
5337 
+ +
5339  {
+
5340  // set to end so begin()==end() is true: null is empty
+
5341  m_it.primitive_iterator.set_end();
+
5342  break;
+
5343  }
+
5344 
+
5345  default:
+
5346  {
+
5347  m_it.primitive_iterator.set_begin();
+
5348  break;
+
5349  }
+
5350  }
+
5351  }
+
5352 
+
5354  void set_end()
+
5355  {
+
5356  switch (m_object->m_type)
+
5357  {
+ +
5359  {
+
5360  m_it.object_iterator = m_object->m_value.object->end();
+
5361  break;
+
5362  }
+
5363 
+ +
5365  {
+
5366  m_it.array_iterator = m_object->m_value.array->end();
+
5367  break;
+
5368  }
+
5369 
+
5370  default:
+
5371  {
+
5372  m_it.primitive_iterator.set_end();
+
5373  break;
+
5374  }
+
5375  }
+
5376  }
+
5377 
+
5378  public:
+ +
5381  {
+
5382  switch (m_object->m_type)
+
5383  {
+ +
5385  {
+
5386  return m_it.object_iterator->second;
5387  }
-
5388  }
-
5389 
-
5390  return *this;
-
5391  }
-
5392 
-
5394  bool operator==(const const_iterator& other) const
-
5395  {
-
5396  // if objects are not the same, the comparison is undefined
-
5397  if (m_object != other.m_object)
-
5398  {
-
5399  throw std::domain_error("cannot compare iterators of different containers");
-
5400  }
-
5401 
-
5402  switch (m_object->m_type)
-
5403  {
- -
5405  {
-
5406  return (m_it.object_iterator == other.m_it.object_iterator);
-
5407  }
-
5408 
- -
5410  {
-
5411  return (m_it.array_iterator == other.m_it.array_iterator);
-
5412  }
-
5413 
-
5414  default:
-
5415  {
-
5416  return (m_it.primitive_iterator == other.m_it.primitive_iterator);
-
5417  }
-
5418  }
-
5419  }
-
5420 
-
5422  bool operator!=(const const_iterator& other) const
-
5423  {
-
5424  return not operator==(other);
-
5425  }
-
5426 
-
5428  bool operator<(const const_iterator& other) const
-
5429  {
-
5430  // if objects are not the same, the comparison is undefined
-
5431  if (m_object != other.m_object)
-
5432  {
-
5433  throw std::domain_error("cannot compare iterators of different containers");
-
5434  }
-
5435 
-
5436  switch (m_object->m_type)
-
5437  {
- -
5439  {
-
5440  throw std::domain_error("cannot use operator< for object iterators");
-
5441  }
-
5442 
- -
5444  {
-
5445  return (m_it.array_iterator < other.m_it.array_iterator);
-
5446  }
-
5447 
-
5448  default:
-
5449  {
-
5450  return (m_it.primitive_iterator < other.m_it.primitive_iterator);
-
5451  }
-
5452  }
-
5453  }
-
5454 
-
5456  bool operator<=(const const_iterator& other) const
-
5457  {
-
5458  return not other.operator < (*this);
-
5459  }
-
5460 
-
5462  bool operator>(const const_iterator& other) const
-
5463  {
-
5464  return not operator<=(other);
+
5388 
+ +
5390  {
+
5391  return *m_it.array_iterator;
+
5392  }
+
5393 
+ +
5395  {
+
5396  throw std::out_of_range("cannot get value");
+
5397  }
+
5398 
+
5399  default:
+
5400  {
+
5401  return m_it.primitive_iterator.is_begin()
+
5402  ? *m_object
+
5403  : throw std::out_of_range("cannot get value");
+
5404  }
+
5405  }
+
5406  }
+
5407 
+ +
5410  {
+
5411  switch (m_object->m_type)
+
5412  {
+ +
5414  {
+
5415  return &(m_it.object_iterator->second);
+
5416  }
+
5417 
+ +
5419  {
+
5420  return &*m_it.array_iterator;
+
5421  }
+
5422 
+
5423  default:
+
5424  {
+
5425  return m_it.primitive_iterator.is_begin()
+
5426  ? m_object
+
5427  : throw std::out_of_range("cannot get value");
+
5428  }
+
5429  }
+
5430  }
+
5431 
+ +
5434  {
+
5435  auto result = *this;
+
5436  ++(*this);
+
5437  return result;
+
5438  }
+
5439 
+ +
5442  {
+
5443  switch (m_object->m_type)
+
5444  {
+ +
5446  {
+
5447  ++m_it.object_iterator;
+
5448  break;
+
5449  }
+
5450 
+ +
5452  {
+
5453  ++m_it.array_iterator;
+
5454  break;
+
5455  }
+
5456 
+
5457  default:
+
5458  {
+
5459  ++m_it.primitive_iterator;
+
5460  break;
+
5461  }
+
5462  }
+
5463 
+
5464  return *this;
5465  }
5466 
-
5468  bool operator>=(const const_iterator& other) const
-
5469  {
-
5470  return not operator<(other);
-
5471  }
-
5472 
- -
5475  {
-
5476  switch (m_object->m_type)
-
5477  {
- -
5479  {
-
5480  throw std::domain_error("cannot use operator+= for object iterators");
-
5481  }
-
5482 
- -
5484  {
-
5485  m_it.array_iterator += i;
-
5486  break;
-
5487  }
-
5488 
-
5489  default:
-
5490  {
-
5491  m_it.primitive_iterator += i;
-
5492  break;
-
5493  }
-
5494  }
-
5495 
-
5496  return *this;
-
5497  }
+ +
5469  {
+
5470  auto result = *this;
+
5471  --(*this);
+
5472  return result;
+
5473  }
+
5474 
+ +
5477  {
+
5478  switch (m_object->m_type)
+
5479  {
+ +
5481  {
+
5482  --m_it.object_iterator;
+
5483  break;
+
5484  }
+
5485 
+ +
5487  {
+
5488  --m_it.array_iterator;
+
5489  break;
+
5490  }
+
5491 
+
5492  default:
+
5493  {
+
5494  --m_it.primitive_iterator;
+
5495  break;
+
5496  }
+
5497  }
5498 
- -
5501  {
-
5502  return operator+=(-i);
-
5503  }
-
5504 
- -
5507  {
-
5508  auto result = *this;
-
5509  result += i;
-
5510  return result;
-
5511  }
-
5512 
- -
5515  {
-
5516  auto result = *this;
-
5517  result -= i;
-
5518  return result;
-
5519  }
-
5520 
- -
5523  {
-
5524  switch (m_object->m_type)
-
5525  {
- -
5527  {
-
5528  throw std::domain_error("cannot use operator- for object iterators");
-
5529  }
-
5530 
- -
5532  {
-
5533  return m_it.array_iterator - other.m_it.array_iterator;
-
5534  }
+
5499  return *this;
+
5500  }
+
5501 
+
5503  bool operator==(const const_iterator& other) const
+
5504  {
+
5505  // if objects are not the same, the comparison is undefined
+
5506  if (m_object != other.m_object)
+
5507  {
+
5508  throw std::domain_error("cannot compare iterators of different containers");
+
5509  }
+
5510 
+
5511  switch (m_object->m_type)
+
5512  {
+ +
5514  {
+
5515  return (m_it.object_iterator == other.m_it.object_iterator);
+
5516  }
+
5517 
+ +
5519  {
+
5520  return (m_it.array_iterator == other.m_it.array_iterator);
+
5521  }
+
5522 
+
5523  default:
+
5524  {
+
5525  return (m_it.primitive_iterator == other.m_it.primitive_iterator);
+
5526  }
+
5527  }
+
5528  }
+
5529 
+
5531  bool operator!=(const const_iterator& other) const
+
5532  {
+
5533  return not operator==(other);
+
5534  }
5535 
-
5536  default:
-
5537  {
-
5538  return m_it.primitive_iterator - other.m_it.primitive_iterator;
-
5539  }
-
5540  }
-
5541  }
-
5542 
- -
5545  {
-
5546  switch (m_object->m_type)
-
5547  {
- -
5549  {
-
5550  throw std::domain_error("cannot use operator[] for object iterators");
-
5551  }
-
5552 
- -
5554  {
-
5555  return *(m_it.array_iterator + n);
-
5556  }
-
5557 
- -
5559  {
-
5560  throw std::out_of_range("cannot get value");
-
5561  }
-
5562 
-
5563  default:
-
5564  {
-
5565  if (m_it.primitive_iterator == -n)
-
5566  {
-
5567  return *m_object;
-
5568  }
-
5569  else
-
5570  {
-
5571  throw std::out_of_range("cannot get value");
-
5572  }
-
5573  }
-
5574  }
-
5575  }
-
5576 
-
5578  typename object_t::key_type key() const
-
5579  {
-
5580  if (m_object->is_object())
-
5581  {
-
5582  return m_it.object_iterator->first;
-
5583  }
-
5584  else
-
5585  {
-
5586  throw std::domain_error("cannot use key() for non-object iterators");
-
5587  }
-
5588  }
-
5589 
- -
5592  {
-
5593  return operator*();
-
5594  }
-
5595 
-
5596  private:
-
5598  pointer m_object = nullptr;
-
5600  internal_iterator m_it = internal_iterator();
-
5601  };
-
5602 
-
5613  class iterator : public const_iterator
-
5614  {
-
5615  public:
- -
5617  using pointer = typename basic_json::pointer;
- -
5619 
-
5621  iterator() = default;
-
5622 
-
5624  iterator(pointer object) noexcept : base_iterator(object)
-
5625  {}
-
5626 
-
5628  iterator(const iterator& other) noexcept
-
5629  : base_iterator(other)
-
5630  {}
-
5631 
-
5633  iterator& operator=(iterator other) noexcept(
-
5634  std::is_nothrow_move_constructible<pointer>::value and
-
5635  std::is_nothrow_move_assignable<pointer>::value and
-
5636  std::is_nothrow_move_constructible<internal_iterator>::value and
-
5637  std::is_nothrow_move_assignable<internal_iterator>::value
-
5638  )
-
5639  {
-
5640  base_iterator::operator=(other);
-
5641  return *this;
-
5642  }
-
5643 
- -
5646  {
-
5647  return const_cast<reference>(base_iterator::operator*());
-
5648  }
-
5649 
- -
5652  {
-
5653  return const_cast<pointer>(base_iterator::operator->());
-
5654  }
-
5655 
- -
5658  {
-
5659  iterator result = *this;
- -
5661  return result;
-
5662  }
-
5663 
- -
5666  {
- -
5668  return *this;
-
5669  }
-
5670 
- -
5673  {
-
5674  iterator result = *this;
- -
5676  return result;
-
5677  }
-
5678 
- -
5681  {
- -
5683  return *this;
-
5684  }
-
5685 
- -
5688  {
- -
5690  return *this;
-
5691  }
-
5692 
- -
5695  {
- -
5697  return *this;
-
5698  }
-
5699 
- -
5702  {
-
5703  auto result = *this;
-
5704  result += i;
-
5705  return result;
-
5706  }
-
5707 
- -
5710  {
-
5711  auto result = *this;
-
5712  result -= i;
-
5713  return result;
-
5714  }
-
5715 
-
5716  difference_type operator-(const iterator& other) const
-
5717  {
-
5718  return base_iterator::operator-(other);
-
5719  }
+
5537  bool operator<(const const_iterator& other) const
+
5538  {
+
5539  // if objects are not the same, the comparison is undefined
+
5540  if (m_object != other.m_object)
+
5541  {
+
5542  throw std::domain_error("cannot compare iterators of different containers");
+
5543  }
+
5544 
+
5545  switch (m_object->m_type)
+
5546  {
+ +
5548  {
+
5549  throw std::domain_error("cannot use operator< for object iterators");
+
5550  }
+
5551 
+ +
5553  {
+
5554  return (m_it.array_iterator < other.m_it.array_iterator);
+
5555  }
+
5556 
+
5557  default:
+
5558  {
+
5559  return (m_it.primitive_iterator < other.m_it.primitive_iterator);
+
5560  }
+
5561  }
+
5562  }
+
5563 
+
5565  bool operator<=(const const_iterator& other) const
+
5566  {
+
5567  return not other.operator < (*this);
+
5568  }
+
5569 
+
5571  bool operator>(const const_iterator& other) const
+
5572  {
+
5573  return not operator<=(other);
+
5574  }
+
5575 
+
5577  bool operator>=(const const_iterator& other) const
+
5578  {
+
5579  return not operator<(other);
+
5580  }
+
5581 
+ +
5584  {
+
5585  switch (m_object->m_type)
+
5586  {
+ +
5588  {
+
5589  throw std::domain_error("cannot use operator+= for object iterators");
+
5590  }
+
5591 
+ +
5593  {
+
5594  m_it.array_iterator += i;
+
5595  break;
+
5596  }
+
5597 
+
5598  default:
+
5599  {
+
5600  m_it.primitive_iterator += i;
+
5601  break;
+
5602  }
+
5603  }
+
5604 
+
5605  return *this;
+
5606  }
+
5607 
+ +
5610  {
+
5611  return operator+=(-i);
+
5612  }
+
5613 
+ +
5616  {
+
5617  auto result = *this;
+
5618  result += i;
+
5619  return result;
+
5620  }
+
5621 
+ +
5624  {
+
5625  auto result = *this;
+
5626  result -= i;
+
5627  return result;
+
5628  }
+
5629 
+ +
5632  {
+
5633  switch (m_object->m_type)
+
5634  {
+ +
5636  {
+
5637  throw std::domain_error("cannot use operator- for object iterators");
+
5638  }
+
5639 
+ +
5641  {
+
5642  return m_it.array_iterator - other.m_it.array_iterator;
+
5643  }
+
5644 
+
5645  default:
+
5646  {
+
5647  return m_it.primitive_iterator - other.m_it.primitive_iterator;
+
5648  }
+
5649  }
+
5650  }
+
5651 
+ +
5654  {
+
5655  switch (m_object->m_type)
+
5656  {
+ +
5658  {
+
5659  throw std::domain_error("cannot use operator[] for object iterators");
+
5660  }
+
5661 
+ +
5663  {
+
5664  return *(m_it.array_iterator + n);
+
5665  }
+
5666 
+ +
5668  {
+
5669  throw std::out_of_range("cannot get value");
+
5670  }
+
5671 
+
5672  default:
+
5673  {
+
5674  return (m_it.primitive_iterator == -n)
+
5675  ? *m_object
+
5676  : throw std::out_of_range("cannot get value");
+
5677  }
+
5678  }
+
5679  }
+
5680 
+
5682  typename object_t::key_type key() const
+
5683  {
+
5684  return m_object->is_object()
+
5685  ? m_it.object_iterator->first
+
5686  : throw std::domain_error("cannot use key() for non-object iterators");
+
5687  }
+
5688 
+ +
5691  {
+
5692  return operator*();
+
5693  }
+
5694 
+
5695  private:
+
5697  pointer m_object = nullptr;
+
5699  internal_iterator m_it = internal_iterator();
+
5700  };
+
5701 
+
5714  class iterator : public const_iterator
+
5715  {
+
5716  public:
+ +
5718  using pointer = typename basic_json::pointer;
+
5720 
- -
5723  {
-
5724  return const_cast<reference>(base_iterator::operator[](n));
-
5725  }
-
5726 
- -
5729  {
-
5730  return const_cast<reference>(base_iterator::value());
-
5731  }
-
5732  };
-
5733 
-
5749  template<typename Base>
-
5750  class json_reverse_iterator : public std::reverse_iterator<Base>
-
5751  {
-
5752  public:
-
5754  using base_iterator = std::reverse_iterator<Base>;
-
5756  using reference = typename Base::reference;
-
5757 
-
5759  json_reverse_iterator(const typename base_iterator::iterator_type& it)
-
5760  : base_iterator(it) {}
-
5761 
- +
5722  iterator() = default;
+
5723 
+
5725  iterator(pointer object) noexcept : base_iterator(object)
+
5726  {}
+
5727 
+
5729  iterator(const iterator& other) noexcept
+
5730  : base_iterator(other)
+
5731  {}
+
5732 
+
5734  iterator& operator=(iterator other) noexcept(
+
5735  std::is_nothrow_move_constructible<pointer>::value and
+
5736  std::is_nothrow_move_assignable<pointer>::value and
+
5737  std::is_nothrow_move_constructible<internal_iterator>::value and
+
5738  std::is_nothrow_move_assignable<internal_iterator>::value
+
5739  )
+
5740  {
+
5741  base_iterator::operator=(other);
+
5742  return *this;
+
5743  }
+
5744 
+ +
5747  {
+
5748  return const_cast<reference>(base_iterator::operator*());
+
5749  }
+
5750 
+ +
5753  {
+
5754  return const_cast<pointer>(base_iterator::operator->());
+
5755  }
+
5756 
+ +
5759  {
+
5760  iterator result = *this;
+ +
5762  return result;
+
5763  }
5764 
- +
5767  {
-
5768  return base_iterator::operator++(1);
-
5769  }
-
5770 
- -
5773  {
-
5774  base_iterator::operator++();
-
5775  return *this;
-
5776  }
-
5777 
- -
5780  {
-
5781  return base_iterator::operator--(1);
-
5782  }
-
5783 
- -
5786  {
-
5787  base_iterator::operator--();
-
5788  return *this;
-
5789  }
-
5790 
- -
5793  {
-
5794  base_iterator::operator+=(i);
-
5795  return *this;
-
5796  }
-
5797 
- -
5800  {
-
5801  auto result = *this;
-
5802  result += i;
-
5803  return result;
-
5804  }
-
5805 
- -
5808  {
-
5809  auto result = *this;
-
5810  result -= i;
-
5811  return result;
-
5812  }
-
5813 
- -
5816  {
-
5817  return this->base() - other.base();
-
5818  }
-
5819 
- -
5822  {
-
5823  return *(this->operator+(n));
-
5824  }
-
5825 
-
5827  typename object_t::key_type key() const
-
5828  {
-
5829  auto it = --this->base();
-
5830  return it.key();
-
5831  }
-
5832 
- -
5835  {
-
5836  auto it = --this->base();
-
5837  return it.operator * ();
-
5838  }
-
5839  };
-
5840 
- -
5849  {
-
5850  private:
-
5852  basic_json& container;
-
5854  using json_iterator = decltype(std::begin(container));
-
5855 
-
5857  class iterator_wrapper_internal
-
5858  {
-
5859  private:
-
5861  json_iterator anchor;
-
5863  size_t array_index = 0;
+ +
5769  return *this;
+
5770  }
+
5771 
+ +
5774  {
+
5775  iterator result = *this;
+ +
5777  return result;
+
5778  }
+
5779 
+ +
5782  {
+ +
5784  return *this;
+
5785  }
+
5786 
+ +
5789  {
+ +
5791  return *this;
+
5792  }
+
5793 
+ +
5796  {
+ +
5798  return *this;
+
5799  }
+
5800 
+ +
5803  {
+
5804  auto result = *this;
+
5805  result += i;
+
5806  return result;
+
5807  }
+
5808 
+ +
5811  {
+
5812  auto result = *this;
+
5813  result -= i;
+
5814  return result;
+
5815  }
+
5816 
+
5817  difference_type operator-(const iterator& other) const
+
5818  {
+
5819  return base_iterator::operator-(other);
+
5820  }
+
5821 
+ +
5824  {
+
5825  return const_cast<reference>(base_iterator::operator[](n));
+
5826  }
+
5827 
+ +
5830  {
+
5831  return const_cast<reference>(base_iterator::value());
+
5832  }
+
5833  };
+
5834 
+
5852  template<typename Base>
+
5853  class json_reverse_iterator : public std::reverse_iterator<Base>
+
5854  {
+
5855  public:
+
5857  using base_iterator = std::reverse_iterator<Base>;
+
5859  using reference = typename Base::reference;
+
5860 
+
5862  json_reverse_iterator(const typename base_iterator::iterator_type& it)
+
5863  : base_iterator(it) {}
5864 
-
5865  public:
-
5867  iterator_wrapper_internal(json_iterator i) : anchor(i)
-
5868  {}
-
5869 
-
5871  iterator_wrapper_internal& operator*()
-
5872  {
-
5873  return *this;
-
5874  }
-
5875 
-
5877  iterator_wrapper_internal& operator++()
-
5878  {
-
5879  ++anchor;
-
5880  ++array_index;
-
5881 
-
5882  return *this;
-
5883  }
-
5884 
-
5886  bool operator!= (const iterator_wrapper_internal& o)
-
5887  {
-
5888  return anchor != o.anchor;
-
5889  }
-
5890 
-
5892  typename basic_json::string_t key() const
-
5893  {
-
5894  switch (anchor.m_object->type())
-
5895  {
-
5897  case value_t::array:
-
5898  {
-
5899  return std::to_string(array_index);
-
5900  }
-
5901 
-
5903  case value_t::object:
-
5904  {
-
5905  return anchor.key();
-
5906  }
-
5907 
-
5909  default:
-
5910  {
-
5911  return "";
-
5912  }
-
5913  }
-
5914  }
-
5915 
-
5917  typename json_iterator::reference value() const
-
5918  {
-
5919  return anchor.value();
-
5920  }
-
5921  };
+ +
5867 
+ +
5870  {
+
5871  return base_iterator::operator++(1);
+
5872  }
+
5873 
+ +
5876  {
+
5877  base_iterator::operator++();
+
5878  return *this;
+
5879  }
+
5880 
+ +
5883  {
+
5884  return base_iterator::operator--(1);
+
5885  }
+
5886 
+ +
5889  {
+
5890  base_iterator::operator--();
+
5891  return *this;
+
5892  }
+
5893 
+ +
5896  {
+
5897  base_iterator::operator+=(i);
+
5898  return *this;
+
5899  }
+
5900 
+ +
5903  {
+
5904  auto result = *this;
+
5905  result += i;
+
5906  return result;
+
5907  }
+
5908 
+ +
5911  {
+
5912  auto result = *this;
+
5913  result -= i;
+
5914  return result;
+
5915  }
+
5916 
+ +
5919  {
+
5920  return this->base() - other.base();
+
5921  }
5922 
-
5923  public:
-
5925  iterator_wrapper(basic_json& cont)
-
5926  : container(cont)
-
5927  {}
+ +
5925  {
+
5926  return *(this->operator+(n));
+
5927  }
5928 
-
5930  iterator_wrapper_internal begin()
-
5931  {
-
5932  return iterator_wrapper_internal(container.begin());
-
5933  }
-
5934 
-
5936  iterator_wrapper_internal end()
-
5937  {
-
5938  return iterator_wrapper_internal(container.end());
-
5939  }
-
5940  };
-
5941 
-
5942  private:
-
5944  // lexer and parser //
-
5946 
-
5954  class lexer
-
5955  {
-
5956  public:
-
5958  enum class token_type
-
5959  {
-
5960  uninitialized,
-
5961  literal_true,
-
5962  literal_false,
-
5963  literal_null,
-
5964  value_string,
-
5965  value_number,
-
5966  begin_array,
-
5967  begin_object,
-
5968  end_array,
-
5969  end_object,
-
5970  name_separator,
-
5971  value_separator,
-
5972  parse_error,
-
5973  end_of_input
-
5974  };
-
5975 
-
5977  using lexer_char_t = unsigned char;
+
5930  typename object_t::key_type key() const
+
5931  {
+
5932  auto it = --this->base();
+
5933  return it.key();
+
5934  }
+
5935 
+ +
5938  {
+
5939  auto it = --this->base();
+
5940  return it.operator * ();
+
5941  }
+
5942  };
+
5943 
+ +
5952  {
+
5953  private:
+
5955  basic_json& container;
+
5957  using json_iterator = decltype(std::begin(container));
+
5958 
+
5960  class iterator_wrapper_internal
+
5961  {
+
5962  private:
+
5964  json_iterator anchor;
+
5966  size_t array_index = 0;
+
5967 
+
5968  public:
+
5970  iterator_wrapper_internal(json_iterator i) : anchor(i)
+
5971  {}
+
5972 
+
5974  iterator_wrapper_internal& operator*()
+
5975  {
+
5976  return *this;
+
5977  }
5978 
-
5980  explicit lexer(const string_t& s) noexcept
-
5981  : m_stream(nullptr), m_buffer(s)
-
5982  {
-
5983  m_content = reinterpret_cast<const lexer_char_t*>(s.c_str());
-
5984  m_start = m_cursor = m_content;
-
5985  m_limit = m_content + s.size();
-
5986  }
-
5987  explicit lexer(std::istream* s) noexcept
-
5988  : m_stream(s), m_buffer()
-
5989  {
-
5990  getline(*m_stream, m_buffer);
-
5991  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
-
5992  m_start = m_cursor = m_content;
-
5993  m_limit = m_content + m_buffer.size();
-
5994  }
-
5995 
-
5997  lexer() = default;
-
5998 
-
5999  // switch of unwanted functions
-
6000  lexer(const lexer&) = delete;
-
6001  lexer operator=(const lexer&) = delete;
-
6002 
-
6014  static string_t to_unicode(const std::size_t codepoint1,
-
6015  const std::size_t codepoint2 = 0)
-
6016  {
-
6017  string_t result;
+
5980  iterator_wrapper_internal& operator++()
+
5981  {
+
5982  ++anchor;
+
5983  ++array_index;
+
5984 
+
5985  return *this;
+
5986  }
+
5987 
+
5989  bool operator!= (const iterator_wrapper_internal& o)
+
5990  {
+
5991  return anchor != o.anchor;
+
5992  }
+
5993 
+
5995  typename basic_json::string_t key() const
+
5996  {
+
5997  switch (anchor.m_object->type())
+
5998  {
+
5999  // use integer array index as key
+
6000  case value_t::array:
+
6001  {
+
6002  return std::to_string(array_index);
+
6003  }
+
6004 
+
6005  // use key from the object
+
6006  case value_t::object:
+
6007  {
+
6008  return anchor.key();
+
6009  }
+
6010 
+
6011  // use an empty key for all primitive types
+
6012  default:
+
6013  {
+
6014  return "";
+
6015  }
+
6016  }
+
6017  }
6018 
-
6019  // calculate the codepoint from the given code points
-
6020  std::size_t codepoint = codepoint1;
-
6021 
-
6022  // check if codepoint1 is a high surrogate
-
6023  if (codepoint1 >= 0xD800 and codepoint1 <= 0xDBFF)
-
6024  {
-
6025  // check if codepoint2 is a low surrogate
-
6026  if (codepoint2 >= 0xDC00 and codepoint2 <= 0xDFFF)
-
6027  {
-
6028  codepoint =
-
6029  // high surrogate occupies the most significant 22 bits
-
6030  (codepoint1 << 10)
-
6031  // low surrogate occupies the least significant 15 bits
-
6032  + codepoint2
-
6033  // there is still the 0xD800, 0xDC00 and 0x10000 noise
-
6034  // in the result so we have to substract with:
-
6035  // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
-
6036  - 0x35FDC00;
-
6037  }
-
6038  else
-
6039  {
-
6040  throw std::invalid_argument("missing or wrong low surrogate");
-
6041  }
-
6042  }
-
6043 
-
6044  if (codepoint < 0x80)
-
6045  {
-
6046  // 1-byte characters: 0xxxxxxx (ASCII)
-
6047  result.append(1, static_cast<typename string_t::value_type>(codepoint));
-
6048  }
-
6049  else if (codepoint <= 0x7ff)
-
6050  {
-
6051  // 2-byte characters: 110xxxxx 10xxxxxx
-
6052  result.append(1, static_cast<typename string_t::value_type>(0xC0 | ((codepoint >> 6) & 0x1F)));
-
6053  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
-
6054  }
-
6055  else if (codepoint <= 0xffff)
-
6056  {
-
6057  // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
-
6058  result.append(1, static_cast<typename string_t::value_type>(0xE0 | ((codepoint >> 12) & 0x0F)));
-
6059  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
-
6060  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
-
6061  }
-
6062  else if (codepoint <= 0x10ffff)
-
6063  {
-
6064  // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-
6065  result.append(1, static_cast<typename string_t::value_type>(0xF0 | ((codepoint >> 18) & 0x07)));
-
6066  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 12) & 0x3F)));
-
6067  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
-
6068  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
-
6069  }
-
6070  else
-
6071  {
-
6072  throw std::out_of_range("code points above 0x10FFFF are invalid");
-
6073  }
-
6074 
-
6075  return result;
-
6076  }
-
6077 
-
6079  static std::string token_type_name(token_type t)
-
6080  {
-
6081  switch (t)
-
6082  {
-
6083  case token_type::uninitialized:
-
6084  return "<uninitialized>";
-
6085  case token_type::literal_true:
-
6086  return "true literal";
-
6087  case token_type::literal_false:
-
6088  return "false literal";
-
6089  case token_type::literal_null:
-
6090  return "null literal";
-
6091  case token_type::value_string:
-
6092  return "string literal";
-
6093  case token_type::value_number:
-
6094  return "number literal";
-
6095  case token_type::begin_array:
-
6096  return "[";
-
6097  case token_type::begin_object:
-
6098  return "{";
-
6099  case token_type::end_array:
-
6100  return "]";
-
6101  case token_type::end_object:
-
6102  return "}";
-
6103  case token_type::name_separator:
-
6104  return ":";
-
6105  case token_type::value_separator:
-
6106  return ",";
-
6107  case token_type::end_of_input:
-
6108  return "<end of input>";
-
6109  case token_type::parse_error:
-
6110  return "<parse error>";
-
6111  }
-
6112  }
-
6113 
-
6124  token_type scan() noexcept
-
6125  {
-
6126  // pointer for backtracking information
-
6127  m_marker = nullptr;
-
6128 
-
6129  // remember the begin of the token
-
6130  m_start = m_cursor;
-
6131 
-
6132 
-
6133  {
-
6134  lexer_char_t yych;
-
6135  unsigned int yyaccept = 0;
-
6136  static const unsigned char yybm[] =
-
6137  {
-
6138  0, 0, 0, 0, 0, 0, 0, 0,
-
6139  0, 32, 32, 0, 0, 32, 0, 0,
-
6140  64, 64, 64, 64, 64, 64, 64, 64,
-
6141  64, 64, 64, 64, 64, 64, 64, 64,
-
6142  96, 64, 0, 64, 64, 64, 64, 64,
-
6143  64, 64, 64, 64, 64, 64, 64, 64,
-
6144  192, 192, 192, 192, 192, 192, 192, 192,
-
6145  192, 192, 64, 64, 64, 64, 64, 64,
-
6146  64, 64, 64, 64, 64, 64, 64, 64,
-
6147  64, 64, 64, 64, 64, 64, 64, 64,
-
6148  64, 64, 64, 64, 64, 64, 64, 64,
-
6149  64, 64, 64, 64, 0, 64, 64, 64,
-
6150  64, 64, 64, 64, 64, 64, 64, 64,
-
6151  64, 64, 64, 64, 64, 64, 64, 64,
-
6152  64, 64, 64, 64, 64, 64, 64, 64,
-
6153  64, 64, 64, 64, 64, 64, 64, 64,
-
6154  64, 64, 64, 64, 64, 64, 64, 64,
-
6155  64, 64, 64, 64, 64, 64, 64, 64,
-
6156  64, 64, 64, 64, 64, 64, 64, 64,
-
6157  64, 64, 64, 64, 64, 64, 64, 64,
-
6158  64, 64, 64, 64, 64, 64, 64, 64,
-
6159  64, 64, 64, 64, 64, 64, 64, 64,
-
6160  64, 64, 64, 64, 64, 64, 64, 64,
-
6161  64, 64, 64, 64, 64, 64, 64, 64,
-
6162  64, 64, 64, 64, 64, 64, 64, 64,
-
6163  64, 64, 64, 64, 64, 64, 64, 64,
-
6164  64, 64, 64, 64, 64, 64, 64, 64,
-
6165  64, 64, 64, 64, 64, 64, 64, 64,
-
6166  64, 64, 64, 64, 64, 64, 64, 64,
-
6167  64, 64, 64, 64, 64, 64, 64, 64,
-
6168  64, 64, 64, 64, 64, 64, 64, 64,
-
6169  64, 64, 64, 64, 64, 64, 64, 64,
-
6170  };
-
6171  if ((m_limit - m_cursor) < 5)
-
6172  {
-
6173  yyfill(); // LCOV_EXCL_LINE;
-
6174  }
-
6175  yych = *m_cursor;
-
6176  if (yych <= ':')
-
6177  {
-
6178  if (yych <= ' ')
-
6179  {
-
6180  if (yych <= '\n')
-
6181  {
-
6182  if (yych <= 0x00)
-
6183  {
-
6184  goto basic_json_parser_28;
-
6185  }
-
6186  if (yych <= 0x08)
-
6187  {
-
6188  goto basic_json_parser_30;
-
6189  }
-
6190  if (yych >= '\n')
-
6191  {
-
6192  goto basic_json_parser_4;
-
6193  }
-
6194  }
-
6195  else
-
6196  {
-
6197  if (yych == '\r')
-
6198  {
-
6199  goto basic_json_parser_2;
-
6200  }
-
6201  if (yych <= 0x1F)
-
6202  {
-
6203  goto basic_json_parser_30;
-
6204  }
-
6205  }
-
6206  }
-
6207  else
-
6208  {
-
6209  if (yych <= ',')
-
6210  {
-
6211  if (yych == '"')
-
6212  {
-
6213  goto basic_json_parser_27;
-
6214  }
-
6215  if (yych <= '+')
-
6216  {
-
6217  goto basic_json_parser_30;
-
6218  }
-
6219  goto basic_json_parser_16;
-
6220  }
-
6221  else
-
6222  {
-
6223  if (yych <= '/')
-
6224  {
-
6225  if (yych <= '-')
-
6226  {
-
6227  goto basic_json_parser_23;
-
6228  }
-
6229  goto basic_json_parser_30;
-
6230  }
-
6231  else
-
6232  {
-
6233  if (yych <= '0')
-
6234  {
-
6235  goto basic_json_parser_24;
-
6236  }
-
6237  if (yych <= '9')
-
6238  {
-
6239  goto basic_json_parser_26;
-
6240  }
-
6241  goto basic_json_parser_18;
-
6242  }
-
6243  }
-
6244  }
-
6245  }
-
6246  else
-
6247  {
-
6248  if (yych <= 'n')
-
6249  {
-
6250  if (yych <= ']')
-
6251  {
-
6252  if (yych == '[')
-
6253  {
-
6254  goto basic_json_parser_8;
-
6255  }
-
6256  if (yych <= '\\')
-
6257  {
-
6258  goto basic_json_parser_30;
-
6259  }
-
6260  goto basic_json_parser_10;
-
6261  }
-
6262  else
-
6263  {
-
6264  if (yych == 'f')
-
6265  {
-
6266  goto basic_json_parser_22;
-
6267  }
-
6268  if (yych <= 'm')
-
6269  {
-
6270  goto basic_json_parser_30;
-
6271  }
-
6272  goto basic_json_parser_20;
-
6273  }
-
6274  }
-
6275  else
-
6276  {
-
6277  if (yych <= '{')
-
6278  {
-
6279  if (yych == 't')
-
6280  {
-
6281  goto basic_json_parser_21;
-
6282  }
-
6283  if (yych <= 'z')
-
6284  {
-
6285  goto basic_json_parser_30;
-
6286  }
-
6287  goto basic_json_parser_12;
-
6288  }
-
6289  else
-
6290  {
-
6291  if (yych <= '}')
-
6292  {
-
6293  if (yych <= '|')
-
6294  {
-
6295  goto basic_json_parser_30;
-
6296  }
-
6297  goto basic_json_parser_14;
-
6298  }
-
6299  else
-
6300  {
-
6301  if (yych == 0xEF)
-
6302  {
-
6303  goto basic_json_parser_6;
-
6304  }
-
6305  goto basic_json_parser_30;
-
6306  }
-
6307  }
-
6308  }
-
6309  }
-
6310 basic_json_parser_2:
-
6311  ++m_cursor;
-
6312  yych = *m_cursor;
-
6313  goto basic_json_parser_5;
-
6314 basic_json_parser_3:
-
6315  {
-
6316  return scan();
-
6317  }
-
6318 basic_json_parser_4:
-
6319  ++m_cursor;
-
6320  if (m_limit <= m_cursor)
-
6321  {
-
6322  yyfill(); // LCOV_EXCL_LINE;
-
6323  }
-
6324  yych = *m_cursor;
-
6325 basic_json_parser_5:
-
6326  if (yybm[0 + yych] & 32)
-
6327  {
-
6328  goto basic_json_parser_4;
-
6329  }
-
6330  goto basic_json_parser_3;
-
6331 basic_json_parser_6:
-
6332  yyaccept = 0;
-
6333  yych = *(m_marker = ++m_cursor);
-
6334  if (yych == 0xBB)
-
6335  {
-
6336  goto basic_json_parser_64;
-
6337  }
-
6338 basic_json_parser_7:
-
6339  {
-
6340  return token_type::parse_error;
-
6341  }
-
6342 basic_json_parser_8:
-
6343  ++m_cursor;
-
6344  {
-
6345  return token_type::begin_array;
-
6346  }
-
6347 basic_json_parser_10:
-
6348  ++m_cursor;
-
6349  {
-
6350  return token_type::end_array;
-
6351  }
-
6352 basic_json_parser_12:
-
6353  ++m_cursor;
-
6354  {
-
6355  return token_type::begin_object;
-
6356  }
-
6357 basic_json_parser_14:
-
6358  ++m_cursor;
-
6359  {
-
6360  return token_type::end_object;
-
6361  }
-
6362 basic_json_parser_16:
-
6363  ++m_cursor;
-
6364  {
-
6365  return token_type::value_separator;
-
6366  }
-
6367 basic_json_parser_18:
-
6368  ++m_cursor;
-
6369  {
-
6370  return token_type::name_separator;
-
6371  }
-
6372 basic_json_parser_20:
-
6373  yyaccept = 0;
-
6374  yych = *(m_marker = ++m_cursor);
-
6375  if (yych == 'u')
-
6376  {
-
6377  goto basic_json_parser_60;
-
6378  }
-
6379  goto basic_json_parser_7;
-
6380 basic_json_parser_21:
-
6381  yyaccept = 0;
-
6382  yych = *(m_marker = ++m_cursor);
-
6383  if (yych == 'r')
-
6384  {
-
6385  goto basic_json_parser_56;
-
6386  }
-
6387  goto basic_json_parser_7;
-
6388 basic_json_parser_22:
-
6389  yyaccept = 0;
-
6390  yych = *(m_marker = ++m_cursor);
-
6391  if (yych == 'a')
-
6392  {
-
6393  goto basic_json_parser_51;
-
6394  }
-
6395  goto basic_json_parser_7;
-
6396 basic_json_parser_23:
-
6397  yych = *++m_cursor;
-
6398  if (yych <= '/')
-
6399  {
-
6400  goto basic_json_parser_7;
-
6401  }
-
6402  if (yych <= '0')
-
6403  {
-
6404  goto basic_json_parser_50;
-
6405  }
-
6406  if (yych <= '9')
-
6407  {
-
6408  goto basic_json_parser_41;
-
6409  }
-
6410  goto basic_json_parser_7;
-
6411 basic_json_parser_24:
-
6412  yyaccept = 1;
-
6413  yych = *(m_marker = ++m_cursor);
-
6414  if (yych <= 'D')
-
6415  {
-
6416  if (yych == '.')
-
6417  {
-
6418  goto basic_json_parser_43;
-
6419  }
+
6020  typename json_iterator::reference value() const
+
6021  {
+
6022  return anchor.value();
+
6023  }
+
6024  };
+
6025 
+
6026  public:
+
6028  iterator_wrapper(basic_json& cont)
+
6029  : container(cont)
+
6030  {}
+
6031 
+
6033  iterator_wrapper_internal begin()
+
6034  {
+
6035  return iterator_wrapper_internal(container.begin());
+
6036  }
+
6037 
+
6039  iterator_wrapper_internal end()
+
6040  {
+
6041  return iterator_wrapper_internal(container.end());
+
6042  }
+
6043  };
+
6044 
+
6045  private:
+
6047  // lexer and parser //
+
6049 
+
6057  class lexer
+
6058  {
+
6059  public:
+
6061  enum class token_type
+
6062  {
+
6063  uninitialized,
+
6064  literal_true,
+
6065  literal_false,
+
6066  literal_null,
+
6067  value_string,
+
6068  value_number,
+
6069  begin_array,
+
6070  begin_object,
+
6071  end_array,
+
6072  end_object,
+
6073  name_separator,
+
6074  value_separator,
+
6075  parse_error,
+
6076  end_of_input
+
6077  };
+
6078 
+
6080  using lexer_char_t = unsigned char;
+
6081 
+
6083  explicit lexer(const string_t& s) noexcept
+
6084  : m_stream(nullptr), m_buffer(s)
+
6085  {
+
6086  m_content = reinterpret_cast<const lexer_char_t*>(s.c_str());
+
6087  m_start = m_cursor = m_content;
+
6088  m_limit = m_content + s.size();
+
6089  }
+
6090  explicit lexer(std::istream* s) noexcept
+
6091  : m_stream(s), m_buffer()
+
6092  {
+
6093  getline(*m_stream, m_buffer);
+
6094  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
+
6095  m_start = m_cursor = m_content;
+
6096  m_limit = m_content + m_buffer.size();
+
6097  }
+
6098 
+
6100  lexer() = default;
+
6101 
+
6102  // switch of unwanted functions
+
6103  lexer(const lexer&) = delete;
+
6104  lexer operator=(const lexer&) = delete;
+
6105 
+
6117  static string_t to_unicode(const std::size_t codepoint1,
+
6118  const std::size_t codepoint2 = 0)
+
6119  {
+
6120  string_t result;
+
6121 
+
6122  // calculate the codepoint from the given code points
+
6123  std::size_t codepoint = codepoint1;
+
6124 
+
6125  // check if codepoint1 is a high surrogate
+
6126  if (codepoint1 >= 0xD800 and codepoint1 <= 0xDBFF)
+
6127  {
+
6128  // check if codepoint2 is a low surrogate
+
6129  if (codepoint2 >= 0xDC00 and codepoint2 <= 0xDFFF)
+
6130  {
+
6131  codepoint =
+
6132  // high surrogate occupies the most significant 22 bits
+
6133  (codepoint1 << 10)
+
6134  // low surrogate occupies the least significant 15 bits
+
6135  + codepoint2
+
6136  // there is still the 0xD800, 0xDC00 and 0x10000 noise
+
6137  // in the result so we have to substract with:
+
6138  // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
+
6139  - 0x35FDC00;
+
6140  }
+
6141  else
+
6142  {
+
6143  throw std::invalid_argument("missing or wrong low surrogate");
+
6144  }
+
6145  }
+
6146 
+
6147  if (codepoint < 0x80)
+
6148  {
+
6149  // 1-byte characters: 0xxxxxxx (ASCII)
+
6150  result.append(1, static_cast<typename string_t::value_type>(codepoint));
+
6151  }
+
6152  else if (codepoint <= 0x7ff)
+
6153  {
+
6154  // 2-byte characters: 110xxxxx 10xxxxxx
+
6155  result.append(1, static_cast<typename string_t::value_type>(0xC0 | ((codepoint >> 6) & 0x1F)));
+
6156  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
+
6157  }
+
6158  else if (codepoint <= 0xffff)
+
6159  {
+
6160  // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
+
6161  result.append(1, static_cast<typename string_t::value_type>(0xE0 | ((codepoint >> 12) & 0x0F)));
+
6162  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
+
6163  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
+
6164  }
+
6165  else if (codepoint <= 0x10ffff)
+
6166  {
+
6167  // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+
6168  result.append(1, static_cast<typename string_t::value_type>(0xF0 | ((codepoint >> 18) & 0x07)));
+
6169  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 12) & 0x3F)));
+
6170  result.append(1, static_cast<typename string_t::value_type>(0x80 | ((codepoint >> 6) & 0x3F)));
+
6171  result.append(1, static_cast<typename string_t::value_type>(0x80 | (codepoint & 0x3F)));
+
6172  }
+
6173  else
+
6174  {
+
6175  throw std::out_of_range("code points above 0x10FFFF are invalid");
+
6176  }
+
6177 
+
6178  return result;
+
6179  }
+
6180 
+
6182  static std::string token_type_name(token_type t)
+
6183  {
+
6184  switch (t)
+
6185  {
+
6186  case token_type::uninitialized:
+
6187  return "<uninitialized>";
+
6188  case token_type::literal_true:
+
6189  return "true literal";
+
6190  case token_type::literal_false:
+
6191  return "false literal";
+
6192  case token_type::literal_null:
+
6193  return "null literal";
+
6194  case token_type::value_string:
+
6195  return "string literal";
+
6196  case token_type::value_number:
+
6197  return "number literal";
+
6198  case token_type::begin_array:
+
6199  return "[";
+
6200  case token_type::begin_object:
+
6201  return "{";
+
6202  case token_type::end_array:
+
6203  return "]";
+
6204  case token_type::end_object:
+
6205  return "}";
+
6206  case token_type::name_separator:
+
6207  return ":";
+
6208  case token_type::value_separator:
+
6209  return ",";
+
6210  case token_type::end_of_input:
+
6211  return "<end of input>";
+
6212  case token_type::parse_error:
+
6213  return "<parse error>";
+
6214  }
+
6215  }
+
6216 
+
6227  token_type scan() noexcept
+
6228  {
+
6229  // pointer for backtracking information
+
6230  m_marker = nullptr;
+
6231 
+
6232  // remember the begin of the token
+
6233  m_start = m_cursor;
+
6234 
+
6235 
+
6236  {
+
6237  lexer_char_t yych;
+
6238  unsigned int yyaccept = 0;
+
6239  static const unsigned char yybm[] =
+
6240  {
+
6241  0, 0, 0, 0, 0, 0, 0, 0,
+
6242  0, 32, 32, 0, 0, 32, 0, 0,
+
6243  64, 64, 64, 64, 64, 64, 64, 64,
+
6244  64, 64, 64, 64, 64, 64, 64, 64,
+
6245  96, 64, 0, 64, 64, 64, 64, 64,
+
6246  64, 64, 64, 64, 64, 64, 64, 64,
+
6247  192, 192, 192, 192, 192, 192, 192, 192,
+
6248  192, 192, 64, 64, 64, 64, 64, 64,
+
6249  64, 64, 64, 64, 64, 64, 64, 64,
+
6250  64, 64, 64, 64, 64, 64, 64, 64,
+
6251  64, 64, 64, 64, 64, 64, 64, 64,
+
6252  64, 64, 64, 64, 0, 64, 64, 64,
+
6253  64, 64, 64, 64, 64, 64, 64, 64,
+
6254  64, 64, 64, 64, 64, 64, 64, 64,
+
6255  64, 64, 64, 64, 64, 64, 64, 64,
+
6256  64, 64, 64, 64, 64, 64, 64, 64,
+
6257  64, 64, 64, 64, 64, 64, 64, 64,
+
6258  64, 64, 64, 64, 64, 64, 64, 64,
+
6259  64, 64, 64, 64, 64, 64, 64, 64,
+
6260  64, 64, 64, 64, 64, 64, 64, 64,
+
6261  64, 64, 64, 64, 64, 64, 64, 64,
+
6262  64, 64, 64, 64, 64, 64, 64, 64,
+
6263  64, 64, 64, 64, 64, 64, 64, 64,
+
6264  64, 64, 64, 64, 64, 64, 64, 64,
+
6265  64, 64, 64, 64, 64, 64, 64, 64,
+
6266  64, 64, 64, 64, 64, 64, 64, 64,
+
6267  64, 64, 64, 64, 64, 64, 64, 64,
+
6268  64, 64, 64, 64, 64, 64, 64, 64,
+
6269  64, 64, 64, 64, 64, 64, 64, 64,
+
6270  64, 64, 64, 64, 64, 64, 64, 64,
+
6271  64, 64, 64, 64, 64, 64, 64, 64,
+
6272  64, 64, 64, 64, 64, 64, 64, 64,
+
6273  };
+
6274  if ((m_limit - m_cursor) < 5)
+
6275  {
+
6276  yyfill(); // LCOV_EXCL_LINE;
+
6277  }
+
6278  yych = *m_cursor;
+
6279  if (yych <= ':')
+
6280  {
+
6281  if (yych <= ' ')
+
6282  {
+
6283  if (yych <= '\n')
+
6284  {
+
6285  if (yych <= 0x00)
+
6286  {
+
6287  goto basic_json_parser_28;
+
6288  }
+
6289  if (yych <= 0x08)
+
6290  {
+
6291  goto basic_json_parser_30;
+
6292  }
+
6293  if (yych >= '\n')
+
6294  {
+
6295  goto basic_json_parser_4;
+
6296  }
+
6297  }
+
6298  else
+
6299  {
+
6300  if (yych == '\r')
+
6301  {
+
6302  goto basic_json_parser_2;
+
6303  }
+
6304  if (yych <= 0x1F)
+
6305  {
+
6306  goto basic_json_parser_30;
+
6307  }
+
6308  }
+
6309  }
+
6310  else
+
6311  {
+
6312  if (yych <= ',')
+
6313  {
+
6314  if (yych == '"')
+
6315  {
+
6316  goto basic_json_parser_27;
+
6317  }
+
6318  if (yych <= '+')
+
6319  {
+
6320  goto basic_json_parser_30;
+
6321  }
+
6322  goto basic_json_parser_16;
+
6323  }
+
6324  else
+
6325  {
+
6326  if (yych <= '/')
+
6327  {
+
6328  if (yych <= '-')
+
6329  {
+
6330  goto basic_json_parser_23;
+
6331  }
+
6332  goto basic_json_parser_30;
+
6333  }
+
6334  else
+
6335  {
+
6336  if (yych <= '0')
+
6337  {
+
6338  goto basic_json_parser_24;
+
6339  }
+
6340  if (yych <= '9')
+
6341  {
+
6342  goto basic_json_parser_26;
+
6343  }
+
6344  goto basic_json_parser_18;
+
6345  }
+
6346  }
+
6347  }
+
6348  }
+
6349  else
+
6350  {
+
6351  if (yych <= 'n')
+
6352  {
+
6353  if (yych <= ']')
+
6354  {
+
6355  if (yych == '[')
+
6356  {
+
6357  goto basic_json_parser_8;
+
6358  }
+
6359  if (yych <= '\\')
+
6360  {
+
6361  goto basic_json_parser_30;
+
6362  }
+
6363  goto basic_json_parser_10;
+
6364  }
+
6365  else
+
6366  {
+
6367  if (yych == 'f')
+
6368  {
+
6369  goto basic_json_parser_22;
+
6370  }
+
6371  if (yych <= 'm')
+
6372  {
+
6373  goto basic_json_parser_30;
+
6374  }
+
6375  goto basic_json_parser_20;
+
6376  }
+
6377  }
+
6378  else
+
6379  {
+
6380  if (yych <= '{')
+
6381  {
+
6382  if (yych == 't')
+
6383  {
+
6384  goto basic_json_parser_21;
+
6385  }
+
6386  if (yych <= 'z')
+
6387  {
+
6388  goto basic_json_parser_30;
+
6389  }
+
6390  goto basic_json_parser_12;
+
6391  }
+
6392  else
+
6393  {
+
6394  if (yych <= '}')
+
6395  {
+
6396  if (yych <= '|')
+
6397  {
+
6398  goto basic_json_parser_30;
+
6399  }
+
6400  goto basic_json_parser_14;
+
6401  }
+
6402  else
+
6403  {
+
6404  if (yych == 0xEF)
+
6405  {
+
6406  goto basic_json_parser_6;
+
6407  }
+
6408  goto basic_json_parser_30;
+
6409  }
+
6410  }
+
6411  }
+
6412  }
+
6413 basic_json_parser_2:
+
6414  ++m_cursor;
+
6415  yych = *m_cursor;
+
6416  goto basic_json_parser_5;
+
6417 basic_json_parser_3:
+
6418  {
+
6419  return scan();
6420  }
-
6421  else
-
6422  {
-
6423  if (yych <= 'E')
-
6424  {
-
6425  goto basic_json_parser_44;
-
6426  }
-
6427  if (yych == 'e')
-
6428  {
-
6429  goto basic_json_parser_44;
-
6430  }
-
6431  }
-
6432 basic_json_parser_25:
-
6433  {
-
6434  return token_type::value_number;
-
6435  }
-
6436 basic_json_parser_26:
-
6437  yyaccept = 1;
-
6438  yych = *(m_marker = ++m_cursor);
-
6439  goto basic_json_parser_42;
-
6440 basic_json_parser_27:
-
6441  yyaccept = 0;
-
6442  yych = *(m_marker = ++m_cursor);
-
6443  if (yych <= 0x0F)
-
6444  {
-
6445  goto basic_json_parser_7;
-
6446  }
-
6447  goto basic_json_parser_32;
-
6448 basic_json_parser_28:
-
6449  ++m_cursor;
-
6450  {
-
6451  return token_type::end_of_input;
-
6452  }
-
6453 basic_json_parser_30:
-
6454  yych = *++m_cursor;
-
6455  goto basic_json_parser_7;
-
6456 basic_json_parser_31:
-
6457  ++m_cursor;
-
6458  if (m_limit <= m_cursor)
-
6459  {
-
6460  yyfill(); // LCOV_EXCL_LINE;
-
6461  }
-
6462  yych = *m_cursor;
-
6463 basic_json_parser_32:
-
6464  if (yybm[0 + yych] & 64)
-
6465  {
-
6466  goto basic_json_parser_31;
-
6467  }
-
6468  if (yych <= 0x0F)
-
6469  {
-
6470  goto basic_json_parser_33;
-
6471  }
-
6472  if (yych <= '"')
-
6473  {
-
6474  goto basic_json_parser_35;
-
6475  }
-
6476  goto basic_json_parser_34;
-
6477 basic_json_parser_33:
-
6478  m_cursor = m_marker;
-
6479  if (yyaccept == 0)
-
6480  {
-
6481  goto basic_json_parser_7;
-
6482  }
-
6483  else
-
6484  {
-
6485  goto basic_json_parser_25;
-
6486  }
-
6487 basic_json_parser_34:
-
6488  ++m_cursor;
-
6489  if (m_limit <= m_cursor)
-
6490  {
-
6491  yyfill(); // LCOV_EXCL_LINE;
-
6492  }
-
6493  yych = *m_cursor;
-
6494  if (yych <= 'e')
+
6421 basic_json_parser_4:
+
6422  ++m_cursor;
+
6423  if (m_limit <= m_cursor)
+
6424  {
+
6425  yyfill(); // LCOV_EXCL_LINE;
+
6426  }
+
6427  yych = *m_cursor;
+
6428 basic_json_parser_5:
+
6429  if (yybm[0 + yych] & 32)
+
6430  {
+
6431  goto basic_json_parser_4;
+
6432  }
+
6433  goto basic_json_parser_3;
+
6434 basic_json_parser_6:
+
6435  yyaccept = 0;
+
6436  yych = *(m_marker = ++m_cursor);
+
6437  if (yych == 0xBB)
+
6438  {
+
6439  goto basic_json_parser_64;
+
6440  }
+
6441 basic_json_parser_7:
+
6442  {
+
6443  return token_type::parse_error;
+
6444  }
+
6445 basic_json_parser_8:
+
6446  ++m_cursor;
+
6447  {
+
6448  return token_type::begin_array;
+
6449  }
+
6450 basic_json_parser_10:
+
6451  ++m_cursor;
+
6452  {
+
6453  return token_type::end_array;
+
6454  }
+
6455 basic_json_parser_12:
+
6456  ++m_cursor;
+
6457  {
+
6458  return token_type::begin_object;
+
6459  }
+
6460 basic_json_parser_14:
+
6461  ++m_cursor;
+
6462  {
+
6463  return token_type::end_object;
+
6464  }
+
6465 basic_json_parser_16:
+
6466  ++m_cursor;
+
6467  {
+
6468  return token_type::value_separator;
+
6469  }
+
6470 basic_json_parser_18:
+
6471  ++m_cursor;
+
6472  {
+
6473  return token_type::name_separator;
+
6474  }
+
6475 basic_json_parser_20:
+
6476  yyaccept = 0;
+
6477  yych = *(m_marker = ++m_cursor);
+
6478  if (yych == 'u')
+
6479  {
+
6480  goto basic_json_parser_60;
+
6481  }
+
6482  goto basic_json_parser_7;
+
6483 basic_json_parser_21:
+
6484  yyaccept = 0;
+
6485  yych = *(m_marker = ++m_cursor);
+
6486  if (yych == 'r')
+
6487  {
+
6488  goto basic_json_parser_56;
+
6489  }
+
6490  goto basic_json_parser_7;
+
6491 basic_json_parser_22:
+
6492  yyaccept = 0;
+
6493  yych = *(m_marker = ++m_cursor);
+
6494  if (yych == 'a')
6495  {
-
6496  if (yych <= '/')
-
6497  {
-
6498  if (yych == '"')
-
6499  {
-
6500  goto basic_json_parser_31;
-
6501  }
-
6502  if (yych <= '.')
-
6503  {
-
6504  goto basic_json_parser_33;
-
6505  }
-
6506  goto basic_json_parser_31;
-
6507  }
-
6508  else
-
6509  {
-
6510  if (yych <= '\\')
-
6511  {
-
6512  if (yych <= '[')
-
6513  {
-
6514  goto basic_json_parser_33;
-
6515  }
-
6516  goto basic_json_parser_31;
-
6517  }
-
6518  else
-
6519  {
-
6520  if (yych == 'b')
-
6521  {
-
6522  goto basic_json_parser_31;
-
6523  }
-
6524  goto basic_json_parser_33;
-
6525  }
-
6526  }
-
6527  }
-
6528  else
-
6529  {
-
6530  if (yych <= 'q')
+
6496  goto basic_json_parser_51;
+
6497  }
+
6498  goto basic_json_parser_7;
+
6499 basic_json_parser_23:
+
6500  yych = *++m_cursor;
+
6501  if (yych <= '/')
+
6502  {
+
6503  goto basic_json_parser_7;
+
6504  }
+
6505  if (yych <= '0')
+
6506  {
+
6507  goto basic_json_parser_50;
+
6508  }
+
6509  if (yych <= '9')
+
6510  {
+
6511  goto basic_json_parser_41;
+
6512  }
+
6513  goto basic_json_parser_7;
+
6514 basic_json_parser_24:
+
6515  yyaccept = 1;
+
6516  yych = *(m_marker = ++m_cursor);
+
6517  if (yych <= 'D')
+
6518  {
+
6519  if (yych == '.')
+
6520  {
+
6521  goto basic_json_parser_43;
+
6522  }
+
6523  }
+
6524  else
+
6525  {
+
6526  if (yych <= 'E')
+
6527  {
+
6528  goto basic_json_parser_44;
+
6529  }
+
6530  if (yych == 'e')
6531  {
-
6532  if (yych <= 'f')
-
6533  {
-
6534  goto basic_json_parser_31;
-
6535  }
-
6536  if (yych == 'n')
-
6537  {
-
6538  goto basic_json_parser_31;
-
6539  }
-
6540  goto basic_json_parser_33;
-
6541  }
-
6542  else
-
6543  {
-
6544  if (yych <= 's')
-
6545  {
-
6546  if (yych <= 'r')
-
6547  {
-
6548  goto basic_json_parser_31;
-
6549  }
-
6550  goto basic_json_parser_33;
-
6551  }
-
6552  else
-
6553  {
-
6554  if (yych <= 't')
-
6555  {
-
6556  goto basic_json_parser_31;
-
6557  }
-
6558  if (yych <= 'u')
-
6559  {
-
6560  goto basic_json_parser_37;
-
6561  }
-
6562  goto basic_json_parser_33;
-
6563  }
-
6564  }
-
6565  }
-
6566 basic_json_parser_35:
-
6567  ++m_cursor;
+
6532  goto basic_json_parser_44;
+
6533  }
+
6534  }
+
6535 basic_json_parser_25:
+
6536  {
+
6537  return token_type::value_number;
+
6538  }
+
6539 basic_json_parser_26:
+
6540  yyaccept = 1;
+
6541  yych = *(m_marker = ++m_cursor);
+
6542  goto basic_json_parser_42;
+
6543 basic_json_parser_27:
+
6544  yyaccept = 0;
+
6545  yych = *(m_marker = ++m_cursor);
+
6546  if (yych <= 0x0F)
+
6547  {
+
6548  goto basic_json_parser_7;
+
6549  }
+
6550  goto basic_json_parser_32;
+
6551 basic_json_parser_28:
+
6552  ++m_cursor;
+
6553  {
+
6554  return token_type::end_of_input;
+
6555  }
+
6556 basic_json_parser_30:
+
6557  yych = *++m_cursor;
+
6558  goto basic_json_parser_7;
+
6559 basic_json_parser_31:
+
6560  ++m_cursor;
+
6561  if (m_limit <= m_cursor)
+
6562  {
+
6563  yyfill(); // LCOV_EXCL_LINE;
+
6564  }
+
6565  yych = *m_cursor;
+
6566 basic_json_parser_32:
+
6567  if (yybm[0 + yych] & 64)
6568  {
-
6569  return token_type::value_string;
+
6569  goto basic_json_parser_31;
6570  }
-
6571 basic_json_parser_37:
-
6572  ++m_cursor;
-
6573  if (m_limit <= m_cursor)
-
6574  {
-
6575  yyfill(); // LCOV_EXCL_LINE;
-
6576  }
-
6577  yych = *m_cursor;
-
6578  if (yych <= '@')
-
6579  {
-
6580  if (yych <= '/')
-
6581  {
-
6582  goto basic_json_parser_33;
-
6583  }
-
6584  if (yych >= ':')
-
6585  {
-
6586  goto basic_json_parser_33;
-
6587  }
-
6588  }
-
6589  else
-
6590  {
-
6591  if (yych <= 'F')
-
6592  {
-
6593  goto basic_json_parser_38;
-
6594  }
-
6595  if (yych <= '`')
-
6596  {
-
6597  goto basic_json_parser_33;
-
6598  }
-
6599  if (yych >= 'g')
+
6571  if (yych <= 0x0F)
+
6572  {
+
6573  goto basic_json_parser_33;
+
6574  }
+
6575  if (yych <= '"')
+
6576  {
+
6577  goto basic_json_parser_35;
+
6578  }
+
6579  goto basic_json_parser_34;
+
6580 basic_json_parser_33:
+
6581  m_cursor = m_marker;
+
6582  if (yyaccept == 0)
+
6583  {
+
6584  goto basic_json_parser_7;
+
6585  }
+
6586  else
+
6587  {
+
6588  goto basic_json_parser_25;
+
6589  }
+
6590 basic_json_parser_34:
+
6591  ++m_cursor;
+
6592  if (m_limit <= m_cursor)
+
6593  {
+
6594  yyfill(); // LCOV_EXCL_LINE;
+
6595  }
+
6596  yych = *m_cursor;
+
6597  if (yych <= 'e')
+
6598  {
+
6599  if (yych <= '/')
6600  {
-
6601  goto basic_json_parser_33;
-
6602  }
-
6603  }
-
6604 basic_json_parser_38:
-
6605  ++m_cursor;
-
6606  if (m_limit <= m_cursor)
-
6607  {
-
6608  yyfill(); // LCOV_EXCL_LINE;
-
6609  }
-
6610  yych = *m_cursor;
-
6611  if (yych <= '@')
-
6612  {
-
6613  if (yych <= '/')
-
6614  {
-
6615  goto basic_json_parser_33;
-
6616  }
-
6617  if (yych >= ':')
-
6618  {
-
6619  goto basic_json_parser_33;
-
6620  }
-
6621  }
-
6622  else
-
6623  {
-
6624  if (yych <= 'F')
-
6625  {
-
6626  goto basic_json_parser_39;
-
6627  }
-
6628  if (yych <= '`')
-
6629  {
-
6630  goto basic_json_parser_33;
-
6631  }
-
6632  if (yych >= 'g')
-
6633  {
-
6634  goto basic_json_parser_33;
-
6635  }
-
6636  }
-
6637 basic_json_parser_39:
-
6638  ++m_cursor;
-
6639  if (m_limit <= m_cursor)
-
6640  {
-
6641  yyfill(); // LCOV_EXCL_LINE;
-
6642  }
-
6643  yych = *m_cursor;
-
6644  if (yych <= '@')
-
6645  {
-
6646  if (yych <= '/')
-
6647  {
-
6648  goto basic_json_parser_33;
-
6649  }
-
6650  if (yych >= ':')
-
6651  {
-
6652  goto basic_json_parser_33;
-
6653  }
-
6654  }
-
6655  else
-
6656  {
-
6657  if (yych <= 'F')
-
6658  {
-
6659  goto basic_json_parser_40;
-
6660  }
-
6661  if (yych <= '`')
-
6662  {
-
6663  goto basic_json_parser_33;
-
6664  }
-
6665  if (yych >= 'g')
-
6666  {
-
6667  goto basic_json_parser_33;
-
6668  }
-
6669  }
-
6670 basic_json_parser_40:
-
6671  ++m_cursor;
-
6672  if (m_limit <= m_cursor)
-
6673  {
-
6674  yyfill(); // LCOV_EXCL_LINE;
-
6675  }
-
6676  yych = *m_cursor;
-
6677  if (yych <= '@')
-
6678  {
-
6679  if (yych <= '/')
-
6680  {
-
6681  goto basic_json_parser_33;
-
6682  }
-
6683  if (yych <= '9')
+
6601  if (yych == '"')
+
6602  {
+
6603  goto basic_json_parser_31;
+
6604  }
+
6605  if (yych <= '.')
+
6606  {
+
6607  goto basic_json_parser_33;
+
6608  }
+
6609  goto basic_json_parser_31;
+
6610  }
+
6611  else
+
6612  {
+
6613  if (yych <= '\\')
+
6614  {
+
6615  if (yych <= '[')
+
6616  {
+
6617  goto basic_json_parser_33;
+
6618  }
+
6619  goto basic_json_parser_31;
+
6620  }
+
6621  else
+
6622  {
+
6623  if (yych == 'b')
+
6624  {
+
6625  goto basic_json_parser_31;
+
6626  }
+
6627  goto basic_json_parser_33;
+
6628  }
+
6629  }
+
6630  }
+
6631  else
+
6632  {
+
6633  if (yych <= 'q')
+
6634  {
+
6635  if (yych <= 'f')
+
6636  {
+
6637  goto basic_json_parser_31;
+
6638  }
+
6639  if (yych == 'n')
+
6640  {
+
6641  goto basic_json_parser_31;
+
6642  }
+
6643  goto basic_json_parser_33;
+
6644  }
+
6645  else
+
6646  {
+
6647  if (yych <= 's')
+
6648  {
+
6649  if (yych <= 'r')
+
6650  {
+
6651  goto basic_json_parser_31;
+
6652  }
+
6653  goto basic_json_parser_33;
+
6654  }
+
6655  else
+
6656  {
+
6657  if (yych <= 't')
+
6658  {
+
6659  goto basic_json_parser_31;
+
6660  }
+
6661  if (yych <= 'u')
+
6662  {
+
6663  goto basic_json_parser_37;
+
6664  }
+
6665  goto basic_json_parser_33;
+
6666  }
+
6667  }
+
6668  }
+
6669 basic_json_parser_35:
+
6670  ++m_cursor;
+
6671  {
+
6672  return token_type::value_string;
+
6673  }
+
6674 basic_json_parser_37:
+
6675  ++m_cursor;
+
6676  if (m_limit <= m_cursor)
+
6677  {
+
6678  yyfill(); // LCOV_EXCL_LINE;
+
6679  }
+
6680  yych = *m_cursor;
+
6681  if (yych <= '@')
+
6682  {
+
6683  if (yych <= '/')
6684  {
-
6685  goto basic_json_parser_31;
+
6685  goto basic_json_parser_33;
6686  }
-
6687  goto basic_json_parser_33;
-
6688  }
-
6689  else
-
6690  {
-
6691  if (yych <= 'F')
-
6692  {
-
6693  goto basic_json_parser_31;
-
6694  }
-
6695  if (yych <= '`')
-
6696  {
-
6697  goto basic_json_parser_33;
-
6698  }
-
6699  if (yych <= 'f')
-
6700  {
-
6701  goto basic_json_parser_31;
-
6702  }
-
6703  goto basic_json_parser_33;
-
6704  }
-
6705 basic_json_parser_41:
-
6706  yyaccept = 1;
-
6707  m_marker = ++m_cursor;
-
6708  if ((m_limit - m_cursor) < 3)
-
6709  {
-
6710  yyfill(); // LCOV_EXCL_LINE;
-
6711  }
-
6712  yych = *m_cursor;
-
6713 basic_json_parser_42:
-
6714  if (yybm[0 + yych] & 128)
+
6687  if (yych >= ':')
+
6688  {
+
6689  goto basic_json_parser_33;
+
6690  }
+
6691  }
+
6692  else
+
6693  {
+
6694  if (yych <= 'F')
+
6695  {
+
6696  goto basic_json_parser_38;
+
6697  }
+
6698  if (yych <= '`')
+
6699  {
+
6700  goto basic_json_parser_33;
+
6701  }
+
6702  if (yych >= 'g')
+
6703  {
+
6704  goto basic_json_parser_33;
+
6705  }
+
6706  }
+
6707 basic_json_parser_38:
+
6708  ++m_cursor;
+
6709  if (m_limit <= m_cursor)
+
6710  {
+
6711  yyfill(); // LCOV_EXCL_LINE;
+
6712  }
+
6713  yych = *m_cursor;
+
6714  if (yych <= '@')
6715  {
-
6716  goto basic_json_parser_41;
-
6717  }
-
6718  if (yych <= 'D')
-
6719  {
-
6720  if (yych != '.')
+
6716  if (yych <= '/')
+
6717  {
+
6718  goto basic_json_parser_33;
+
6719  }
+
6720  if (yych >= ':')
6721  {
-
6722  goto basic_json_parser_25;
+
6722  goto basic_json_parser_33;
6723  }
6724  }
6725  else
6726  {
-
6727  if (yych <= 'E')
+
6727  if (yych <= 'F')
6728  {
-
6729  goto basic_json_parser_44;
+
6729  goto basic_json_parser_39;
6730  }
-
6731  if (yych == 'e')
+
6731  if (yych <= '`')
6732  {
-
6733  goto basic_json_parser_44;
+
6733  goto basic_json_parser_33;
6734  }
-
6735  goto basic_json_parser_25;
-
6736  }
-
6737 basic_json_parser_43:
-
6738  yych = *++m_cursor;
-
6739  if (yych <= '/')
-
6740  {
-
6741  goto basic_json_parser_33;
-
6742  }
-
6743  if (yych <= '9')
-
6744  {
-
6745  goto basic_json_parser_48;
-
6746  }
-
6747  goto basic_json_parser_33;
-
6748 basic_json_parser_44:
-
6749  yych = *++m_cursor;
-
6750  if (yych <= ',')
-
6751  {
-
6752  if (yych != '+')
-
6753  {
-
6754  goto basic_json_parser_33;
-
6755  }
-
6756  }
-
6757  else
-
6758  {
-
6759  if (yych <= '-')
-
6760  {
-
6761  goto basic_json_parser_45;
-
6762  }
-
6763  if (yych <= '/')
-
6764  {
-
6765  goto basic_json_parser_33;
-
6766  }
-
6767  if (yych <= '9')
-
6768  {
-
6769  goto basic_json_parser_46;
-
6770  }
-
6771  goto basic_json_parser_33;
+
6735  if (yych >= 'g')
+
6736  {
+
6737  goto basic_json_parser_33;
+
6738  }
+
6739  }
+
6740 basic_json_parser_39:
+
6741  ++m_cursor;
+
6742  if (m_limit <= m_cursor)
+
6743  {
+
6744  yyfill(); // LCOV_EXCL_LINE;
+
6745  }
+
6746  yych = *m_cursor;
+
6747  if (yych <= '@')
+
6748  {
+
6749  if (yych <= '/')
+
6750  {
+
6751  goto basic_json_parser_33;
+
6752  }
+
6753  if (yych >= ':')
+
6754  {
+
6755  goto basic_json_parser_33;
+
6756  }
+
6757  }
+
6758  else
+
6759  {
+
6760  if (yych <= 'F')
+
6761  {
+
6762  goto basic_json_parser_40;
+
6763  }
+
6764  if (yych <= '`')
+
6765  {
+
6766  goto basic_json_parser_33;
+
6767  }
+
6768  if (yych >= 'g')
+
6769  {
+
6770  goto basic_json_parser_33;
+
6771  }
6772  }
-
6773 basic_json_parser_45:
-
6774  yych = *++m_cursor;
-
6775  if (yych <= '/')
+
6773 basic_json_parser_40:
+
6774  ++m_cursor;
+
6775  if (m_limit <= m_cursor)
6776  {
-
6777  goto basic_json_parser_33;
+
6777  yyfill(); // LCOV_EXCL_LINE;
6778  }
-
6779  if (yych >= ':')
-
6780  {
-
6781  goto basic_json_parser_33;
-
6782  }
-
6783 basic_json_parser_46:
-
6784  ++m_cursor;
-
6785  if (m_limit <= m_cursor)
-
6786  {
-
6787  yyfill(); // LCOV_EXCL_LINE;
-
6788  }
-
6789  yych = *m_cursor;
-
6790  if (yych <= '/')
-
6791  {
-
6792  goto basic_json_parser_25;
-
6793  }
-
6794  if (yych <= '9')
-
6795  {
-
6796  goto basic_json_parser_46;
-
6797  }
-
6798  goto basic_json_parser_25;
-
6799 basic_json_parser_48:
-
6800  yyaccept = 1;
-
6801  m_marker = ++m_cursor;
-
6802  if ((m_limit - m_cursor) < 3)
-
6803  {
-
6804  yyfill(); // LCOV_EXCL_LINE;
-
6805  }
-
6806  yych = *m_cursor;
-
6807  if (yych <= 'D')
-
6808  {
-
6809  if (yych <= '/')
-
6810  {
-
6811  goto basic_json_parser_25;
-
6812  }
-
6813  if (yych <= '9')
-
6814  {
-
6815  goto basic_json_parser_48;
-
6816  }
-
6817  goto basic_json_parser_25;
-
6818  }
-
6819  else
-
6820  {
-
6821  if (yych <= 'E')
-
6822  {
-
6823  goto basic_json_parser_44;
-
6824  }
-
6825  if (yych == 'e')
-
6826  {
-
6827  goto basic_json_parser_44;
-
6828  }
-
6829  goto basic_json_parser_25;
-
6830  }
-
6831 basic_json_parser_50:
-
6832  yyaccept = 1;
-
6833  yych = *(m_marker = ++m_cursor);
-
6834  if (yych <= 'D')
-
6835  {
-
6836  if (yych == '.')
-
6837  {
-
6838  goto basic_json_parser_43;
-
6839  }
-
6840  goto basic_json_parser_25;
-
6841  }
-
6842  else
+
6779  yych = *m_cursor;
+
6780  if (yych <= '@')
+
6781  {
+
6782  if (yych <= '/')
+
6783  {
+
6784  goto basic_json_parser_33;
+
6785  }
+
6786  if (yych <= '9')
+
6787  {
+
6788  goto basic_json_parser_31;
+
6789  }
+
6790  goto basic_json_parser_33;
+
6791  }
+
6792  else
+
6793  {
+
6794  if (yych <= 'F')
+
6795  {
+
6796  goto basic_json_parser_31;
+
6797  }
+
6798  if (yych <= '`')
+
6799  {
+
6800  goto basic_json_parser_33;
+
6801  }
+
6802  if (yych <= 'f')
+
6803  {
+
6804  goto basic_json_parser_31;
+
6805  }
+
6806  goto basic_json_parser_33;
+
6807  }
+
6808 basic_json_parser_41:
+
6809  yyaccept = 1;
+
6810  m_marker = ++m_cursor;
+
6811  if ((m_limit - m_cursor) < 3)
+
6812  {
+
6813  yyfill(); // LCOV_EXCL_LINE;
+
6814  }
+
6815  yych = *m_cursor;
+
6816 basic_json_parser_42:
+
6817  if (yybm[0 + yych] & 128)
+
6818  {
+
6819  goto basic_json_parser_41;
+
6820  }
+
6821  if (yych <= 'D')
+
6822  {
+
6823  if (yych != '.')
+
6824  {
+
6825  goto basic_json_parser_25;
+
6826  }
+
6827  }
+
6828  else
+
6829  {
+
6830  if (yych <= 'E')
+
6831  {
+
6832  goto basic_json_parser_44;
+
6833  }
+
6834  if (yych == 'e')
+
6835  {
+
6836  goto basic_json_parser_44;
+
6837  }
+
6838  goto basic_json_parser_25;
+
6839  }
+
6840 basic_json_parser_43:
+
6841  yych = *++m_cursor;
+
6842  if (yych <= '/')
6843  {
-
6844  if (yych <= 'E')
-
6845  {
-
6846  goto basic_json_parser_44;
-
6847  }
-
6848  if (yych == 'e')
-
6849  {
-
6850  goto basic_json_parser_44;
-
6851  }
-
6852  goto basic_json_parser_25;
-
6853  }
-
6854 basic_json_parser_51:
-
6855  yych = *++m_cursor;
-
6856  if (yych != 'l')
-
6857  {
-
6858  goto basic_json_parser_33;
+
6844  goto basic_json_parser_33;
+
6845  }
+
6846  if (yych <= '9')
+
6847  {
+
6848  goto basic_json_parser_48;
+
6849  }
+
6850  goto basic_json_parser_33;
+
6851 basic_json_parser_44:
+
6852  yych = *++m_cursor;
+
6853  if (yych <= ',')
+
6854  {
+
6855  if (yych != '+')
+
6856  {
+
6857  goto basic_json_parser_33;
+
6858  }
6859  }
-
6860  yych = *++m_cursor;
-
6861  if (yych != 's')
-
6862  {
-
6863  goto basic_json_parser_33;
-
6864  }
-
6865  yych = *++m_cursor;
-
6866  if (yych != 'e')
-
6867  {
-
6868  goto basic_json_parser_33;
-
6869  }
-
6870  ++m_cursor;
-
6871  {
-
6872  return token_type::literal_false;
-
6873  }
-
6874 basic_json_parser_56:
-
6875  yych = *++m_cursor;
-
6876  if (yych != 'u')
-
6877  {
-
6878  goto basic_json_parser_33;
-
6879  }
-
6880  yych = *++m_cursor;
-
6881  if (yych != 'e')
-
6882  {
-
6883  goto basic_json_parser_33;
-
6884  }
-
6885  ++m_cursor;
-
6886  {
-
6887  return token_type::literal_true;
-
6888  }
-
6889 basic_json_parser_60:
-
6890  yych = *++m_cursor;
-
6891  if (yych != 'l')
-
6892  {
-
6893  goto basic_json_parser_33;
-
6894  }
-
6895  yych = *++m_cursor;
-
6896  if (yych != 'l')
-
6897  {
-
6898  goto basic_json_parser_33;
-
6899  }
-
6900  ++m_cursor;
-
6901  {
-
6902  return token_type::literal_null;
-
6903  }
-
6904 basic_json_parser_64:
-
6905  yych = *++m_cursor;
-
6906  if (yych != 0xBF)
-
6907  {
-
6908  goto basic_json_parser_33;
-
6909  }
-
6910  ++m_cursor;
+
6860  else
+
6861  {
+
6862  if (yych <= '-')
+
6863  {
+
6864  goto basic_json_parser_45;
+
6865  }
+
6866  if (yych <= '/')
+
6867  {
+
6868  goto basic_json_parser_33;
+
6869  }
+
6870  if (yych <= '9')
+
6871  {
+
6872  goto basic_json_parser_46;
+
6873  }
+
6874  goto basic_json_parser_33;
+
6875  }
+
6876 basic_json_parser_45:
+
6877  yych = *++m_cursor;
+
6878  if (yych <= '/')
+
6879  {
+
6880  goto basic_json_parser_33;
+
6881  }
+
6882  if (yych >= ':')
+
6883  {
+
6884  goto basic_json_parser_33;
+
6885  }
+
6886 basic_json_parser_46:
+
6887  ++m_cursor;
+
6888  if (m_limit <= m_cursor)
+
6889  {
+
6890  yyfill(); // LCOV_EXCL_LINE;
+
6891  }
+
6892  yych = *m_cursor;
+
6893  if (yych <= '/')
+
6894  {
+
6895  goto basic_json_parser_25;
+
6896  }
+
6897  if (yych <= '9')
+
6898  {
+
6899  goto basic_json_parser_46;
+
6900  }
+
6901  goto basic_json_parser_25;
+
6902 basic_json_parser_48:
+
6903  yyaccept = 1;
+
6904  m_marker = ++m_cursor;
+
6905  if ((m_limit - m_cursor) < 3)
+
6906  {
+
6907  yyfill(); // LCOV_EXCL_LINE;
+
6908  }
+
6909  yych = *m_cursor;
+
6910  if (yych <= 'D')
6911  {
-
6912  return scan();
-
6913  }
-
6914  }
-
6915 
-
6916 
-
6917  }
-
6918 
-
6920  void yyfill() noexcept
-
6921  {
-
6922  if (not m_stream or not * m_stream)
-
6923  {
-
6924  return;
-
6925  }
-
6926 
-
6927  const ssize_t offset_start = m_start - m_content;
-
6928  const ssize_t offset_marker = m_marker - m_start;
-
6929  const ssize_t offset_cursor = m_cursor - m_start;
-
6930 
-
6931  m_buffer.erase(0, static_cast<size_t>(offset_start));
-
6932  std::string line;
-
6933  std::getline(*m_stream, line);
-
6934  m_buffer += "\n" + line; // add line with newline symbol
-
6935 
-
6936  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
-
6937  m_start = m_content;
-
6938  m_marker = m_start + offset_marker;
-
6939  m_cursor = m_start + offset_cursor;
-
6940  m_limit = m_start + m_buffer.size() - 1;
-
6941  }
-
6942 
-
6944  string_t get_token() const noexcept
-
6945  {
-
6946  return string_t(reinterpret_cast<typename string_t::const_pointer>(m_start),
-
6947  static_cast<size_t>(m_cursor - m_start));
-
6948  }
-
6949 
-
6971  string_t get_string() const
-
6972  {
-
6973  string_t result;
-
6974  result.reserve(static_cast<size_t>(m_cursor - m_start - 2));
-
6975 
-
6976  // iterate the result between the quotes
-
6977  for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i)
-
6978  {
-
6979  // process escaped characters
-
6980  if (*i == '\\')
-
6981  {
-
6982  // read next character
-
6983  ++i;
-
6984 
-
6985  switch (*i)
-
6986  {
-
6987  // the default escapes
-
6988  case 't':
-
6989  {
-
6990  result += "\t";
-
6991  break;
-
6992  }
-
6993  case 'b':
-
6994  {
-
6995  result += "\b";
-
6996  break;
-
6997  }
-
6998  case 'f':
-
6999  {
-
7000  result += "\f";
-
7001  break;
-
7002  }
-
7003  case 'n':
-
7004  {
-
7005  result += "\n";
-
7006  break;
-
7007  }
-
7008  case 'r':
-
7009  {
-
7010  result += "\r";
-
7011  break;
-
7012  }
-
7013  case '\\':
-
7014  {
-
7015  result += "\\";
-
7016  break;
-
7017  }
-
7018  case '/':
-
7019  {
-
7020  result += "/";
-
7021  break;
-
7022  }
-
7023  case '"':
-
7024  {
-
7025  result += "\"";
-
7026  break;
-
7027  }
-
7028 
-
7029  // unicode
-
7030  case 'u':
-
7031  {
-
7032  // get code xxxx from uxxxx
-
7033  auto codepoint = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>(i + 1),
-
7034  4).c_str(), nullptr, 16);
-
7035 
-
7036  // check if codepoint is a high surrogate
-
7037  if (codepoint >= 0xD800 and codepoint <= 0xDBFF)
-
7038  {
-
7039  // make sure there is a subsequent unicode
-
7040  if ((i + 6 >= m_limit) or * (i + 5) != '\\' or * (i + 6) != 'u')
-
7041  {
-
7042  throw std::invalid_argument("missing low surrogate");
-
7043  }
-
7044 
-
7045  // get code yyyy from uxxxx\uyyyy
-
7046  auto codepoint2 = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>
-
7047  (i + 7), 4).c_str(), nullptr, 16);
-
7048  result += to_unicode(codepoint, codepoint2);
-
7049  // skip the next 10 characters (xxxx\uyyyy)
-
7050  i += 10;
-
7051  }
-
7052  else
-
7053  {
-
7054  // add unicode character(s)
-
7055  result += to_unicode(codepoint);
-
7056  // skip the next four characters (xxxx)
-
7057  i += 4;
-
7058  }
-
7059  break;
-
7060  }
-
7061  }
-
7062  }
-
7063  else
-
7064  {
-
7065  // all other characters are just copied to the end of the
-
7066  // string
-
7067  result.append(1, static_cast<typename string_t::value_type>(*i));
-
7068  }
-
7069  }
-
7070 
-
7071  return result;
-
7072  }
-
7073 
-
7091  long double get_number() const
-
7092  {
-
7093  // conversion
-
7094  typename string_t::value_type* endptr;
-
7095  const auto float_val = std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start),
-
7096  &endptr);
-
7097 
-
7098  // return float_val if the whole number was translated and NAN
-
7099  // otherwise
-
7100  return (reinterpret_cast<lexer_char_t*>(endptr) == m_cursor) ? float_val : NAN;
-
7101  }
-
7102 
-
7103  private:
-
7105  std::istream* m_stream;
-
7107  string_t m_buffer;
-
7109  const lexer_char_t* m_content = nullptr;
-
7111  const lexer_char_t* m_start = nullptr;
-
7113  const lexer_char_t* m_marker = nullptr;
-
7115  const lexer_char_t* m_cursor = nullptr;
-
7117  const lexer_char_t* m_limit = nullptr;
-
7118  };
-
7119 
-
7123  class parser
-
7124  {
-
7125  public:
-
7127  parser(const string_t& s, parser_callback_t cb = nullptr)
-
7128  : callback(cb), m_lexer(s)
-
7129  {
-
7130  // read first token
-
7131  get_token();
-
7132  }
-
7133 
-
7135  parser(std::istream& _is, parser_callback_t cb = nullptr)
-
7136  : callback(cb), m_lexer(&_is)
-
7137  {
-
7138  // read first token
-
7139  get_token();
-
7140  }
-
7141 
-
7143  basic_json parse()
-
7144  {
-
7145  basic_json result = parse_internal(true);
-
7146 
-
7147  expect(lexer::token_type::end_of_input);
-
7148 
-
7149  // return parser result and replace it with null in case the
-
7150  // top-level value was discarded by the callback function
-
7151  return result.is_discarded() ? basic_json() : result;
-
7152  }
-
7153 
-
7154  private:
-
7156  basic_json parse_internal(bool keep)
-
7157  {
-
7158  auto result = basic_json(value_t::discarded);
-
7159 
-
7160  switch (last_token)
-
7161  {
-
7162  case lexer::token_type::begin_object:
-
7163  {
-
7164  if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))
-
7165  {
-
7166  // explicitly set result to object to cope with {}
-
7167  result.m_type = value_t::object;
-
7168  result.m_value = json_value(value_t::object);
-
7169  }
-
7170 
-
7171  // read next token
-
7172  get_token();
+
6912  if (yych <= '/')
+
6913  {
+
6914  goto basic_json_parser_25;
+
6915  }
+
6916  if (yych <= '9')
+
6917  {
+
6918  goto basic_json_parser_48;
+
6919  }
+
6920  goto basic_json_parser_25;
+
6921  }
+
6922  else
+
6923  {
+
6924  if (yych <= 'E')
+
6925  {
+
6926  goto basic_json_parser_44;
+
6927  }
+
6928  if (yych == 'e')
+
6929  {
+
6930  goto basic_json_parser_44;
+
6931  }
+
6932  goto basic_json_parser_25;
+
6933  }
+
6934 basic_json_parser_50:
+
6935  yyaccept = 1;
+
6936  yych = *(m_marker = ++m_cursor);
+
6937  if (yych <= 'D')
+
6938  {
+
6939  if (yych == '.')
+
6940  {
+
6941  goto basic_json_parser_43;
+
6942  }
+
6943  goto basic_json_parser_25;
+
6944  }
+
6945  else
+
6946  {
+
6947  if (yych <= 'E')
+
6948  {
+
6949  goto basic_json_parser_44;
+
6950  }
+
6951  if (yych == 'e')
+
6952  {
+
6953  goto basic_json_parser_44;
+
6954  }
+
6955  goto basic_json_parser_25;
+
6956  }
+
6957 basic_json_parser_51:
+
6958  yych = *++m_cursor;
+
6959  if (yych != 'l')
+
6960  {
+
6961  goto basic_json_parser_33;
+
6962  }
+
6963  yych = *++m_cursor;
+
6964  if (yych != 's')
+
6965  {
+
6966  goto basic_json_parser_33;
+
6967  }
+
6968  yych = *++m_cursor;
+
6969  if (yych != 'e')
+
6970  {
+
6971  goto basic_json_parser_33;
+
6972  }
+
6973  ++m_cursor;
+
6974  {
+
6975  return token_type::literal_false;
+
6976  }
+
6977 basic_json_parser_56:
+
6978  yych = *++m_cursor;
+
6979  if (yych != 'u')
+
6980  {
+
6981  goto basic_json_parser_33;
+
6982  }
+
6983  yych = *++m_cursor;
+
6984  if (yych != 'e')
+
6985  {
+
6986  goto basic_json_parser_33;
+
6987  }
+
6988  ++m_cursor;
+
6989  {
+
6990  return token_type::literal_true;
+
6991  }
+
6992 basic_json_parser_60:
+
6993  yych = *++m_cursor;
+
6994  if (yych != 'l')
+
6995  {
+
6996  goto basic_json_parser_33;
+
6997  }
+
6998  yych = *++m_cursor;
+
6999  if (yych != 'l')
+
7000  {
+
7001  goto basic_json_parser_33;
+
7002  }
+
7003  ++m_cursor;
+
7004  {
+
7005  return token_type::literal_null;
+
7006  }
+
7007 basic_json_parser_64:
+
7008  yych = *++m_cursor;
+
7009  if (yych != 0xBF)
+
7010  {
+
7011  goto basic_json_parser_33;
+
7012  }
+
7013  ++m_cursor;
+
7014  {
+
7015  return scan();
+
7016  }
+
7017  }
+
7018 
+
7019 
+
7020  }
+
7021 
+
7023  void yyfill() noexcept
+
7024  {
+
7025  if (not m_stream or not * m_stream)
+
7026  {
+
7027  return;
+
7028  }
+
7029 
+
7030  const ssize_t offset_start = m_start - m_content;
+
7031  const ssize_t offset_marker = m_marker - m_start;
+
7032  const ssize_t offset_cursor = m_cursor - m_start;
+
7033 
+
7034  m_buffer.erase(0, static_cast<size_t>(offset_start));
+
7035  std::string line;
+
7036  std::getline(*m_stream, line);
+
7037  m_buffer += "\n" + line; // add line with newline symbol
+
7038 
+
7039  m_content = reinterpret_cast<const lexer_char_t*>(m_buffer.c_str());
+
7040  m_start = m_content;
+
7041  m_marker = m_start + offset_marker;
+
7042  m_cursor = m_start + offset_cursor;
+
7043  m_limit = m_start + m_buffer.size() - 1;
+
7044  }
+
7045 
+
7047  string_t get_token() const noexcept
+
7048  {
+
7049  return string_t(reinterpret_cast<typename string_t::const_pointer>(m_start),
+
7050  static_cast<size_t>(m_cursor - m_start));
+
7051  }
+
7052 
+
7074  string_t get_string() const
+
7075  {
+
7076  string_t result;
+
7077  result.reserve(static_cast<size_t>(m_cursor - m_start - 2));
+
7078 
+
7079  // iterate the result between the quotes
+
7080  for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i)
+
7081  {
+
7082  // process escaped characters
+
7083  if (*i == '\\')
+
7084  {
+
7085  // read next character
+
7086  ++i;
+
7087 
+
7088  switch (*i)
+
7089  {
+
7090  // the default escapes
+
7091  case 't':
+
7092  {
+
7093  result += "\t";
+
7094  break;
+
7095  }
+
7096  case 'b':
+
7097  {
+
7098  result += "\b";
+
7099  break;
+
7100  }
+
7101  case 'f':
+
7102  {
+
7103  result += "\f";
+
7104  break;
+
7105  }
+
7106  case 'n':
+
7107  {
+
7108  result += "\n";
+
7109  break;
+
7110  }
+
7111  case 'r':
+
7112  {
+
7113  result += "\r";
+
7114  break;
+
7115  }
+
7116  case '\\':
+
7117  {
+
7118  result += "\\";
+
7119  break;
+
7120  }
+
7121  case '/':
+
7122  {
+
7123  result += "/";
+
7124  break;
+
7125  }
+
7126  case '"':
+
7127  {
+
7128  result += "\"";
+
7129  break;
+
7130  }
+
7131 
+
7132  // unicode
+
7133  case 'u':
+
7134  {
+
7135  // get code xxxx from uxxxx
+
7136  auto codepoint = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>(i + 1),
+
7137  4).c_str(), nullptr, 16);
+
7138 
+
7139  // check if codepoint is a high surrogate
+
7140  if (codepoint >= 0xD800 and codepoint <= 0xDBFF)
+
7141  {
+
7142  // make sure there is a subsequent unicode
+
7143  if ((i + 6 >= m_limit) or * (i + 5) != '\\' or * (i + 6) != 'u')
+
7144  {
+
7145  throw std::invalid_argument("missing low surrogate");
+
7146  }
+
7147 
+
7148  // get code yyyy from uxxxx\uyyyy
+
7149  auto codepoint2 = std::strtoul(std::string(reinterpret_cast<typename string_t::const_pointer>
+
7150  (i + 7), 4).c_str(), nullptr, 16);
+
7151  result += to_unicode(codepoint, codepoint2);
+
7152  // skip the next 10 characters (xxxx\uyyyy)
+
7153  i += 10;
+
7154  }
+
7155  else
+
7156  {
+
7157  // add unicode character(s)
+
7158  result += to_unicode(codepoint);
+
7159  // skip the next four characters (xxxx)
+
7160  i += 4;
+
7161  }
+
7162  break;
+
7163  }
+
7164  }
+
7165  }
+
7166  else
+
7167  {
+
7168  // all other characters are just copied to the end of the
+
7169  // string
+
7170  result.append(1, static_cast<typename string_t::value_type>(*i));
+
7171  }
+
7172  }
7173 
-
7174  // closing } -> we are done
-
7175  if (last_token == lexer::token_type::end_object)
-
7176  {
-
7177  get_token();
-
7178  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
-
7179  {
-
7180  result = basic_json(value_t::discarded);
-
7181  }
-
7182  return result;
-
7183  }
-
7184 
-
7185  // no comma is expected here
-
7186  unexpect(lexer::token_type::value_separator);
-
7187 
-
7188  // otherwise: parse key-value pairs
-
7189  do
-
7190  {
-
7191  // ugly, but could be fixed with loop reorganization
-
7192  if (last_token == lexer::token_type::value_separator)
-
7193  {
-
7194  get_token();
-
7195  }
-
7196 
-
7197  // store key
-
7198  expect(lexer::token_type::value_string);
-
7199  const auto key = m_lexer.get_string();
+
7174  return result;
+
7175  }
+
7176 
+
7194  long double get_number() const
+
7195  {
+
7196  // conversion
+
7197  typename string_t::value_type* endptr;
+
7198  const auto float_val = std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start),
+
7199  &endptr);
7200 
-
7201  bool keep_tag = false;
-
7202  if (keep)
-
7203  {
-
7204  if (callback)
-
7205  {
-
7206  basic_json k(key);
-
7207  keep_tag = callback(depth, parse_event_t::key, k);
-
7208  }
-
7209  else
-
7210  {
-
7211  keep_tag = true;
-
7212  }
-
7213  }
-
7214 
-
7215  // parse separator (:)
-
7216  get_token();
-
7217  expect(lexer::token_type::name_separator);
-
7218 
-
7219  // parse and add value
-
7220  get_token();
-
7221  auto value = parse_internal(keep);
-
7222  if (keep and keep_tag and not value.is_discarded())
-
7223  {
-
7224  result[key] = std::move(value);
-
7225  }
-
7226  }
-
7227  while (last_token == lexer::token_type::value_separator);
-
7228 
-
7229  // closing }
-
7230  expect(lexer::token_type::end_object);
-
7231  get_token();
-
7232  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
-
7233  {
-
7234  result = basic_json(value_t::discarded);
-
7235  }
-
7236 
-
7237  return result;
-
7238  }
-
7239 
-
7240  case lexer::token_type::begin_array:
-
7241  {
-
7242  if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))
-
7243  {
-
7244  // explicitly set result to object to cope with []
-
7245  result.m_type = value_t::array;
-
7246  result.m_value = json_value(value_t::array);
-
7247  }
-
7248 
-
7249  // read next token
-
7250  get_token();
+
7201  // return float_val if the whole number was translated and NAN
+
7202  // otherwise
+
7203  return (reinterpret_cast<lexer_char_t*>(endptr) == m_cursor) ? float_val : NAN;
+
7204  }
+
7205 
+
7206  private:
+
7208  std::istream* m_stream;
+
7210  string_t m_buffer;
+
7212  const lexer_char_t* m_content = nullptr;
+
7214  const lexer_char_t* m_start = nullptr;
+
7216  const lexer_char_t* m_marker = nullptr;
+
7218  const lexer_char_t* m_cursor = nullptr;
+
7220  const lexer_char_t* m_limit = nullptr;
+
7221  };
+
7222 
+
7228  class parser
+
7229  {
+
7230  public:
+
7232  parser(const string_t& s, parser_callback_t cb = nullptr)
+
7233  : callback(cb), m_lexer(s)
+
7234  {
+
7235  // read first token
+
7236  get_token();
+
7237  }
+
7238 
+
7240  parser(std::istream& _is, parser_callback_t cb = nullptr)
+
7241  : callback(cb), m_lexer(&_is)
+
7242  {
+
7243  // read first token
+
7244  get_token();
+
7245  }
+
7246 
+
7248  basic_json parse()
+
7249  {
+
7250  basic_json result = parse_internal(true);
7251 
-
7252  // closing ] -> we are done
-
7253  if (last_token == lexer::token_type::end_array)
-
7254  {
-
7255  get_token();
-
7256  if (callback and not callback(--depth, parse_event_t::array_end, result))
-
7257  {
-
7258  result = basic_json(value_t::discarded);
-
7259  }
-
7260  return result;
-
7261  }
-
7262 
-
7263  // no comma is expected here
-
7264  unexpect(lexer::token_type::value_separator);
-
7265 
-
7266  // otherwise: parse values
-
7267  do
-
7268  {
-
7269  // ugly, but could be fixed with loop reorganization
-
7270  if (last_token == lexer::token_type::value_separator)
-
7271  {
-
7272  get_token();
-
7273  }
-
7274 
-
7275  // parse value
-
7276  auto value = parse_internal(keep);
-
7277  if (keep and not value.is_discarded())
-
7278  {
-
7279  result.push_back(std::move(value));
-
7280  }
-
7281  }
-
7282  while (last_token == lexer::token_type::value_separator);
-
7283 
-
7284  // closing ]
-
7285  expect(lexer::token_type::end_array);
-
7286  get_token();
-
7287  if (keep and callback and not callback(--depth, parse_event_t::array_end, result))
-
7288  {
-
7289  result = basic_json(value_t::discarded);
-
7290  }
-
7291 
-
7292  return result;
-
7293  }
-
7294 
-
7295  case lexer::token_type::literal_null:
-
7296  {
-
7297  get_token();
-
7298  result.m_type = value_t::null;
-
7299  break;
-
7300  }
+
7252  expect(lexer::token_type::end_of_input);
+
7253 
+
7254  // return parser result and replace it with null in case the
+
7255  // top-level value was discarded by the callback function
+
7256  return result.is_discarded() ? basic_json() : result;
+
7257  }
+
7258 
+
7259  private:
+
7261  basic_json parse_internal(bool keep)
+
7262  {
+
7263  auto result = basic_json(value_t::discarded);
+
7264 
+
7265  switch (last_token)
+
7266  {
+
7267  case lexer::token_type::begin_object:
+
7268  {
+
7269  if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))
+
7270  {
+
7271  // explicitly set result to object to cope with {}
+
7272  result.m_type = value_t::object;
+
7273  result.m_value = json_value(value_t::object);
+
7274  }
+
7275 
+
7276  // read next token
+
7277  get_token();
+
7278 
+
7279  // closing } -> we are done
+
7280  if (last_token == lexer::token_type::end_object)
+
7281  {
+
7282  get_token();
+
7283  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
+
7284  {
+
7285  result = basic_json(value_t::discarded);
+
7286  }
+
7287  return result;
+
7288  }
+
7289 
+
7290  // no comma is expected here
+
7291  unexpect(lexer::token_type::value_separator);
+
7292 
+
7293  // otherwise: parse key-value pairs
+
7294  do
+
7295  {
+
7296  // ugly, but could be fixed with loop reorganization
+
7297  if (last_token == lexer::token_type::value_separator)
+
7298  {
+
7299  get_token();
+
7300  }
7301 
-
7302  case lexer::token_type::value_string:
-
7303  {
-
7304  const auto s = m_lexer.get_string();
-
7305  get_token();
-
7306  result = basic_json(s);
-
7307  break;
-
7308  }
-
7309 
-
7310  case lexer::token_type::literal_true:
-
7311  {
-
7312  get_token();
-
7313  result.m_type = value_t::boolean;
-
7314  result.m_value = true;
-
7315  break;
-
7316  }
-
7317 
-
7318  case lexer::token_type::literal_false:
-
7319  {
-
7320  get_token();
-
7321  result.m_type = value_t::boolean;
-
7322  result.m_value = false;
-
7323  break;
-
7324  }
-
7325 
-
7326  case lexer::token_type::value_number:
-
7327  {
-
7328  auto float_val = m_lexer.get_number();
-
7329 
-
7330  // NAN is returned if token could not be translated
-
7331  // completely
-
7332  if (std::isnan(float_val))
-
7333  {
-
7334  throw std::invalid_argument(std::string("parse error - ") +
-
7335  m_lexer.get_token() + " is not a number");
-
7336  }
-
7337 
-
7338  get_token();
-
7339 
-
7340  // check if conversion loses precision
-
7341  const auto int_val = static_cast<number_integer_t>(float_val);
-
7342  if (approx(float_val, static_cast<long double>(int_val)))
-
7343  {
-
7344  // we basic_json not lose precision -> return int
-
7345  result.m_type = value_t::number_integer;
-
7346  result.m_value = int_val;
-
7347  }
-
7348  else
-
7349  {
-
7350  // we would lose precision -> returnfloat
-
7351  result.m_type = value_t::number_float;
-
7352  result.m_value = static_cast<number_float_t>(float_val);
-
7353  }
-
7354  break;
-
7355  }
+
7302  // store key
+
7303  expect(lexer::token_type::value_string);
+
7304  const auto key = m_lexer.get_string();
+
7305 
+
7306  bool keep_tag = false;
+
7307  if (keep)
+
7308  {
+
7309  if (callback)
+
7310  {
+
7311  basic_json k(key);
+
7312  keep_tag = callback(depth, parse_event_t::key, k);
+
7313  }
+
7314  else
+
7315  {
+
7316  keep_tag = true;
+
7317  }
+
7318  }
+
7319 
+
7320  // parse separator (:)
+
7321  get_token();
+
7322  expect(lexer::token_type::name_separator);
+
7323 
+
7324  // parse and add value
+
7325  get_token();
+
7326  auto value = parse_internal(keep);
+
7327  if (keep and keep_tag and not value.is_discarded())
+
7328  {
+
7329  result[key] = std::move(value);
+
7330  }
+
7331  }
+
7332  while (last_token == lexer::token_type::value_separator);
+
7333 
+
7334  // closing }
+
7335  expect(lexer::token_type::end_object);
+
7336  get_token();
+
7337  if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
+
7338  {
+
7339  result = basic_json(value_t::discarded);
+
7340  }
+
7341 
+
7342  return result;
+
7343  }
+
7344 
+
7345  case lexer::token_type::begin_array:
+
7346  {
+
7347  if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))
+
7348  {
+
7349  // explicitly set result to object to cope with []
+
7350  result.m_type = value_t::array;
+
7351  result.m_value = json_value(value_t::array);
+
7352  }
+
7353 
+
7354  // read next token
+
7355  get_token();
7356 
-
7357  default:
-
7358  {
-
7359  // the last token was unexpected
-
7360  unexpect(last_token);
-
7361  }
-
7362  }
-
7363 
-
7364  if (keep and callback and not callback(depth, parse_event_t::value, result))
-
7365  {
-
7366  result = basic_json(value_t::discarded);
-
7367  }
-
7368  return result;
-
7369  }
+
7357  // closing ] -> we are done
+
7358  if (last_token == lexer::token_type::end_array)
+
7359  {
+
7360  get_token();
+
7361  if (callback and not callback(--depth, parse_event_t::array_end, result))
+
7362  {
+
7363  result = basic_json(value_t::discarded);
+
7364  }
+
7365  return result;
+
7366  }
+
7367 
+
7368  // no comma is expected here
+
7369  unexpect(lexer::token_type::value_separator);
7370 
-
7372  typename lexer::token_type get_token()
-
7373  {
-
7374  last_token = m_lexer.scan();
-
7375  return last_token;
-
7376  }
-
7377 
-
7378  void expect(typename lexer::token_type t) const
-
7379  {
-
7380  if (t != last_token)
-
7381  {
-
7382  std::string error_msg = "parse error - unexpected \'";
-
7383  error_msg += m_lexer.get_token();
-
7384  error_msg += "\' (" + lexer::token_type_name(last_token);
-
7385  error_msg += "); expected " + lexer::token_type_name(t);
-
7386  throw std::invalid_argument(error_msg);
-
7387  }
-
7388  }
-
7389 
-
7390  void unexpect(typename lexer::token_type t) const
-
7391  {
-
7392  if (t == last_token)
-
7393  {
-
7394  std::string error_msg = "parse error - unexpected \'";
-
7395  error_msg += m_lexer.get_token();
-
7396  error_msg += "\' (";
-
7397  error_msg += lexer::token_type_name(last_token) + ")";
-
7398  throw std::invalid_argument(error_msg);
-
7399  }
-
7400  }
-
7401 
-
7402  private:
-
7404  int depth = 0;
-
7406  parser_callback_t callback;
-
7408  typename lexer::token_type last_token = lexer::token_type::uninitialized;
-
7410  lexer m_lexer;
-
7411  };
-
7412 };
-
7413 
+
7371  // otherwise: parse values
+
7372  do
+
7373  {
+
7374  // ugly, but could be fixed with loop reorganization
+
7375  if (last_token == lexer::token_type::value_separator)
+
7376  {
+
7377  get_token();
+
7378  }
+
7379 
+
7380  // parse value
+
7381  auto value = parse_internal(keep);
+
7382  if (keep and not value.is_discarded())
+
7383  {
+
7384  result.push_back(std::move(value));
+
7385  }
+
7386  }
+
7387  while (last_token == lexer::token_type::value_separator);
+
7388 
+
7389  // closing ]
+
7390  expect(lexer::token_type::end_array);
+
7391  get_token();
+
7392  if (keep and callback and not callback(--depth, parse_event_t::array_end, result))
+
7393  {
+
7394  result = basic_json(value_t::discarded);
+
7395  }
+
7396 
+
7397  return result;
+
7398  }
+
7399 
+
7400  case lexer::token_type::literal_null:
+
7401  {
+
7402  get_token();
+
7403  result.m_type = value_t::null;
+
7404  break;
+
7405  }
+
7406 
+
7407  case lexer::token_type::value_string:
+
7408  {
+
7409  const auto s = m_lexer.get_string();
+
7410  get_token();
+
7411  result = basic_json(s);
+
7412  break;
+
7413  }
7414 
-
7416 // presets //
-
7418 
- -
7426 }
-
7427 
-
7428 
-
7430 // nonmember functions //
-
7432 
-
7433 // specialization of std::swap, and std::hash
-
7434 namespace std
-
7435 {
-
7439 template <>
-
7440 inline void swap(nlohmann::json& j1,
-
7441  nlohmann::json& j2) noexcept(
-
7442  is_nothrow_move_constructible<nlohmann::json>::value and
-
7443  is_nothrow_move_assignable<nlohmann::json>::value
-
7444  )
-
7445 {
-
7446  j1.swap(j2);
-
7447 }
-
7448 
-
7450 template <>
-
7451 struct hash<nlohmann::json>
-
7452 {
-
7454  std::size_t operator()(const nlohmann::json& j) const
-
7455  {
-
7456  // a naive hashing via the string representation
-
7457  const auto& h = hash<nlohmann::json::string_t>();
-
7458  return h(j.dump());
-
7459  }
-
7460 };
-
7461 }
-
7462 
-
7473 inline nlohmann::json operator "" _json(const char* s, std::size_t)
-
7474 {
-
7475  return nlohmann::json::parse(reinterpret_cast<nlohmann::json::string_t::value_type*>
-
7476  (const_cast<char*>(s)));
-
7477 }
-
7478 
-
7479 #endif
-
basic_json(const number_float_t value)
create a floating-point number (explicit)
Definition: json.hpp:1235
-
json_reverse_iterator< typename basic_json::iterator > reverse_iterator
a reverse iterator for a basic_json container
Definition: json.hpp:233
-
iterator_wrapper(basic_json &cont)
construct iterator wrapper from a container
Definition: json.hpp:5925
-
bool operator!=(const const_iterator &other) const
comparison: not equal
Definition: json.hpp:5422
-
iterator operator++(int)
post-increment (it++)
Definition: json.hpp:5657
-
friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
comparison: less than or equal
Definition: json.hpp:4444
-
iterator insert(const_iterator pos, basic_json &&value)
inserts element
Definition: json.hpp:3925
-
typename std::allocator_traits< allocator_type >::pointer pointer
the type of an element pointer
Definition: json.hpp:221
-
json_reverse_iterator operator-(difference_type i) const
subtract from iterator
Definition: json.hpp:5807
-
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:1483
-
const_reference operator[](size_type idx) const
access specified array element
Definition: json.hpp:2719
-
reference operator[](const T(&key)[n])
access specified object element
Definition: json.hpp:2803
-
typename basic_json::const_pointer pointer
defines a pointer to the type iterated over (value_type)
Definition: json.hpp:5122
-
const_iterator & operator--()
pre-decrement (–it)
Definition: json.hpp:5367
-
friend std::istream & operator>>(std::istream &i, basic_json &j)
deserialize from stream
Definition: json.hpp:4642
-
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:5187
-
typename basic_json::value_type value_type
the type of the values when the iterator is dereferenced
Definition: json.hpp:5118
-
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:1743
-
iterator insert(const_iterator pos, const_iterator first, const_iterator last)
inserts elements
Definition: json.hpp:3996
-
basic_json(const int value)
create an integer number from an enum type (explicit)
Definition: json.hpp:1171
-
json_reverse_iterator operator--(int)
post-decrement (it–)
Definition: json.hpp:5779
-
StringType string_t
a type for a string
Definition: json.hpp:417
-
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:1443
-
iterator & operator++()
pre-increment (++it)
Definition: json.hpp:5665
-
friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
comparison: not equal
Definition: json.hpp:4328
-
reference operator+=(const typename object_t::value_type &value)
add an object to an object
Definition: json.hpp:3875
-
ArrayType< basic_json, AllocatorType< basic_json >> array_t
a type for an array
Definition: json.hpp:371
-
const_iterator & operator++()
pre-increment (++it)
Definition: json.hpp:5331
-
difference_type operator-(const json_reverse_iterator &other) const
return difference
Definition: json.hpp:5815
-
basic_json<> json
default JSON class
Definition: json.hpp:7425
-
reference front()
access the first element
Definition: json.hpp:2921
-
bool is_array() const noexcept
return whether value is an array
Definition: json.hpp:2023
-
const_iterator find(typename object_t::key_type key) const
find an element in a JSON object
Definition: json.hpp:3250
-
std::reverse_iterator< Base > base_iterator
shortcut to the reverse iterator adaptor
Definition: json.hpp:5754
-
json_reverse_iterator(const typename base_iterator::iterator_type &it)
create reverse iterator from iterator
Definition: json.hpp:5759
-
a class to store JSON values
Definition: json.hpp:181
-
json_reverse_iterator & operator--()
pre-decrement (–it)
Definition: json.hpp:5785
-
void push_back(const typename object_t::value_type &value)
add an object to an object
Definition: json.hpp:3852
-
friend bool operator==(std::nullptr_t, const_reference v) noexcept
comparison: equal
Definition: json.hpp:4309
-
const_iterator cbegin() const
returns a const iterator to the first element
Definition: json.hpp:3342
-
basic_json(const CompatibleObjectType &value)
create an object (implicit)
Definition: json.hpp:942
-
bool is_string() const noexcept
return whether value is a string
Definition: json.hpp:2040
-
iterator & operator+=(difference_type i)
add to iterator
Definition: json.hpp:5687
-
const PointerType get_ptr() const noexcept
get a pointer value (implicit)
Definition: json.hpp:2470
+
7415  case lexer::token_type::literal_true:
+
7416  {
+
7417  get_token();
+
7418  result.m_type = value_t::boolean;
+
7419  result.m_value = true;
+
7420  break;
+
7421  }
+
7422 
+
7423  case lexer::token_type::literal_false:
+
7424  {
+
7425  get_token();
+
7426  result.m_type = value_t::boolean;
+
7427  result.m_value = false;
+
7428  break;
+
7429  }
+
7430 
+
7431  case lexer::token_type::value_number:
+
7432  {
+
7433  auto float_val = m_lexer.get_number();
+
7434 
+
7435  // NAN is returned if token could not be translated
+
7436  // completely
+
7437  if (std::isnan(float_val))
+
7438  {
+
7439  throw std::invalid_argument(std::string("parse error - ") +
+
7440  m_lexer.get_token() + " is not a number");
+
7441  }
+
7442 
+
7443  get_token();
+
7444 
+
7445  // check if conversion loses precision
+
7446  const auto int_val = static_cast<number_integer_t>(float_val);
+
7447  if (approx(float_val, static_cast<long double>(int_val)))
+
7448  {
+
7449  // we would not lose precision -> return int
+
7450  result.m_type = value_t::number_integer;
+
7451  result.m_value = int_val;
+
7452  }
+
7453  else
+
7454  {
+
7455  // we would lose precision -> return float
+
7456  result.m_type = value_t::number_float;
+
7457  result.m_value = static_cast<number_float_t>(float_val);
+
7458  }
+
7459  break;
+
7460  }
+
7461 
+
7462  default:
+
7463  {
+
7464  // the last token was unexpected
+
7465  unexpect(last_token);
+
7466  }
+
7467  }
+
7468 
+
7469  if (keep and callback and not callback(depth, parse_event_t::value, result))
+
7470  {
+
7471  result = basic_json(value_t::discarded);
+
7472  }
+
7473  return result;
+
7474  }
+
7475 
+
7477  typename lexer::token_type get_token()
+
7478  {
+
7479  last_token = m_lexer.scan();
+
7480  return last_token;
+
7481  }
+
7482 
+
7483  void expect(typename lexer::token_type t) const
+
7484  {
+
7485  if (t != last_token)
+
7486  {
+
7487  std::string error_msg = "parse error - unexpected \'";
+
7488  error_msg += m_lexer.get_token();
+
7489  error_msg += "\' (" + lexer::token_type_name(last_token);
+
7490  error_msg += "); expected " + lexer::token_type_name(t);
+
7491  throw std::invalid_argument(error_msg);
+
7492  }
+
7493  }
+
7494 
+
7495  void unexpect(typename lexer::token_type t) const
+
7496  {
+
7497  if (t == last_token)
+
7498  {
+
7499  std::string error_msg = "parse error - unexpected \'";
+
7500  error_msg += m_lexer.get_token();
+
7501  error_msg += "\' (";
+
7502  error_msg += lexer::token_type_name(last_token) + ")";
+
7503  throw std::invalid_argument(error_msg);
+
7504  }
+
7505  }
+
7506 
+
7507  private:
+
7509  int depth = 0;
+
7511  parser_callback_t callback;
+
7513  typename lexer::token_type last_token = lexer::token_type::uninitialized;
+
7515  lexer m_lexer;
+
7516  };
+
7517 };
+
7518 
+
7519 
+
7521 // presets //
+
7523 
+ +
7533 }
+
7534 
+
7535 
+
7537 // nonmember functions //
+
7539 
+
7540 // specialization of std::swap, and std::hash
+
7541 namespace std
+
7542 {
+
7548 template <>
+
7549 inline void swap(nlohmann::json& j1,
+
7550  nlohmann::json& j2) noexcept(
+
7551  is_nothrow_move_constructible<nlohmann::json>::value and
+
7552  is_nothrow_move_assignable<nlohmann::json>::value
+
7553  )
+
7554 {
+
7555  j1.swap(j2);
+
7556 }
+
7557 
+
7559 template <>
+
7560 struct hash<nlohmann::json>
+
7561 {
+
7567  std::size_t operator()(const nlohmann::json& j) const
+
7568  {
+
7569  // a naive hashing via the string representation
+
7570  const auto& h = hash<nlohmann::json::string_t>();
+
7571  return h(j.dump());
+
7572  }
+
7573 };
+
7574 }
+
7575 
+
7588 inline nlohmann::json operator "" _json(const char* s, std::size_t)
+
7589 {
+
7590  return nlohmann::json::parse(reinterpret_cast<nlohmann::json::string_t::value_type*>
+
7591  (const_cast<char*>(s)));
+
7592 }
+
7593 
+
7594 #endif
+
basic_json(const number_float_t value)
create a floating-point number (explicit)
Definition: json.hpp:1258
+
json_reverse_iterator< typename basic_json::iterator > reverse_iterator
a reverse iterator for a basic_json container
Definition: json.hpp:239
+
iterator_wrapper(basic_json &cont)
construct iterator wrapper from a container
Definition: json.hpp:6028
+
bool operator!=(const const_iterator &other) const
comparison: not equal
Definition: json.hpp:5531
+
iterator operator++(int)
post-increment (it++)
Definition: json.hpp:5758
+
friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
comparison: less than or equal
Definition: json.hpp:4566
+
iterator insert(const_iterator pos, basic_json &&value)
inserts element
Definition: json.hpp:4017
+
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:5910
+
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:1506
+
const_reference operator[](size_type idx) const
access specified array element
Definition: json.hpp:2752
+
reference operator[](const T(&key)[n])
access specified object element
Definition: json.hpp:2830
+
typename basic_json::const_pointer pointer
defines a pointer to the type iterated over (value_type)
Definition: json.hpp:5243
+
const_iterator & operator--()
pre-decrement (–it)
Definition: json.hpp:5476
+
friend std::istream & operator>>(std::istream &i, basic_json &j)
deserialize from stream
Definition: json.hpp:4779
+
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:5308
+
typename basic_json::value_type value_type
the type of the values when the iterator is dereferenced
Definition: json.hpp:5239
+
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:1768
+
iterator insert(const_iterator pos, const_iterator first, const_iterator last)
inserts elements
Definition: json.hpp:4092
+
basic_json(const int value)
create an integer number from an enum type (explicit)
Definition: json.hpp:1194
+
json_reverse_iterator operator--(int)
post-decrement (it–)
Definition: json.hpp:5882
+
StringType string_t
a type for a string
Definition: json.hpp:433
+
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:1466
+
iterator & operator++()
pre-increment (++it)
Definition: json.hpp:5766
+
friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
comparison: not equal
Definition: json.hpp:4444
+
reference operator+=(const typename object_t::value_type &value)
add an object to an object
Definition: json.hpp:3965
+
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:5441
+
difference_type operator-(const json_reverse_iterator &other) const
return difference
Definition: json.hpp:5918
+
basic_json<> json
default JSON class
Definition: json.hpp:7532
+
reference front()
access the first element
Definition: json.hpp:2947
+
bool is_array() const noexcept
return whether value is an array
Definition: json.hpp:2081
+
const_iterator find(typename object_t::key_type key) const
find an element in a JSON object
Definition: json.hpp:3308
+
std::reverse_iterator< Base > base_iterator
shortcut to the reverse iterator adaptor
Definition: json.hpp:5857
+
json_reverse_iterator(const typename base_iterator::iterator_type &it)
create reverse iterator from iterator
Definition: json.hpp:5862
+
a class to store JSON values
Definition: json.hpp:187
+
json_reverse_iterator & operator--()
pre-decrement (–it)
Definition: json.hpp:5888
+
void push_back(const typename object_t::value_type &value)
add an object to an object
Definition: json.hpp:3942
+
friend bool operator==(std::nullptr_t, const_reference v) noexcept
comparison: equal
Definition: json.hpp:4423
+
const_iterator cbegin() const
returns a const iterator to the first element
Definition: json.hpp:3406
+
basic_json(const CompatibleObjectType &value)
create an object (implicit)
Definition: json.hpp:965
+
bool is_string() const noexcept
return whether value is a string
Definition: json.hpp:2100
+
iterator & operator+=(difference_type i)
add to iterator
Definition: json.hpp:5788
+
const PointerType get_ptr() const noexcept
get a pointer value (implicit)
Definition: json.hpp:2509
the parser read ] and finished processing a JSON array
-
const_iterator base_iterator
Definition: json.hpp:5616
-
a mutable random access iterator for the basic_json class
Definition: json.hpp:5613
-
iterator & operator-=(difference_type i)
subtract from iterator
Definition: json.hpp:5694
-
static basic_json parse(std::istream &&i, parser_callback_t cb=nullptr)
Definition: json.hpp:4606
-
reference operator[](const typename object_t::key_type &key)
access specified object element
Definition: json.hpp:2756
+
const_iterator base_iterator
Definition: json.hpp:5717
+
a mutable random access iterator for the basic_json class
Definition: json.hpp:5714
+
iterator & operator-=(difference_type i)
subtract from iterator
Definition: json.hpp:5795
+
static basic_json parse(std::istream &&i, parser_callback_t cb=nullptr)
deserialize from stream
Definition: json.hpp:4741
+
reference operator[](const typename object_t::key_type &key)
access specified object element
Definition: json.hpp:2786
STL namespace.
-
difference_type operator-(const iterator &other) const
Definition: json.hpp:5716
-
reference value() const
return the value of an iterator
Definition: json.hpp:5591
-
iterator insert(const_iterator pos, size_type count, const basic_json &value)
inserts elements
Definition: json.hpp:3950
-
const_iterator end() const
returns a const iterator to one past the last element
Definition: json.hpp:3375
-
const_iterator(const const_iterator &other) noexcept
copy constructor
Definition: json.hpp:5182
-
reference at(const typename object_t::key_type &key)
access specified object element with bounds checking
Definition: json.hpp:2607
-
reference operator+=(const basic_json &value)
add an object to an array
Definition: json.hpp:3828
-
object_t::key_type key() const
return the key of an object iterator
Definition: json.hpp:5578
-
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3365
-
ObjectType< StringType, basic_json, std::less< StringType >, AllocatorType< std::pair< const StringType, basic_json >>> object_t
a type for an object
Definition: json.hpp:328
-
reference operator*()
return a reference to the value pointed to by the iterator
Definition: json.hpp:5645
-
reverse_iterator rend()
returns an iterator to the reverse-end
Definition: json.hpp:3448
-
bool is_object() const noexcept
return whether value is an object
Definition: json.hpp:2006
-
const_iterator operator-(difference_type i)
subtract from iterator
Definition: json.hpp:5514
-
bool is_discarded() const noexcept
return whether value is discarded
Definition: json.hpp:2062
-
typename basic_json::const_reference reference
defines a reference to the type iterated over (value_type)
Definition: json.hpp:5124
-
const_reverse_iterator rend() const
returns a const reverse iterator to one before the first
Definition: json.hpp:3456
-
basic_json(const CompatibleArrayType &value)
create an array (implicit)
Definition: json.hpp:1006
-
size_type erase(const typename object_t::key_type &key)
remove element from a JSON object given a key
Definition: json.hpp:3174
-
bool is_boolean() const noexcept
return whether value is a boolean
Definition: json.hpp:1935
-
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3310
-
const_reference at(const typename object_t::key_type &key) const
access specified object element with bounds checking
Definition: json.hpp:2643
-
AllocatorType< basic_json > allocator_type
the allocator type
Definition: json.hpp:218
-
bool is_number_integer() const noexcept
return whether value is an integer number
Definition: json.hpp:1971
-
basic_json(const string_t &value)
create a string (explicit)
Definition: json.hpp:1035
-
iterator operator+(difference_type i)
add to iterator
Definition: json.hpp:5701
-
std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
per-element parser callback type
Definition: json.hpp:803
+
difference_type operator-(const iterator &other) const
Definition: json.hpp:5817
+
reference value() const
return the value of an iterator
Definition: json.hpp:5690
+
iterator insert(const_iterator pos, size_type count, const basic_json &value)
inserts elements
Definition: json.hpp:4044
+
const_iterator end() const
returns a const iterator to one past the last element
Definition: json.hpp:3441
+
const_iterator(const const_iterator &other) noexcept
copy constructor
Definition: json.hpp:5303
+
reference at(const typename object_t::key_type &key)
access specified object element with bounds checking
Definition: json.hpp:2644
+
reference operator+=(const basic_json &value)
add an object to an array
Definition: json.hpp:3916
+
object_t::key_type key() const
return the key of an object iterator
Definition: json.hpp:5682
+
iterator end()
returns an iterator to one past the last element
Definition: json.hpp:3431
+
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:5746
+
reverse_iterator rend()
returns an iterator to the reverse-end
Definition: json.hpp:3520
+
bool is_object() const noexcept
return whether value is an object
Definition: json.hpp:2062
+
const_iterator operator-(difference_type i)
subtract from iterator
Definition: json.hpp:5623
+
bool is_discarded() const noexcept
return whether value is discarded
Definition: json.hpp:2124
+
typename basic_json::const_reference reference
defines a reference to the type iterated over (value_type)
Definition: json.hpp:5245
+
const_reverse_iterator rend() const
returns a const reverse iterator to one before the first
Definition: json.hpp:3528
+
basic_json(const CompatibleArrayType &value)
create an array (implicit)
Definition: json.hpp:1029
+
size_type erase(const typename object_t::key_type &key)
remove element from a JSON object given a key
Definition: json.hpp:3227
+
bool is_boolean() const noexcept
return whether value is a boolean
Definition: json.hpp:1973
+
iterator begin()
returns an iterator to the first element
Definition: json.hpp:3372
+
const_reference at(const typename object_t::key_type &key) const
access specified object element with bounds checking
Definition: json.hpp:2677
+
AllocatorType< basic_json > allocator_type
the allocator type
Definition: json.hpp:224
+
bool is_number_integer() const noexcept
return whether value is an integer number
Definition: json.hpp:2020
+
basic_json(const string_t &value)
create a string (explicit)
Definition: json.hpp:1058
+
iterator operator+(difference_type i)
add to iterator
Definition: json.hpp:5802
+
std::function< bool(int depth, parse_event_t event, basic_json &parsed)> parser_callback_t
per-element parser callback type
Definition: json.hpp:819
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:3234
-
friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
comparison: greater than or equal
Definition: json.hpp:4484
-
iterator & operator--()
pre-decrement (–it)
Definition: json.hpp:5680
-
friend bool operator<(const_reference lhs, const_reference rhs) noexcept
comparison: less than
Definition: json.hpp:4385
-
pointer operator->() const
dereference the iterator
Definition: json.hpp:5293
+
iterator find(typename object_t::key_type key)
find an element in a JSON object
Definition: json.hpp:3292
+
friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
comparison: greater than or equal
Definition: json.hpp:4610
+
iterator & operator--()
pre-decrement (–it)
Definition: json.hpp:5781
+
friend bool operator<(const_reference lhs, const_reference rhs) noexcept
comparison: less than
Definition: json.hpp:4505
+
pointer operator->() const
dereference the iterator
Definition: json.hpp:5409
discarded by the the parser callback function
-
const_iterator cend() const
returns a const iterator to one past the last element
Definition: json.hpp:3397
-
typename Base::reference reference
the reference type for the pointed-to element
Definition: json.hpp:5756
-
size_type size() const noexcept
returns the number of elements
Definition: json.hpp:3594
-
static allocator_type get_allocator()
returns the allocator associated with the container
Definition: json.hpp:243
+
const_iterator cend() const
returns a const iterator to one past the last element
Definition: json.hpp:3465
+
typename Base::reference reference
the reference type for the pointed-to element
Definition: json.hpp:5859
+
size_type size() const noexcept
returns the number of elements
Definition: json.hpp:3675
+
static allocator_type get_allocator()
returns the allocator associated with the container
Definition: json.hpp:249
object (unordered set of name/value pairs)
-
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:2539
+
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:2582
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:5763
-
iterator_wrapper_internal end()
return iterator end (needed for range-based for)
Definition: json.hpp:5936
-
value_t type() const noexcept
return the type of the JSON value (explicit)
Definition: json.hpp:1864
-
friend std::ostream & operator>>(const basic_json &j, std::ostream &o)
serialize to stream
Definition: json.hpp:4537
-
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2872
-
basic_json(size_type count, const basic_json &value)
construct an array with count copies of given value
Definition: json.hpp:1507
-
object_t::key_type key() const
return the key of an object iterator
Definition: json.hpp:5827
-
bool is_structured() const noexcept
return whether type is structured
Definition: json.hpp:1901
-
namespace for Niels Lohmann
Definition: json.hpp:77
-
typename basic_json::difference_type difference_type
a type to represent differences between iterators
Definition: json.hpp:5120
-
void swap(array_t &other)
exchanges the values
Definition: json.hpp:4109
-
reverse_iterator rbegin()
returns an iterator to the reverse-beginning
Definition: json.hpp:3419
+
json_reverse_iterator(const base_iterator &it)
create reverse iterator from base class
Definition: json.hpp:5866
+
iterator_wrapper_internal end()
return iterator end (needed for range-based for)
Definition: json.hpp:6039
+
value_t type() const noexcept
return the type of the JSON value (explicit)
Definition: json.hpp:1894
+
friend std::ostream & operator>>(const basic_json &j, std::ostream &o)
serialize to stream
Definition: json.hpp:4665
+
ValueType value(const typename object_t::key_type &key, ValueType default_value) const
access specified object element with default value
Definition: json.hpp:2896
+
basic_json(size_type count, const basic_json &value)
construct an array with count copies of given value
Definition: json.hpp:1530
+
object_t::key_type key() const
return the key of an object iterator
Definition: json.hpp:5930
+
bool is_structured() const noexcept
return whether type is structured
Definition: json.hpp:1935
+
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:5241
+
void swap(array_t &other)
exchanges the values
Definition: json.hpp:4213
+
reverse_iterator rbegin()
returns an iterator to the reverse-beginning
Definition: json.hpp:3489
-
iterator_wrapper_internal begin()
return iterator begin (needed for range-based for)
Definition: json.hpp:5930
-
reference operator[](difference_type n) const
access to successor
Definition: json.hpp:5722
-
std::size_t size_type
a type to represent container sizes
Definition: json.hpp:215
-
reference operator+=(basic_json &&value)
add an object to an array
Definition: json.hpp:3795
-
const_reverse_iterator rbegin() const
returns a const reverse iterator to the last element
Definition: json.hpp:3427
-
~basic_json()
destructor
Definition: json.hpp:1769
-
basic_json(const array_t &value)
create an array (explicit)
Definition: json.hpp:969
-
basic_json(const basic_json &other)
copy constructor
Definition: json.hpp:1649
-
const_iterator operator+(difference_type i)
add to iterator
Definition: json.hpp:5506
-
basic_json(boolean_t value)
create a boolean (explicit)
Definition: json.hpp:1108
-
value_t
the JSON type enumeration
Definition: json.hpp:595
-
const value_type & const_reference
the type of an element const reference
Definition: json.hpp:209
-
basic_json(const CompatibleNumberFloatType value) noexcept
create an floating-point number (implicit)
Definition: json.hpp:1281
-
bool is_null() const noexcept
return whether value is null
Definition: json.hpp:1918
-
void swap(string_t &other)
exchanges the values
Definition: json.hpp:4169
-
reference value() const
return the value of an iterator
Definition: json.hpp:5728
-
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3770
-
const_iterator operator--(int)
post-decrement (it–)
Definition: json.hpp:5358
-
void erase(const size_type idx)
remove element from a JSON array given an index
Definition: json.hpp:3201
-
void clear() noexcept
clears the contents
Definition: json.hpp:3706
-
basic_json(const CompatibleStringType &value)
create a string (implicit)
Definition: json.hpp:1090
-
pointer operator->()
dereference the iterator
Definition: json.hpp:5651
-
basic_json value_type
the type of elements in a basic_json container
Definition: json.hpp:203
+
iterator_wrapper_internal begin()
return iterator begin (needed for range-based for)
Definition: json.hpp:6033
+
reference operator[](difference_type n) const
access to successor
Definition: json.hpp:5823
+
std::size_t size_type
a type to represent container sizes
Definition: json.hpp:221
+
reference operator+=(basic_json &&value)
add an object to an array
Definition: json.hpp:3883
+
const_reverse_iterator rbegin() const
returns a const reverse iterator to the last element
Definition: json.hpp:3497
+
~basic_json()
destructor
Definition: json.hpp:1794
+
basic_json(const array_t &value)
create an array (explicit)
Definition: json.hpp:992
+
basic_json(const basic_json &other)
copy constructor
Definition: json.hpp:1672
+
const_iterator operator+(difference_type i)
add to iterator
Definition: json.hpp:5615
+
basic_json(boolean_t value)
create a boolean (explicit)
Definition: json.hpp:1131
+
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 CompatibleNumberFloatType value) noexcept
create an floating-point number (implicit)
Definition: json.hpp:1304
+
bool is_null() const noexcept
return whether value is null
Definition: json.hpp:1954
+
void swap(string_t &other)
exchanges the values
Definition: json.hpp:4277
+
reference value() const
return the value of an iterator
Definition: json.hpp:5829
+
void push_back(basic_json &&value)
add an object to an array
Definition: json.hpp:3858
+
const_iterator operator--(int)
post-decrement (it–)
Definition: json.hpp:5468
+
void erase(const size_type idx)
remove element from a JSON array given an index
Definition: json.hpp:3257
+
void clear() noexcept
clears the contents
Definition: json.hpp:3792
+
basic_json(const CompatibleStringType &value)
create a string (implicit)
Definition: json.hpp:1113
+
pointer operator->()
dereference the iterator
Definition: json.hpp:5752
+
basic_json value_type
the type of elements in a basic_json container
Definition: json.hpp:209
array (ordered collection of values)
-
const_reference front() const
access the first element
Definition: json.hpp:2929
-
bool operator>=(const const_iterator &other) const
comparison: greater than or equal
Definition: json.hpp:5468
-
iterator insert(const_iterator pos, std::initializer_list< basic_json > ilist)
inserts elements
Definition: json.hpp:4046
-
std::ptrdiff_t difference_type
a type to represent differences between iterators
Definition: json.hpp:212
-
const_iterator & operator+=(difference_type i)
add to iterator
Definition: json.hpp:5474
-
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:1353
-
difference_type operator-(const const_iterator &other) const
return difference
Definition: json.hpp:5522
-
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
comparison: equal
Definition: json.hpp:4244
-
bool is_number() const noexcept
return whether value is a number
Definition: json.hpp:1953
-
BooleanType boolean_t
a type for a boolean
Definition: json.hpp:443
-
const_reverse_iterator crend() const
returns a const reverse iterator to one before the first
Definition: json.hpp:3498
+
const_reference front() const
access the first element
Definition: json.hpp:2955
+
bool operator>=(const const_iterator &other) const
comparison: greater than or equal
Definition: json.hpp:5577
+
iterator insert(const_iterator pos, std::initializer_list< basic_json > ilist)
inserts elements
Definition: json.hpp:4146
+
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:5583
+
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:1376
+
difference_type operator-(const const_iterator &other) const
return difference
Definition: json.hpp:5631
+
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
comparison: equal
Definition: json.hpp:4356
+
bool is_number() const noexcept
return whether value is a number
Definition: json.hpp:1997
+
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:3574
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:3540
-
string_t value(const typename object_t::key_type &key, const char *default_value) const
access specified object element with default value
Definition: json.hpp:2898
-
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:4081
-
basic_json(const object_t &value)
create an object (explicit)
Definition: json.hpp:910
-
json_reverse_iterator< typename basic_json::const_iterator > const_reverse_iterator
a const reverse iterator for a basic_json container
Definition: json.hpp:235
-
const_reverse_iterator crbegin() const
returns a const reverse iterator to the last element
Definition: json.hpp:3477
-
reference value() const
return the value of an iterator
Definition: json.hpp:5834
+
bool empty() const noexcept
checks whether the container is empty
Definition: json.hpp:3618
+
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:2922
+
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:4183
+
basic_json(const object_t &value)
create an object (explicit)
Definition: json.hpp:933
+
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:3551
+
reference value() const
return the value of an iterator
Definition: json.hpp:5937
-
const_iterator(pointer object)
constructor for a given JSON instance
Definition: json.hpp:5132
-
friend bool operator<(const value_t lhs, const value_t rhs)
comparison operator for JSON types
Definition: json.hpp:4200
-
iterator(pointer object) noexcept
constructor for a given JSON instance
Definition: json.hpp:5624
-
bool operator<(const const_iterator &other) const
comparison: smaller
Definition: json.hpp:5428
-
string_t dump(const int indent=-1) const
serialization
Definition: json.hpp:1835
-
friend bool operator!=(const_reference v, std::nullptr_t) noexcept
comparison: not equal
Definition: json.hpp:4349
-
const_iterator & operator-=(difference_type i)
subtract from iterator
Definition: json.hpp:5500
+
const_iterator(pointer object)
constructor for a given JSON instance
Definition: json.hpp:5253
+
friend bool operator<(const value_t lhs, const value_t rhs)
comparison operator for JSON types
Definition: json.hpp:4310
+
iterator(pointer object) noexcept
constructor for a given JSON instance
Definition: json.hpp:5725
+
bool operator<(const const_iterator &other) const
comparison: smaller
Definition: json.hpp:5537
+
string_t dump(const int indent=-1) const
serialization
Definition: json.hpp:1863
+
friend bool operator!=(const_reference v, std::nullptr_t) noexcept
comparison: not equal
Definition: json.hpp:4467
+
const_iterator & operator-=(difference_type i)
subtract from iterator
Definition: json.hpp:5609
number value (floating-point)
-
basic_json(const CompatibleNumberIntegerType value) noexcept
create an integer number (implicit)
Definition: json.hpp:1206
-
static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
deserialize from string
Definition: json.hpp:4574
-
InteratorType erase(InteratorType first, InteratorType last)
remove elements given an iterator range
Definition: json.hpp:3102
-
json_reverse_iterator operator++(int)
post-increment (it++)
Definition: json.hpp:5766
-
PointerType get_ptr() noexcept
get a pointer value (implicit)
Definition: json.hpp:2455
-
void push_back(const basic_json &value)
add an object to an array
Definition: json.hpp:3805
+
basic_json(const CompatibleNumberIntegerType value) noexcept
create an integer number (implicit)
Definition: json.hpp:1229
+
static basic_json parse(const string_t &s, parser_callback_t cb=nullptr)
deserialize from string
Definition: json.hpp:4704
+
InteratorType erase(InteratorType first, InteratorType last)
remove elements given an iterator range
Definition: json.hpp:3147
+
json_reverse_iterator operator++(int)
post-increment (it++)
Definition: json.hpp:5869
+
PointerType get_ptr() noexcept
get a pointer value (implicit)
Definition: json.hpp:2494
+
void push_back(const basic_json &value)
add an object to an array
Definition: json.hpp:3893
-
const_iterator(const iterator &other)
copy constructor given a nonconst iterator
Definition: json.hpp:5157
-
friend bool operator!=(std::nullptr_t, const_reference v) noexcept
comparison: not equal
Definition: json.hpp:4358
-
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3009
-
basic_json(const typename string_t::value_type *value)
create a string (explicit)
Definition: json.hpp:1059
-
bool operator<=(const const_iterator &other) const
comparison: less than or equal
Definition: json.hpp:5456
-
reference back()
access the last element
Definition: json.hpp:2953
-
bool is_number_float() const noexcept
return whether value is a floating-point number
Definition: json.hpp:1989
+
const_iterator(const iterator &other)
copy constructor given a nonconst iterator
Definition: json.hpp:5278
+
friend bool operator!=(std::nullptr_t, const_reference v) noexcept
comparison: not equal
Definition: json.hpp:4476
+
InteratorType erase(InteratorType pos)
remove element given an iterator
Definition: json.hpp:3046
+
basic_json(const typename string_t::value_type *value)
create a string (explicit)
Definition: json.hpp:1082
+
bool operator<=(const const_iterator &other) const
comparison: less than or equal
Definition: json.hpp:5565
+
reference back()
access the last element
Definition: json.hpp:2981
+
bool is_number_float() const noexcept
return whether value is a floating-point number
Definition: json.hpp:2043
the parser read { and started to process a JSON object
-
const_iterator operator++(int)
post-increment (it++)
Definition: json.hpp:5322
-
typename std::allocator_traits< allocator_type >::const_pointer const_pointer
the type of an element const pointer
Definition: json.hpp:223
-
iterator(const iterator &other) noexcept
copy constructor
Definition: json.hpp:5628
-
const_reference back() const
access the last element
Definition: json.hpp:2963
-
basic_json(InputIT first, InputIT last)
construct a JSON container given an iterator range
Definition: json.hpp:1551
-
static basic_json parse(std::istream &i, parser_callback_t cb=nullptr)
deserialize from stream
Definition: json.hpp:4601
-
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:3278
-
size_type max_size() const noexcept
returns the maximum possible number of elements
Definition: json.hpp:3651
-
bool operator==(const const_iterator &other) const
comparison: equal
Definition: json.hpp:5394
-
json_reverse_iterator & operator++()
pre-increment (++it)
Definition: json.hpp:5772
-
bool operator>(const const_iterator &other) const
comparison: greater than
Definition: json.hpp:5462
-
friend bool operator>(const_reference lhs, const_reference rhs) noexcept
comparison: greater than
Definition: json.hpp:4464
-
basic_json(basic_json &&other) noexcept
move constructor
Definition: json.hpp:1715
-
const_iterator begin() const
returns a const iterator to the first element
Definition: json.hpp:3320
-
const_reference at(size_type idx) const
access specified array element with bounds checking
Definition: json.hpp:2571
-
json_reverse_iterator & operator+=(difference_type i)
add to iterator
Definition: json.hpp:5792
-
a const random access iterator for the basic_json class
Definition: json.hpp:5111
-
a template for a reverse iterator class
Definition: json.hpp:226
-
void swap(object_t &other)
exchanges the values
Definition: json.hpp:4139
-
std::bidirectional_iterator_tag iterator_category
the category of the iterator
Definition: json.hpp:5126
-
bool is_primitive() const noexcept
return whether type is primitive
Definition: json.hpp:1883
-
basic_json(const value_t value)
create an empty value with a given type
Definition: json.hpp:843
-
friend bool operator==(const_reference v, std::nullptr_t) noexcept
comparison: equal
Definition: json.hpp:4300
+
const_iterator operator++(int)
post-increment (it++)
Definition: json.hpp:5433
+
typename std::allocator_traits< allocator_type >::const_pointer const_pointer
the type of an element const pointer
Definition: json.hpp:229
+
iterator(const iterator &other) noexcept
copy constructor
Definition: json.hpp:5729
+
const_reference back() const
access the last element
Definition: json.hpp:2991
+
basic_json(InputIT first, InputIT last)
construct a JSON container given an iterator range
Definition: json.hpp:1574
+
static basic_json parse(std::istream &i, parser_callback_t cb=nullptr)
deserialize from stream
Definition: json.hpp:4733
+
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:3338
+
size_type max_size() const noexcept
returns the maximum possible number of elements
Definition: json.hpp:3735
+
bool operator==(const const_iterator &other) const
comparison: equal
Definition: json.hpp:5503
+
json_reverse_iterator & operator++()
pre-increment (++it)
Definition: json.hpp:5875
+
bool operator>(const const_iterator &other) const
comparison: greater than
Definition: json.hpp:5571
+
friend bool operator>(const_reference lhs, const_reference rhs) noexcept
comparison: greater than
Definition: json.hpp:4588
+
basic_json(basic_json &&other) noexcept
move constructor
Definition: json.hpp:1738
+
const_iterator begin() const
returns a const iterator to the first element
Definition: json.hpp:3382
+
const_reference at(size_type idx) const
access specified array element with bounds checking
Definition: json.hpp:2611
+
json_reverse_iterator & operator+=(difference_type i)
add to iterator
Definition: json.hpp:5895
+
a const random access iterator for the basic_json class
Definition: json.hpp:5232
+
a template for a reverse iterator class
Definition: json.hpp:232
+
void swap(object_t &other)
exchanges the values
Definition: json.hpp:4245
+
std::bidirectional_iterator_tag iterator_category
the category of the iterator
Definition: json.hpp:5247
+
bool is_primitive() const noexcept
return whether type is primitive
Definition: json.hpp:1915
+
basic_json(const value_t value)
create an empty value with a given type
Definition: json.hpp:866
+
friend bool operator==(const_reference v, std::nullptr_t) noexcept
comparison: equal
Definition: json.hpp:4414
-
reference operator[](difference_type n) const
access to successor
Definition: json.hpp:5821
-
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:511
-
reference operator[](difference_type n) const
access to successor
Definition: json.hpp:5544
-
reference operator*() const
return a reference to the value pointed to by the iterator
Definition: json.hpp:5259
-
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3899
-
value_type & reference
the type of an element reference
Definition: json.hpp:206
-
friend std::istream & operator<<(basic_json &j, std::istream &i)
deserialize from stream
Definition: json.hpp:4632
+
reference operator[](difference_type n) const
access to successor
Definition: json.hpp:5924
+
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:5653
+
reference operator*() const
return a reference to the value pointed to by the iterator
Definition: json.hpp:5380
+
iterator insert(const_iterator pos, const basic_json &value)
inserts element
Definition: json.hpp:3991
+
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:4769
the parser finished reading a JSON value
-
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:576
-
std::size_t operator()(const nlohmann::json &j) const
return a hash value for a JSON object
Definition: json.hpp:7454
-
friend std::ostream & operator<<(std::ostream &o, const basic_json &j)
serialize to stream
Definition: json.hpp:4519
-
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:5633
-
reference operator[](size_type idx)
access specified array element
Definition: json.hpp:2678
-
iterator operator--(int)
post-decrement (it–)
Definition: json.hpp:5672
-
json_reverse_iterator operator+(difference_type i) const
add to iterator
Definition: json.hpp:5799
-
parse_event_t
JSON callback events.
Definition: json.hpp:738
-
iterator operator-(difference_type i)
subtract from iterator
Definition: json.hpp:5709
-
wrapper to access iterator member functions in range-based for
Definition: json.hpp:5848
+
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:7567
+
friend std::ostream & operator<<(std::ostream &o, const basic_json &j)
serialize to stream
Definition: json.hpp:4647
+
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:5734
+
reference operator[](size_type idx)
access specified array element
Definition: json.hpp:2709
+
iterator operator--(int)
post-decrement (it–)
Definition: json.hpp:5773
+
json_reverse_iterator operator+(difference_type i) const
add to iterator
Definition: json.hpp:5902
+
parse_event_t
JSON callback events.
Definition: json.hpp:754
+
iterator operator-(difference_type i)
subtract from iterator
Definition: json.hpp:5810
+
wrapper to access iterator member functions in range-based for
Definition: json.hpp:5951
diff --git a/namespacemembers.html b/namespacemembers.html index 6e64b5f5d..f16a8ea41 100644 --- a/namespacemembers.html +++ b/namespacemembers.html @@ -94,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/namespacemembers_type.html b/namespacemembers_type.html index 1cce778f2..51a822da8 100644 --- a/namespacemembers_type.html +++ b/namespacemembers_type.html @@ -94,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/namespacenlohmann.html b/namespacenlohmann.html index 39e71a6d3..310d07128 100644 --- a/namespacenlohmann.html +++ b/namespacenlohmann.html @@ -112,10 +112,11 @@ Typedefs

Detailed Description

See also
https://github.com/nlohmann
+
Since
version 1.0
diff --git a/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html b/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html index 5cdf4f88c..afbfb2d9b 100644 --- a/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html +++ b/namespacenlohmann_1_1anonymous__namespace_02json_8hpp_03.html @@ -92,7 +92,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

unnamed namespace with internal helper functions -

+More...

@@ -100,10 +100,12 @@ Classes

Classes

 Helper to determine whether there's a key_type for T.
 
-
+

Detailed Description

+
Since
version 1.0
+
diff --git a/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html b/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html index 9dabed02e..c5a7c35f8 100644 --- a/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html +++ b/namespacenlohmann_a2bfd99e845a2e5cd90aeaf1b1431f474.html @@ -98,9 +98,10 @@ 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.

+

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

+
Since
version 1.0
-

Definition at line 7425 of file json.hpp.

+

Definition at line 7532 of file json.hpp.

@@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 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 7abeff55c..d6cfcc827 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 @@ -98,7 +98,7 @@ 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 2fe88ffb9..fe1c3df40 100644 --- a/structstd_1_1hash_3_01nlohmann_1_1json_01_4.html +++ b/structstd_1_1hash_3_01nlohmann_1_1json_01_4.html @@ -111,11 +111,11 @@ Public Member Functions struct std::hash< nlohmann::json > -

Definition at line 7451 of file json.hpp.

+

Definition at line 7560 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 77a8462e8..f0700fe1e 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 @@ -110,8 +110,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
+
Since
version 1.0
-

Definition at line 7454 of file json.hpp.

+

Definition at line 7567 of file json.hpp.

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