Enable RVO for any other than old GCCs like 4.8

This commit is contained in:
Abdullah Tahiri
2019-04-01 13:26:18 +02:00
committed by wmayer
parent 614a031814
commit 9fb2606c88

View File

@@ -81,7 +81,11 @@ std::unique_ptr<Part::GeometryExtension> GeometryDefaultExtension<T>::copy(void)
cpy->value = this->value;
cpy->setName(this->getName());
return std::move(cpy);
#if defined(__GNUC__) && __GNUC__ < 7
return std::move(cpy); // GCC 4.8 bug
#else
return cpy; // all the others use RVO optimization perfectly fine.
#endif
// Advise from Scott Meyers Effective Modern c++:
//
// Don't std::move(cpy); RVO optimization Item 25, if the compiler fails to elide, would have to move it anyway