将std :: addressof()与十六进制数进行比较

时间:2014-06-21 19:36:08

标签: c++ c++11 reference comparison hex

如何使以下代码生效?

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";
    }
}

1 个答案:

答案 0 :(得分:3)

if (std::addressof(*f) == (void*)0x18b9160)