7static int tutorial_main(
int argc,
char **argv)
19 db.new_city(
"New York");
22 const auto Lille = db.new_city(
"Lille");
23 const auto Amsterdam = db.new_city(
"Amsterdam");
25 db.new_person(
"Rémi",
"Coulom", Lille);
26 db.new_person(
"Bertrand",
"Picard", db.null_city());
28 const auto Aristide = db.new_person(
"Aristide",
"Martines", Amsterdam);
30 db.set_last_name(Aristide,
"Martinez");
35 std::cout <<
"List of cities in alphabetical order:\n";
36 for (
const auto &[name, city]: db.get_index_of_city_by_name())
37 std::cout <<
" " << name <<
'\n';
42 std::cout <<
"\nList of persons with their cities:\n";
43 for (
const auto person: db.get_person_table())
45 std::cout <<
" " << db.get_first_name(person) <<
' ';
46 std::cout << db.get_last_name(person) <<
' ';
47 const auto city = db.get_home(person);
49 std::cout <<
"is homeless\n";
51 std::cout <<
"lives in " << db.get_name(city) <<
'\n';
57 db.delete_city(db.find_city_by_name(
"New York"));
63 db.write_comment(
"The End");
74int main(
int argc,
char **argv)
Shortcut to directly build a Writable_Database from a file name.
@ create_new
fails if already exists, locks the file for writing
int main_exception_catcher(int(*main)(int, char **), int argc, char **argv)
Catch exception from main.