Lines Matching refs:std
56 struct foo_serializer<T, typename std::enable_if<std::is_same<foo, T>::value>::type>
71 struct foo_serializer < T, typename std::enable_if < !std::is_same<foo, T>::value >::type >
86 using foo_json = nlohmann::basic_json<std::map, std::vector, std::string, bool, std::int64_t,
87 std::uint64_t, double, std::allocator, ns::foo_serializer, std::vector<std::uint8_t>>;
149 CHECK(std::isnan(f1));
154 CHECK(std::isnan(f2));
162 CHECK(!std::isfinite(f1));
167 CHECK(!std::isfinite(f2));
186 static_assert(std::is_same<decltype(anon_enum_value), decltype(u)>::value, "types must be the same");
198 fields["one"] = std::string("one");
199 fields["two"] = std::string("two three");
200 fields["three"] = std::string("three \"four\"");
203 std::string payload = fields.dump();
212 CHECK(parsed_fields["one"] == std::string("one"));
213 CHECK(parsed_fields["two"] == std::string("two three"));
214 CHECK(parsed_fields["three"] == std::string("three \"four\""));
235 std::stringstream ss;
240 auto test = j["Test"].get<std::string>();
252 nlohmann::basic_json<std::map, std::vector, std::string, bool, int32_t, uint32_t, float>;
300 std::transform(rit, a.rend(), b.rbegin(), [](json el)
309 std::transform(++a.rbegin(), a.rend(), b.rbegin(), [](json el)
326 std::stringstream ss;
344 std::string bytes{"\x00" "asdf\n", 6};
355 std::string bytes{0x7, 0x7};
362 SECTION("issue #144 - implicit assignment to std::string fails")
366 std::string s1 = o["name"];
369 std::string s2;
468 nlohmann::basic_json<std::map, std::vector, std::string, bool, int32_t, uint32_t, float> j_float =
473 nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t, uint64_t, double> j_double =
478 nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t, uint64_t, long double>
497 class CommaDecimalSeparator : public std::numpunct<char>
510 std::string do_grouping() const override
517 auto orig_locale = std::locale::global(std::locale(std::locale(), new CommaDecimalSeparator));
523 std::stringstream ss;
524 ss.imbue(std::locale(std::locale(), new CommaDecimalSeparator));
542 std::locale::global(orig_locale);
566 SECTION("issue #233 - Can't use basic_json::iterator as a base iterator for std::move_iterator")
572 std::copy_n(std::make_move_iterator(source.begin()), 2, std::back_inserter(dest));
627 std::ifstream f(filename);
644 std::ifstream f(filename);
671 std::stringstream ss;
680 check_roundtrip((std::numeric_limits<json::number_float_t>::max)());
722 std::ifstream f("file_not_found.json");
729 std::stringstream ss;
745 std::stringstream ss;
752 std::stringstream ss;
761 std::stringstream ss;
772 std::stringstream ss;
784 std::stringstream ss;
795 std::stringstream ss;
810 std::stringstream ss;
827 std::stringstream ss;
840 std::string str = "{\n\"one\" : 1,\n\"two\" : 2\n}\n{\n\"three\" : 3\n}";
843 std::ofstream file("test.json");
847 std::ifstream stream("test.json", std::ifstream::in);
871 static_cast<void>(std::remove("test.json"));
902 std::vector<uint8_t> vec {0x65, 0xf5, 0x0a, 0x48, 0x21};
912 std::vector<uint8_t> vec1 {0xcb, 0x8f, 0x0a};
916 std::vector<uint8_t> vec2 {0xca, 0x8f, 0x0a};
920 std::vector<uint8_t> vec3 {0xf9, 0x8f};
924 std::vector<uint8_t> vec4 {0xfa, 0x8f, 0x0a};
928 std::vector<uint8_t> vec5 {0xfb, 0x8f, 0x0a};
937 std::vector<uint8_t> vec1 {0x87};
949 std::vector<uint8_t> vec(1, static_cast<uint8_t>(b));
964 std::vector<uint8_t> vec(1, static_cast<uint8_t>(b));
969 std::vector<uint8_t> vec2;
979 std::vector<uint8_t> vec1 {0x7f};
983 std::vector<uint8_t> vec2 {0x9f};
987 std::vector<uint8_t> vec3 {0xbf};
994 std::vector<uint8_t> vec
1019 std::vector<uint8_t> vec1 {0x7f, 0x61, 0x61};
1023 std::vector<uint8_t> vec2 {0x9f, 0x01};
1027 std::vector<uint8_t> vec3 {0xbf, 0x61, 0x61, 0x01};
1052 std::vector<uint8_t> vec1
1066 std::vector<uint8_t> vec2
1080 std::vector<uint8_t> vec = {'-', '0', '1', '2', '2', '7', '4'};
1092 SECTION("issue #464 - VS2017 implicit to std::string conversion fix")
1095 std::string test;
1104 std::string s1 = j1.dump();
1106 std::string s2 = j2.dump();
1117 SECTION("std::vector")
1121 std::vector<int> v = j;
1129 SECTION("std::list")
1133 std::list<int> v = j;
1141 SECTION("std::forward_list")
1145 std::forward_list<int> v = j;
1158 std::map<json::value_t, std::string> jsonTypes ;
1164 std::vector<bool> boolVector = {false, true, false, false};
1173 std::vector<uint8_t> vec1 = {0xf9, 0xff, 0xff, 0x4a, 0x3a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x37, 0x02, 0x38};
1177 std::vector<uint8_t> vec2 = json::to_cbor(j1);
1184 CHECK(std::isnan(j2.get<json::number_float_t>()));
1229 std::vector<uint8_t> vec = {'"', '\\', '"', 'X', '"', '"'};
1234 SECTION("issue #600 - how does one convert a map in Json back to std::map?")
1239 std::map<std::string, int> m1 {{"key", 1}};
1245 std::map<std::string, int> m2 = j;
1254 std::map<std::string, std::string> m1 {{"key", "val"}};
1260 std::map<std::string, std::string> m2 = j;
1270 std::string i = "\xef\xbb\xbf{\n \"foo\": true\n}";
1280 std::valarray<double> v;
1287 std::valarray<double> v = {1.2, 2.3, 3.4, 4.5};
1289 std::valarray<double> vj = j;
1299 CHECK_THROWS_WITH_AS(json().get<std::valarray<double>>(), "[json.exception.type_error.302] type must be array, but is null", json::type_error&);
1308 std::istringstream i1_2_3( R"({"first": "one" }{"second": "two"}3)" );
1316 auto m1 = j1.get<std::map<std::string, std::string>>();
1317 auto m2 = j2.get<std::map<std::string, std::string>>();
1320 CHECK( m1 == ( std::map<std::string, std::string> {{ "first", "one" }} ));
1321 CHECK( m2 == ( std::map<std::string, std::string> {{ "second", "two" }} ));
1326 SECTION("issue #714 - throw std::ios_base::failure exception when failbit set to true")
1329 std::ifstream is;
1332 | std::ios_base::failbit
1333 | std::ios_base::badbit
1342 std::ifstream is;
1345 | std::ios_base::failbit
1346 | std::ios_base::badbit
1350 std::ios_base::in | std::ios_base::binary);
1356 SECTION("issue #805 - copy constructor is used with std::initializer_list constructor.")
1366 std::array<uint8_t, 28> key1 = {{ 103, 92, 117, 48, 48, 48, 55, 92, 114, 215, 126, 214, 95, 92, 34, 174, 40, 71, 38, 174, 40, 71, 38, 223, 134, 247, 127, 0 }};
1367 std::string key1_str(reinterpret_cast<char*>(key1.data()));
1376 std::array<int, 4> ar = {{1, 1, 1, 1}};
1408 std::vector<uint8_t> v_cbor =
1424 std::vector<uint8_t> v_ubjson = {'[', '$', 'Z', '#', 'L', 0x78, 0x28, 0x00, 0x68, 0x28, 0x69, 0x69, 0x17};
1490 std::stringstream s("{}{}");