...
This commit is contained in:
@@ -96,5 +96,24 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
std::println("\n{:*^80}", " delete key ");
|
||||
|
||||
std::println("erase node with key 'int_key'");
|
||||
if (hmap_move.erase("int_key")) {
|
||||
auto ri = hmap_move.get<int>("int_key");
|
||||
if (ri) { // should not be
|
||||
std::println("hmap_move['int_key'] = {}", ri.value());
|
||||
} else {
|
||||
std::println("cannot get value of hmap_move['int_key']");
|
||||
}
|
||||
|
||||
ri = hmap_copy.get<int>("int_key");
|
||||
if (ri) {
|
||||
std::println("hmap_copy['int_key'] = {}", ri.value());
|
||||
} else {
|
||||
std::println("cannot get value of hmap_copy['int_key']");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user