获取具有重载操作符和对象的对象的地址。 [英] Get the address of an object that has overloaded operator&

查看:98
本文介绍了获取具有重载操作符和对象的对象的地址。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运算符& CComPtr 重载,这使得我的一般编写的代码崩溃。

operator& for CComPtr is overloaded, which makes my generically written code crash.

我想知道是否有任何方法强制变量返回它的对象的地址。

I am wondering if there is any way to force a variable into returning the address of it's object?

推荐答案

解决方案是可怕的:

reinterpret_cast<CComPtr*>(&reinterpret_cast<char&>(ptr))

这篇关于获取具有重载操作符和对象的对象的地址。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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