通过“this-> member”访问c ++成员类。比对“成员”的隐式调用更快/更慢。 [英] Is accessing c++ member class through "this->member" faster/slower than implicit call to "member"

查看:121
本文介绍了通过“this-> member”访问c ++成员类。比对“成员”的隐式调用更快/更慢。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的朋友google上进行搜索后,我无法在以下方面获得清晰的视图。

After some searching on our friend google, I could not get a clear view on the following point.

我用来调用类成员 this-> 。即使不需要,我发现它更明确,因为它有助于维护一些重载算法与加载vars。

I'm used to call class members with this->. Even if not needed, I find it more explicit as it helps when maintaining some heavy piece of algorithm with loads of vars.

由于我正在做一个应该优化的算法,我想知道是否使用 this-> 会改变运行时性能。

As I'm working on a supposed-to-be-optimised algorithm, I was wondering whether using this-> would alter runtime performance or not.

是吗?

推荐答案

不,呼叫在两种情况下是完全相同的。

No, the call is exactly the same in both cases.

这篇关于通过“this-> member”访问c ++成员类。比对“成员”的隐式调用更快/更慢。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆