L
lallous
Hello,
I have:
std::map<std::string, std::string> m;
std::string s1;
char *p = "hello world", *p1 = "value";
(a) s1 = p;
is (a) okay if I later set "p = NULL" ? s1 would have its own copy of the
string now?
(b) m[p] = p1;
Is that okay? will that create a valid entry into the map?
Or should I use: map[s1] = "value"; ?
Btw, can someone tell me about std::string and its reference count issues?
I have:
std::map<std::string, std::string> m;
std::string s1;
char *p = "hello world", *p1 = "value";
(a) s1 = p;
is (a) okay if I later set "p = NULL" ? s1 would have its own copy of the
string now?
(b) m[p] = p1;
Is that okay? will that create a valid entry into the map?
Or should I use: map[s1] = "value"; ?
Btw, can someone tell me about std::string and its reference count issues?