Hmm, well, in this case:
Code:
struct bunchOfParams
{
//lots of other stuff
#ifdef CHARSTAR
char* promptString;
#else
std::string promptString;
#endif
};
void function2(const char* str)
{
//do stuff with str
}
void function(bunchOfParams bop)
{
#ifdef CHARSTAR
function2(bop.promptString);
#else
function2(bop.promptString.c_str());
#endif
}
int main()
{
bunchOfParams bop;
memset(&bop,0,sizeof(bop));
bop.promptString = "This is the prompt.";
function(bop);
return 0;
}
In this case, would the string or char* be faster? This is a lot closer to the actual situation in my program, and I thought the char* would be faster although I used a std::string just for the heck of it.