gpt4 book ai didi

c++ - 成员访问运算符的 lhs 求值与其参数的副作用之间是否存在先序关系?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:34:25 25 4
gpt4 key购买 nike

<分区>

我已阅读 Order of evalution来自cppreference,但我找不到任何与这种情况有关的规则。这是否意味着没有 sequenced-before 关系或者我错过了什么?谢谢。

下面的代码片段给出了一个例子。

#include <memory>

struct Foo {
void func(std::unique_ptr<Foo>) {}
};

int main() {
auto ptr = std::make_unique<Foo>();
ptr->func(std::move(ptr)); // Is this valid?
return 0;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com