mercredi 1 février 2017

Compilation error with auto when comapring and declaring inline

I have just started using auto and surely I do not understand everything about it.

Why is it that I do not get a compilation error when I do this

auto search = m_pending.find(p_uid); if(search != m_pending.end()) but get an error when I try to achieve the same using

if(auto search = m_pending.find(p_uid) != m_pending.end())

g++ -std=c++0x common/NpTestMgr.cpp common/NpBaseTest.cpp components/cavium/CavTest.cpp common/NpTestMgr.cpp: In member function 'std::pair NpTestMgr::find(const NpTestMgr::UID&) const': common/NpTestMgr.cpp:51: error: invalid type argument of 'unary *'

Aucun commentaire:

Enregistrer un commentaire