A couple questions about semantics and performance:
x = 0;
While (x < 10) {
std::cout << "Some text here to send to cout";
++x;
}
Im using gcc 4.7, Should the text to stream be wrapped inside of a std::move?
Like this:
x = 0;
While (x < 10) {
std::cout << std::move("Some text here to send to cout");
++x;
}
And while I am asking, is it better in cases like this to just make the string static like:
x = 0;
While (x < 10) {
static const char* s = "Some text here to send to cout";
std::cout << s;
++x;
}
Moving a string literal won’t really do you much good: It will yield a pointer in any case and this pointer will be passed by value. With respect to making the string literal static, I would expect that it make no difference at all.