title
stringclasses
1 value
text
stringlengths
30
1.11M
id
stringlengths
27
31
doc/examples/basic_json__size_type_basic_json.cpp/main int main() { // create an array by creating copies of a JSON value json value = "Hello"; json array_0 = json(0, value); json array_1 = json(1, value); json array_5 = json(5, value); // serialize the JSON arrays std::cout << array_0 << '...
negative_train_query0_00198
doc/examples/insert.cpp/main int main() { // create a JSON array json v = {1, 2, 3, 4}; // insert number 10 before number 3 auto new_pos = v.insert(v.begin() + 2, 10); // output new array and result of insert call std::cout << *new_pos << '\n'; std::cout << v << '\n'; }
negative_train_query0_00199
doc/examples/get_to.cpp/main int main() { // create a JSON value with different types json json_types = { {"boolean", true}, { "number", { {"integer", 42}, {"floating-point", 17.23} } }, {"string", "Hello, world!"}, ...
negative_train_query0_00200
doc/examples/is_discarded.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_unsigned_integer = 12345678987654321u; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 16...
negative_train_query0_00201
doc/examples/push_back.cpp/main int main() { // create JSON values json array = {1, 2, 3, 4, 5}; json null; // print values std::cout << array << '\n'; std::cout << null << '\n'; // add values array.push_back(6); array += 7; null += "first"; null += "second"; // print ...
negative_train_query0_00202
doc/examples/back.cpp/main int main() { // create JSON values json j_boolean = true; json j_number_integer = 17; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_object_empty(json::value_t::object); json j_array = {1, 2, 4, 8, 16}; json j_array_empty(json::va...
negative_train_query0_00203
doc/examples/count.cpp/main int main() { // create a JSON object json j_object = {{"one", 1}, {"two", 2}}; // call count() auto count_two = j_object.count("two"); auto count_three = j_object.count("three"); // print values std::cout << "number of elements with key \"two\": " << count_two <...
negative_train_query0_00204
doc/examples/object.cpp/main int main() { // create JSON objects json j_no_init_list = json::object(); json j_empty_init_list = json::object({}); json j_list_of_pairs = json::object({ {"one", 1}, {"two", 2} }); // serialize the JSON objects std::cout << j_no_init_list << '\n'; std::cout << ...
negative_train_query0_00205
doc/examples/is_number_integer.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_unsigned_integer = 12345678987654321u; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, ...
negative_train_query0_00206
doc/examples/to_ubjson.cpp/print_byte void print_byte(uint8_t byte) { if (32 < byte and byte < 128) { std::cout << (char)byte; } else { std::cout << (int)byte; } }
negative_train_query0_00207
doc/examples/to_ubjson.cpp/main int main() { // create a JSON value json j = R"({"compact": true, "schema": false})"_json; // serialize it to UBJSON std::vector<uint8_t> v = json::to_ubjson(j); // print the vector content for (auto& byte : v) { print_byte(byte); } std::cout...
negative_train_query0_00208
doc/examples/invalid_iterator.cpp/main int main() { try { // calling iterator::key() on non-object iterator json j = "string"; json::iterator it = j.begin(); auto k = it.key(); } catch (json::invalid_iterator& e) { // output exception information std::...
negative_train_query0_00209
doc/examples/basic_json__nullptr_t.cpp/main int main() { // implicitly create a JSON null value json j1; // explicitly create a JSON null value json j2(nullptr); // serialize the JSON null value std::cout << j1 << '\n' << j2 << '\n'; }
negative_train_query0_00210
doc/examples/parse__array__parser_callback_t.cpp/main int main() { // a JSON text char text[] = R"( { "Image": { "Width": 800, "Height": 600, "Title": "View from 15th Floor", "Thumbnail": { "Url": "http://www.example.com/image/4819...
negative_train_query0_00211
doc/examples/operatorarray__key_type_const.cpp/main int main() { // create a JSON object const json object = { {"one", 1}, {"two", 2}, {"three", 2.9} }; // output element with key "two" std::cout << object["two"] << '\n'; }
negative_train_query0_00212
doc/examples/crend.cpp/main int main() { // create an array value json array = {1, 2, 3, 4, 5}; // get an iterator to the reverse-end json::const_reverse_iterator it = array.crend(); // increment the iterator to point to the first element --it; // serialize the element that the iterator p...
negative_train_query0_00213
doc/examples/operator__less.cpp/main int main() { // create several JSON values json array_1 = {1, 2, 3}; json array_2 = {1, 2, 4}; json object_1 = {{"A", "a"}, {"B", "b"}}; json object_2 = {{"B", "b"}, {"A", "a"}}; json number_1 = 17; json number_2 = 17.0000000000001L; json string_1 = "...
negative_train_query0_00214
doc/examples/operator_deserialize.cpp/main int main() { // create stream with serialized JSON std::stringstream ss; ss << R"({ "number": 23, "string": "Hello, world!", "array": [1, 2, 3, 4, 5], "boolean": false, "null": null })"; // create JSON value and read...
negative_train_query0_00215
doc/examples/README.cpp/main int main() { // create a JSON object json j = { {"pi", 3.141}, {"happy", true}, {"name", "Niels"}, {"nothing", nullptr}, { "answer", { {"everything", 42} } }, {"list", {1, 0, 2}}, ...
negative_train_query0_00216
doc/examples/is_primitive.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_float = 23.42; json j_number_unsigned_integer = 12345678987654321u; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 16...
negative_train_query0_00217
doc/examples/operator__notequal.cpp/main int main() { // create several JSON values json array_1 = {1, 2, 3}; json array_2 = {1, 2, 4}; json object_1 = {{"A", "a"}, {"B", "b"}}; json object_2 = {{"B", "b"}, {"A", "a"}}; json number_1 = 17; json number_2 = 17.000000000000001L; json string...
negative_train_query0_00218
doc/examples/from_cbor.cpp/main int main() { // create byte vector std::vector<uint8_t> v = {0xa2, 0x67, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0xf5, 0x66, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00 }; // deserialize ...
negative_train_query0_00219
doc/examples/is_string.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_float = 23.42; json j_number_unsigned_integer = 12345678987654321u; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 16}; ...
negative_train_query0_00220
doc/examples/from_ubjson.cpp/main int main() { // create byte vector std::vector<uint8_t> v = {0x7B, 0x69, 0x07, 0x63, 0x6F, 0x6D, 0x70, 0x61, 0x63, 0x74, 0x54, 0x69, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6D, 0x61, 0x69, 0x00, 0x7D ...
negative_train_query0_00221
doc/examples/swap__string_t.cpp/main int main() { // create a JSON value json value = { "the good", "the bad", "the ugly" }; // create string_t json::string_t string = "the fast"; // swap the object stored in the JSON value value[1].swap(string); // output the values std::cout << "val...
negative_train_query0_00222
doc/examples/type.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = -17; json j_number_unsigned = 42u; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 16}; json j_string = "Hello,...
negative_train_query0_00223
doc/examples/json_pointer__back.cpp/main int main() { // different JSON Pointers json::json_pointer ptr1("/foo"); json::json_pointer ptr2("/foo/0"); // call empty() std::cout << "last reference token of " << ptr1 << " is " << ptr1.back() << '\n' << "last reference token of " << ptr2 <...
negative_train_query0_00224
doc/examples/operatorjson_pointer.cpp/main int main() { // create a JSON value json j = { {"number", 1}, {"string", "foo"}, {"array", {1, 2}} }; // read-only access // output element with JSON pointer "/number" std::cout << j["/number"_json_pointer] << '\n'; // output element w...
negative_train_query0_00225
doc/examples/update__range.cpp/main int main() { // create two JSON objects json o1 = R"( {"color": "red", "price": 17.99} )"_json; json o2 = R"( {"color": "blue", "speed": 100} )"_json; // add all keys from o2 to o1 (updating "color") o1.update(o2.begin(), o2.end()); // output updated object ...
negative_train_query0_00226
doc/examples/is_number_unsigned.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_unsigned_integer = 12345678987654321u; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4,...
negative_train_query0_00227
doc/examples/at_json_pointer.cpp/main int main() { // create a JSON value json j = { {"number", 1}, {"string", "foo"}, {"array", {1, 2}} }; // read-only access // output element with JSON pointer "/number" std::cout << j.at("/number"_json_pointer) << '\n'; // output element wit...
negative_train_query0_00228
doc/examples/emplace_back.cpp/main int main() { // create JSON values json array = {1, 2, 3, 4, 5}; json null; // print values std::cout << array << '\n'; std::cout << null << '\n'; // add values array.emplace_back(6); null.emplace_back("first"); null.emplace_back(3, "second");...
negative_train_query0_00229
doc/examples/basic_json__value_ptr.cpp/main int main() { // create a JSON object with different entry types json j = { {"integer", 1}, {"floating", 42.23}, {"string", "hello world"}, {"boolean", true}, {"object", {{"key1", 1}, {"key2", 2}}}, {"array", {1, 2, 3...
negative_train_query0_00230
doc/examples/basic_json__CompatibleType.cpp/main int main() { // ============ // object types // ============ // create an object from an object_t value json::object_t object_value = { {"one", 1}, {"two", 2} }; json j_object_t(object_value); // create an object from std::map std::map<s...
negative_train_query0_00231
doc/examples/swap__reference.cpp/main int main() { // create two JSON values json j1 = {1, 2, 3, 4, 5}; json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}}; // swap the values j1.swap(j2); // output the values std::cout << "j1 = " << j1 << '\n'; std::cout << "j2 = " << j2 <...
negative_train_query0_00232
doc/examples/from_msgpack.cpp/main int main() { // create byte vector std::vector<uint8_t> v = {0x82, 0xa7, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0xc3, 0xa6, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00 }; // deseriali...
negative_train_query0_00233
doc/examples/cbegin.cpp/main int main() { // create an array value const json array = {1, 2, 3, 4, 5}; // get an iterator to the first element json::const_iterator it = array.cbegin(); // serialize the element that the iterator points to std::cout << *it << '\n'; }
negative_train_query0_00234
doc/examples/basic_json__copyassignment.cpp/main int main() { // create JSON values json a = 23; json b = 42; // copy-assign a to b b = a; // serialize the JSON arrays std::cout << a << '\n'; std::cout << b << '\n'; }
negative_train_query0_00235
doc/examples/from_bson.cpp/main int main() { // create byte vector std::vector<uint8_t> v = {0x1b, 0x00, 0x00, 0x00, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x00, 0x01, 0x10, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00, 0x00, 0x00, ...
negative_train_query0_00236
doc/examples/at__object_t_key_type_const.cpp/main int main() { // create JSON object const json object = { {"the good", "il buono"}, {"the bad", "il cattivo"}, {"the ugly", "il brutto"} }; // output element with key "the ugly" std::cout << object.at("the ugly") << '\n'; ...
negative_train_query0_00237
doc/examples/operator__ValueType.cpp/main int main() { // create a JSON value with different types json json_types = { {"boolean", true}, { "number", { {"integer", 42}, {"floating-point", 17.23} } }, {"string", "Hello, w...
negative_train_query0_00238
doc/examples/json_pointer__to_string.cpp/main int main() { // different JSON Pointers json::json_pointer ptr1(""); json::json_pointer ptr2("/foo"); json::json_pointer ptr3("/foo/0"); json::json_pointer ptr4("/"); json::json_pointer ptr5("/a~1b"); json::json_pointer ptr6("/c%d"); json::js...
negative_train_query0_00239
doc/examples/at__size_type_const.cpp/main int main() { // create JSON array const json array = {"first", "2nd", "third", "fourth"}; // output element at index 2 (third element) std::cout << array.at(2) << '\n'; // exception type_error.304 try { // use at() on a non-array type ...
negative_train_query0_00240
doc/examples/get_ptr.cpp/main int main() { // create a JSON number json value = 17; // explicitly getting pointers auto p1 = value.get_ptr<const json::number_integer_t*>(); auto p2 = value.get_ptr<json::number_integer_t*>(); auto p3 = value.get_ptr<json::number_integer_t* const>(); auto p4 ...
negative_train_query0_00241
doc/examples/is_null.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_unsigned_integer = 12345678987654321u; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 16}; ...
negative_train_query0_00242
doc/examples/cend.cpp/main int main() { // create an array value json array = {1, 2, 3, 4, 5}; // get an iterator to one past the last element json::const_iterator it = array.cend(); // decrement the iterator to point to the last element --it; // serialize the element that the iterator po...
negative_train_query0_00243
doc/examples/basic_json__basic_json.cpp/main int main() { // create a JSON array json j1 = {"one", "two", 3, 4.5, false}; // create a copy json j2(j1); // serialize the JSON array std::cout << j1 << " = " << j2 << '\n'; std::cout << std::boolalpha << (j1 == j2) << '\n'; }
negative_train_query0_00244
doc/examples/is_structured.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_float = 23.42; json j_number_unsigned_integer = 12345678987654321u; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 1...
negative_train_query0_00245
doc/examples/array.cpp/main int main() { // create JSON arrays json j_no_init_list = json::array(); json j_empty_init_list = json::array({}); json j_nonempty_init_list = json::array({1, 2, 3, 4}); json j_list_of_pairs = json::array({ {"one", 1}, {"two", 2} }); // serialize the JSON arrays s...
negative_train_query0_00246
doc/examples/at__size_type.cpp/main int main() { // create JSON array json array = {"first", "2nd", "third", "fourth"}; // output element at index 2 (third element) std::cout << array.at(2) << '\n'; // change element at index 1 (second element) to "second" array.at(1) = "second"; // outpu...
negative_train_query0_00247
doc/examples/erase__IteratorType_IteratorType.cpp/main int main() { // create JSON values json j_boolean = true; json j_number_integer = 17; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 16}; json j_string = "Hello, world"; // call er...
negative_train_query0_00248
doc/examples/is_number_float.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = 17; json j_number_unsigned_integer = 12345678987654321u; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8,...
negative_train_query0_00249
doc/examples/operator__value_t.cpp/main int main() { // create JSON values json j_null; json j_boolean = true; json j_number_integer = -17; json j_number_unsigned = 42u; json j_number_float = 23.42; json j_object = {{"one", 1}, {"two", 2}}; json j_array = {1, 2, 4, 8, 16}; json j_str...
negative_train_query0_00250
doc/examples/out_of_range.cpp/main int main() { try { // calling at() for an invalid index json j = {1, 2, 3, 4}; j.at(4) = 10; } catch (json::out_of_range& e) { // output exception information std::cout << "message: " << e.what() << '\n' << ...
negative_train_query0_00251
doc/examples/crbegin.cpp/main int main() { // create an array value json array = {1, 2, 3, 4, 5}; // get an iterator to the reverse-beginning json::const_reverse_iterator it = array.crbegin(); // serialize the element that the iterator points to std::cout << *it << '\n'; }
negative_train_query0_00252
doc/examples/json_pointer__parent_pointer.cpp/main int main() { // different JSON Pointers json::json_pointer ptr1(""); json::json_pointer ptr2("/foo"); json::json_pointer ptr3("/foo/0"); // call parent_pointer() std::cout << std::boolalpha << "parent of " << ptr1 << " is " << ptr...
negative_train_query0_00253
doc/examples/push_back__initializer_list.cpp/main int main() { // create JSON values json object = {{"one", 1}, {"two", 2}}; json null; // print values std::cout << object << '\n'; std::cout << null << '\n'; // add values: object.push_back({"three", 3}); // object is extended obje...
negative_train_query0_00254
doc/examples/json_pointer.cpp/main int main() { // correct JSON pointers json::json_pointer p1; json::json_pointer p2(""); json::json_pointer p3("/"); json::json_pointer p4("//"); json::json_pointer p5("/foo/bar"); json::json_pointer p6("/foo/bar/-"); json::json_pointer p7("/foo/~0"); ...
negative_train_query0_00255
doc/examples/find__key_type.cpp/main int main() { // create a JSON object json j_object = {{"one", 1}, {"two", 2}}; // call find auto it_two = j_object.find("two"); auto it_three = j_object.find("three"); // print values std::cout << std::boolalpha; std::cout << "\"two\" was found: " <...
negative_train_query0_00256
single_include/nlohmann/json.hpp/get_arithmetic_value void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) { switch (static_cast<value_t>(j)) { case value_t::number_unsigned: { val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::numbe...
negative_train_query0_00257
single_include/nlohmann/json.hpp/from_json void from_json(const BasicJsonType& j, ConstructibleObjectType& obj) { if (JSON_HEDLEY_UNLIKELY(not j.is_object())) { JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name()))); } ConstructibleObjectType ret; a...
negative_train_query0_00258
single_include/nlohmann/json.hpp/split static std::vector<std::string> split(const std::string& reference_string) { std::vector<std::string> result; // special case: empty reference string -> no reference tokens if (reference_string.empty()) { return result; ...
negative_train_query0_00259
single_include/nlohmann/json.hpp/begin const_iterator begin() const noexcept { return cbegin(); }
negative_train_query0_00260
single_include/nlohmann/json.hpp/insert iterator insert(const_iterator pos, initializer_list_t ilist) { // insert only works for arrays if (JSON_HEDLEY_UNLIKELY(not is_array())) { JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); ...
negative_train_query0_00261
single_include/nlohmann/json.hpp/swap void swap(string_t& other) { // swap only works for strings if (JSON_HEDLEY_LIKELY(is_string())) { std::swap(*(m_value.string), other); } else { JSON_THROW(type_error::create(310, "cannot use swap() wit...
negative_train_query0_00262
single_include/nlohmann/json.hpp/to_ubjson static void to_ubjson(const basic_json& j, detail::output_adapter<char> o, const bool use_size = false, const bool use_type = false) { binary_writer<char>(o).write_ubjson(j, use_size, use_type); }
negative_train_query0_00263
single_include/nlohmann/json.hpp/JSON_INTERNAL_CATCH ValueType value(const json_pointer& ptr, const ValueType& default_value) const { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) { // if pointer resolves a value, return it or use default value ...
negative_train_query0_00264
single_include/nlohmann/json.hpp/get auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.key()) { return i.key(); }
negative_train_query0_00265
single_include/nlohmann/json.hpp/basic_json basic_json(CompatibleType && val) noexcept(noexcept( JSONSerializer<U>::to_json(std::declval<basic_json_t&>(), std::forward<CompatibleType>(val)))) { JSONSerializer<U>::to_json(*this, std::forward<Comp...
negative_train_query0_00266
single_include/nlohmann/json.hpp/update void update(const_reference j) { // implicitly convert null value to an empty object if (is_null()) { m_type = value_t::object; m_value.object = create<object_t>(); assert_invariant(); } if (JSON...
negative_train_query0_00267
single_include/nlohmann/json.hpp/object JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json object(initializer_list_t init = {}) { return basic_json(init, false, value_t::object); }
negative_train_query0_00268
single_include/nlohmann/json.hpp/front const_reference front() const { return *cbegin(); }
negative_train_query0_00269
single_include/nlohmann/json.hpp/erase void erase(const size_type idx) { // this erase only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) { if (JSON_HEDLEY_UNLIKELY(idx >= size())) { JSON_THROW(out_of_range::create(401, "array index " + std:...
negative_train_query0_00270
single_include/nlohmann/json.hpp/push_back void push_back(const typename object_t::value_type& val) { // push_back only works for null objects or objects if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_object()))) { JSON_THROW(type_error::create(308, "cannot use push_back() with...
negative_train_query0_00271
single_include/nlohmann/json.hpp/accept static bool accept(detail::input_adapter&& i) { return parser(i).accept(true); }
negative_train_query0_00272
single_include/nlohmann/json.hpp/from_json_array_impl void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<0> /*unused*/) { using std::end; ConstructibleArrayType ret; std::transform( j.begin(), j.end(), std::inserter(ret, end(ret)), ...
negative_train_query0_00273
single_include/nlohmann/json.hpp/construct static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept { j.m_type = value_t::boolean; j.m_value = b; j.assert_invariant(); }
negative_train_query0_00274
single_include/nlohmann/json.hpp/to_json void to_json(BasicJsonType& j, const std::valarray<T>& arr) { external_constructor<value_t::array>::construct(j, std::move(arr)); }
negative_train_query0_00275
single_include/nlohmann/json.hpp/unflatten basic_json unflatten() const { return json_pointer::unflatten(*this); }
negative_train_query0_00276
single_include/nlohmann/json.hpp/is_null constexpr bool is_null() const noexcept { return m_type == value_t::null; }
negative_train_query0_00277
single_include/nlohmann/json.hpp/from_ubjson JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json from_ubjson(A1 && a1, A2 && a2, const bool strict = true, const bool allow_exceptions = true) { basic_json result; detail::json_sa...
negative_train_query0_00278
single_include/nlohmann/json.hpp/flatten basic_json flatten() const { basic_json result(value_t::object); json_pointer::flatten("", *this, result); return result; }
negative_train_query0_00279
single_include/nlohmann/json.hpp/is_discarded constexpr bool is_discarded() const noexcept { return m_type == value_t::discarded; }
negative_train_query0_00280
single_include/nlohmann/json.hpp/back const_reference back() const { auto tmp = cend(); --tmp; return *tmp; }
negative_train_query0_00281
single_include/nlohmann/json.hpp/is_string constexpr bool is_string() const noexcept { return m_type == value_t::string; }
negative_train_query0_00282
single_include/nlohmann/json.hpp/JSON_CATCH JSON_CATCH (std::out_of_range&) { // create better exception explanation JSON_THROW(out_of_range::create(403, "key '" + key + "' not found")); }
negative_train_query0_00283
single_include/nlohmann/json.hpp/to_msgpack static void to_msgpack(const basic_json& j, detail::output_adapter<uint8_t> o) { binary_writer<uint8_t>(o).write_msgpack(j); }
negative_train_query0_00284
single_include/nlohmann/json.hpp/replace_substring static void replace_substring(std::string& s, const std::string& f, const std::string& t) { assert(not f.empty()); for (auto pos = s.find(f); // find first occurrence of f pos != s...
negative_train_query0_00285
single_include/nlohmann/json.hpp/parse static basic_json parse(IteratorType first, IteratorType last, const parser_callback_t cb = nullptr, const bool allow_exceptions = true) { basic_json result; parser(detail::input_adapter(first, last), ...
negative_train_query0_00286
single_include/nlohmann/json.hpp/compute_boundaries boundaries compute_boundaries(FloatType value) { assert(std::isfinite(value)); assert(value > 0); // Convert the IEEE representation into a diyfp. // // If v is denormal: // value = 0.F * 2^(1 - bias) = ( F) * 2^(1 - bias - (p-1)...
negative_train_query0_00287
single_include/nlohmann/json.hpp/patch basic_json patch(const basic_json& json_patch) const { // make a working copy to apply the patch to basic_json result = *this; // the valid JSON Patch operations enum class patch_operations {add, remove, replace, move, copy, test, invalid};...
negative_train_query0_00288
single_include/nlohmann/json.hpp/crend const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
negative_train_query0_00289
single_include/nlohmann/json.hpp/emplace_back reference emplace_back(Args&& ... args) { // emplace_back only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array()))) { JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::...
negative_train_query0_00290
single_include/nlohmann/json.hpp/to_bson static void to_bson(const basic_json& j, detail::output_adapter<uint8_t> o) { binary_writer<uint8_t>(o).write_bson(j); }
negative_train_query0_00291
single_include/nlohmann/json.hpp/at reference at(const json_pointer& ptr) { return ptr.get_checked(this); }
negative_train_query0_00292
single_include/nlohmann/json.hpp/value ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) { // if key is found, return value and given default value otherwise ...
negative_train_query0_00293
single_include/nlohmann/json.hpp/from_msgpack JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json from_msgpack(detail::input_adapter&& i, const bool strict = true, const bool allow_exceptions = true) { basic_json result; deta...
negative_train_query0_00294
single_include/nlohmann/json.hpp/from_bson JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json from_bson(A1 && a1, A2 && a2, const bool strict = true, const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_pa...
negative_train_query0_00295
single_include/nlohmann/json.hpp/is_number_float constexpr bool is_number_float() const noexcept { return m_type == value_t::number_float; }
negative_train_query0_00296
single_include/nlohmann/json.hpp/reinterpret_bits Target reinterpret_bits(const Source source) { static_assert(sizeof(Target) == sizeof(Source), "size mismatch"); Target target; std::memcpy(&target, &source, sizeof(Source)); return target; }
negative_train_query0_00297