#include <stdio.h> #include <unordered_map> #include <string> using namespace std; int main(int argc, const char *argv[]) { auto m = new unordered_map<int, string *>(); string *s = (*m)[3]; if (!s) { printf("no string here\n"); s = new string(); (*m)[3] = s; } s->append("foo"); printf("%s\n", s->c_str()); printf("%s\n", (*m)[3]->c_str()); return 0; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15129 | zachwhaley | Add practice directory |