passing string literal to std::map::find(..)
- by ra170
I've got a std::map.
I'm passing string literal to find method. Obviously, I can pass a string literal such as
.find("blah");
However, I wanted to declare it upfront, instead of hardcoding the string, so I have couple of choices now:
const std::string mystring = "blah";
const char mystring[] = "blah";
static const char * mystring = "blah";
They all work. (or at least compile). My question is, which one should I use? what's the advantage/distavantage over of the other?