Added flexbuffers reader and writer as well as first test (but does not pass)

This commit is contained in:
Patrick Urbanke
2023-11-11 23:16:49 +01:00
parent c206699f64
commit 5efa9df16e
70 changed files with 754 additions and 18 deletions
+25
View File
@@ -0,0 +1,25 @@
#include <iostream>
#include <memory>
#include <rfl.hpp>
#include <rfl/json.hpp>
#include <string>
#include <unordered_map>
#include "write_and_read.hpp"
void test_string_unordered_map() {
std::cout << "test_string_unordered_map" << std::endl;
using Map = std::unordered_map<std::string, std::unique_ptr<std::string>>;
Map homer;
homer.insert(
std::make_pair("firstName", std::make_unique<std::string>("Homer")));
homer.insert(
std::make_pair("lastName", std::make_unique<std::string>("Simpson")));
// Unordered maps are unpredictable. We therefore only make sure that this
// compiles.
const auto json_string = rfl::json::write(homer);
const auto homer2 = rfl::json::read<Map>(json_string);
std::cout << "OK" << std::endl << std::endl;
}