22 table.insert_or_assign(10,
"ten");
23 table.insert_or_assign(20,
"twenty");
29 std::cout <<
"Key 20 (operator[]): " <<
static_cast<std::string
>(table[20]) << std::endl;
33 std::cout <<
"Key 30 (at): " << table.at(30) << std::endl;
34 }
catch (
const std::out_of_range&) {
35 std::cout <<
"Key 30 not found" << std::endl;
38# if __cplusplus >= 201703L
39 auto result = table.find(10);
40 std::cout <<
"Key 10 (find): " << result.value_or(
"not found") << std::endl;
42 auto result = table.find_compat(10);
44 std::cout <<
"Key 10 (find): " << result.second << std::endl;
46 std::cout <<
"Key 10 (find): not found" << std::endl;
52 std::cin.ignore(std::numeric_limits<std::streamsize>::max(),
'\n');
Declaration of the KeyValueTable class for managing key-value pairs in an MDBX database.
int main()
Entry point demonstrating AnyValueTable.
Parameters used by Connection to create the MDBX environment.
std::string pathname
Path to the database file or directory containing the database.
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.
@ WRITABLE
Writable transaction (allows inserts, updates, deletes).