I am developing a cross platform code base where the initial work is done using MS VC2010 compiler.Later I compile it on Linux with GCC (4.7).In many cases I am receiving :
"No matching function for call .." error in GCC.I noticed that it complains mostly when method params are non constant references.For example this:
void MyClass::DoSomeWork(ObjectSP &sprt, const std::string someName, const std::string anotherName, const std::string path, int index) {
sprt->GetProp()->Update(path, false);
}
Once I change the method to this:
void MyClass::DoSomeWork(const ObjectSP& sprt, const std::string& someName, const std::string& anotherName, const std::string& path, int index) {
sprt->GetProp()->Update(path, false);
}
GCC stops complaining. Why does it happen and why does it not happen in VC compilers?