20 int_to_str_table.clear();
21 str_to_str_table.clear();
23 int_to_str_table.insert_or_assign(100,
"hundred");
24 str_to_str_table.insert_or_assign(
"a",
"b");
26# if __cplusplus >= 201703L
27 auto val1 = int_to_str_table.find(100);
28 auto val2 = str_to_str_table.find(
"a");
30 std::cout <<
"kv_table1[100]: " << *val1 << std::endl;
32 std::cout <<
"kv_table1[100]: not found" << std::endl;
35 std::cout <<
"kv_table2[\"a\"]: " << *val2 << std::endl;
37 std::cout <<
"kv_table2[\"a\"]: not found" << std::endl;
39 auto val1 = int_to_str_table.find_compat(100);
40 auto val2 = str_to_str_table.find_compat(
"a");
42 std::cout <<
"kv_table1[100]: " << val1.second << std::endl;
44 std::cout <<
"kv_table1[100]: not found" << std::endl;
47 std::cout <<
"kv_table2[\"a\"]: " << val2.second << std::endl;
49 std::cout <<
"kv_table2[\"a\"]: not found" << std::endl;
Declaration of the KeyValueTable class for managing key-value pairs in an MDBX database.
Parameters used by Connection to create the MDBX environment.
std::string pathname
Path to the database file or directory containing the database.
int64_t max_dbs
Maximum number of named databases (DBI) in the environment.
static std::shared_ptr< Connection > create(const Config &config)
Creates and connects a new shared Connection instance.
Template class for managing key-value pairs in an MDBX database.
int main()
Basic example using Config to initialize a table.