i am testing std::move with this simple example
but when i tried to compile this code, the error occur
#include <utility> // std::move
#include <iostream> // std::cout
#include <vector> // std::vector
#include <string> // std::string
int main () {
std::string foo = "foo-string";
std::string bar = "bar-string";
std::vector<std::string> myvector;
myvector.push_back (foo); // copies
myvector.push_back (std::move(bar)); // moves
std::cout << "myvector contains:";
for (std::string& x:myvector) std::cout << ' ' << x;
std::cout << '\n';
return 0;
}
but the console window in eclipse seems to say that compile is successful like below
So i tried to compile with console command and not eclipse to check what is correct
g++ -D__GXX_EXPERIMENTAL_CXX0X__ -std=c++11 test.cpp
that was successful and working.
what is problem with eclipse?
i am using eclipse version 3.8