C
ctgqumgf
Compiling the code below with g++ 4.7.0 produces expected
output
[&] Hello!
[&&] Hello!
Whereas MSVC 16.00.x produces output
[&] Hello!
[&] Hello!
Does MSVC not fully understand r-value references yet?
#include <iostream>
#include <string>
void print(const std::string& s) {
std::cout << "[&] " << s << std::endl;
}
void print(std::string&& s) {
std::cout << "[&&] " << s << std::endl;
}
int main() {
std::string s = "Hello!";
print(s);
print("Hello!");
}
output
[&] Hello!
[&&] Hello!
Whereas MSVC 16.00.x produces output
[&] Hello!
[&] Hello!
Does MSVC not fully understand r-value references yet?
#include <iostream>
#include <string>
void print(const std::string& s) {
std::cout << "[&] " << s << std::endl;
}
void print(std::string&& s) {
std::cout << "[&&] " << s << std::endl;
}
int main() {
std::string s = "Hello!";
print(s);
print("Hello!");
}