【发布时间】:2014-08-12 06:27:21
【问题描述】:
我怎样才能使下面的代码工作?
for (auto f=face.begin(); f!=face.end(); ++f)
{
if (std::addressof(*f) == 0x18b9160) // error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
{
cout << "found";
}
}
【问题讨论】:
-
比较有什么用(假设你可以编译)?
-
@Praetorian:这是调试我的代码所必需的。
-
然后只需使用演员表:
if ((void*)std::addressof(*f) == (void*)0x18b9160)
标签: c++ c++11 reference comparison hex