该语句是否复制向量

时间:2019-05-01 08:28:03

标签: c++

我已阅读this question,但看起来有些不同。以下语句是否复制矢量:

bool MyClass::myMethod(const std::vector<Point> *data_) {
    // For some reason, I don't want to work with pointer,
    // but I'm afraid the following statement copies the data unnecessarily
    const std::vector<Point>& data = *data_;
}

我知道,这可能不是最聪明的问题!

0 个答案:

没有答案