...
This commit is contained in:
@@ -131,7 +131,11 @@ int main()
|
||||
std::println("\n{:*^80}", " hmap with custom conv funcs ");
|
||||
|
||||
hmap.pushWithCnv(
|
||||
"str_cst", std::string{"ABC"}, [&s](std::string const& v) { return s.c_str(); },
|
||||
"str_cst", std::string{"ABC"},
|
||||
[&s](std::string const& v) {
|
||||
return v.c_str();
|
||||
// return s.c_str();
|
||||
},
|
||||
[&s](const char* p) {
|
||||
s = p;
|
||||
return s;
|
||||
@@ -152,6 +156,10 @@ int main()
|
||||
std::println("cannot set 'str_cst'");
|
||||
} else {
|
||||
std::println("s = {}", s);
|
||||
auto rs = hmap.get<std::string>("str_cst");
|
||||
if (rs) {
|
||||
std::println("s = {} (inner)", rs.value());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user