2

in Visual Studio (2015, Community Edition)

the code:

std::vector<double>& vec = std::vector<double>();

compiles and runs fine in Visual Studio but does not compile in MinGW and Cygwin. (rvalue/lvalue type mismatch)

I have two questions:

1) Why would MS team enables this atypical reference usage in C++?

2) Is there anyway to ensure that MSVS only compiles for the C++ Std library? (I would like my code to be portable to other compilers (and avoid learning bad habits))

sepp2k
  • 363,768
  • 54
  • 674
  • 675

0 Answers0