gpt4 book ai didi

c++ - 点运算符对效率的影响有多大?

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

<分区>

使用点运算符访问某些数据的速度成本是多少?例如:

struct A{
public:
A(): a(0){};
int a;
};

int main(){
A obj;
int b = 0;

cout << obj.a; // How much slower is this
cout << b; // Than this...?

return 0;
}

我知道我应该进行基准测试,但这里有任何普遍的理解吗?

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