Are C++ compilers able to apply RVO for virtual functions?
In this case:
class AbstractReader
{
//...
public:
virtual std::vector<float> getFloatVector() = 0;
//...
}
class XmlReader : public AbstractReader
{
//...
public:
virtual std::vector<float> getFloatVector()
{
std::vector<float> result;
//Do some parsing here...
return result;
}
//...
}
class BinaryReader : public AbstractReader
{
//...
public:
virtual std::vector<float> getFloatVector()
{
std::vector<float> result;
//Do some decoding here...
return result;
}
//...
}
Can RVO apply to return result;
lines? I would guess not.
Then, is std::move(result)
the way to go for returning large containers in that case?
Thanks