Hi,
I have a old C++ project which is building successfully with vs2008, but when i migrate it to VS2010 it is giving below error
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\vector(609): error C2593: 'operator !=' is ambiguous
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xmemory(268): could be 'bool std::operator !=<_Ty,_Ty>(const std::allocator<_Ty> &,const std::allocator<_Ty> &) throw()'
1> with
1> [
1> _Ty=USER_AREA_RIGHTS
1> ]
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(417): or 'bool std::rel_ops::operator !=<std::allocator<_Ty>>(const std::allocator<_Ty> &,const std::allocator<_Ty>&)' [found using argument-dependent lookup]
1> with
1> [
1> _Ty=USER_AREA_RIGHTS
1> ]
1> while trying to match the argument list '(std::allocator<_Ty>, std::allocator<_Ty>)'
1> with
1> [
1> _Ty=USER_AREA_RIGHTS
1> ]
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\vector(606) : while compiling class template member function 'void std::vector<_Ty>::_Assign_rv(std::vector<_Ty> &&)'
1> with
1> [
1> _Ty=USER_AREA_RIGHTS
1> ]
1> OPCServer.cpp(2161) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1> with
1> [
1> _Ty=USER_AREA_RIGHTS
1> ]
below is the code
struct USER_AREA_RIGHTS {
WCHAR
szArea[PDS_PROCESS_AREA_NAME_LEN];
DWORDdwAccessRights;
};
typedef vector< USER_AREA_RIGHTS > USER_AREAS_RIGHTS_VEC;
typedef map< wstring, USER_AREAS_RIGHTS_VEC, less<wstring> > USER_DOMAIN_RIGHTS_MAP;
USER_AREA_RIGHTS UserRights;
for (DWORD n = 0; n < dwCnt;n++) {
memset(&UserRights,0,sizeof(USER_AREA_RIGHTS));
UserRights.dwAccessRights = *(pAccessMasks + n);
wcsncpy(UserRights.szArea,CharUpperW(*(pAreas + n)),
min(sizeof(UserRights.szArea)/2,wcslen(*(pAreas + n))));
UserRightsVec.push_back(UserRights);
CoTaskMemFree(*(pAreas + n));
}
m_UserRightsMapNew.insert(pair<wstring,USER_AREAS_RIGHTS_VEC >(CharUpperW((LPWSTR)(*it).c_str()),UserRightsVec));
if i comment below line it is building successfully.
m_UserRightsMapNew.insert(pair<wstring,USER_AREAS_RIGHTS_VEC >(CharUpperW((LPWSTR)(*it).c_str()),UserRightsVec));