问题描述
有没有办法找到引用的地址?
Is there any way to find the address of a reference?
使其更具体:变量本身的地址,而不是初始化它的变量的地址.
Making it more specific: The address of the variable itself and not the address of the variable it is initialized with.
推荐答案
参考文献没有自己的地址.虽然引用可以实现为指针,但没有必要或保证这一点.
References don't have their own addresses. Although references may be implemented as pointers, there is no need or guarantee of this.
C++ FAQ 说得最好:
与指针不同,一旦引用被绑定到一个对象,它不能重置"到另一个对象.这引用本身不是一个对象(它没有身份;取地址一个参考给你的地址指称者;记住:参考是它的参照物).
Unlike a pointer, once a reference is bound to an object, it can not be "reseated" to another object. The reference itself isn't an object (it has no identity; taking the address of a reference gives you the address of the referent; remember: the reference is its referent).
另请在此处查看我的回答以获取综合列表引用与指针有何不同.
Please also see my answer here for a comprehensive list of how references differ from pointers.
引用是其所指
这篇关于有没有办法找到引用的地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)