vector iterator in for loop gets compile error C2679

I'm fairly new to the STL, so I may be missing something obvious.

I'm getting error C2679 on a for loop that uses an iterator for a vector that uses a pointer type. I use a similar for loop just above this one, which compiles fine. Here's a partial listing of the function:

bool DEVGRP::ConnectToAudioServer( const CDMAudioServerInfo* pInfo )
{
...
std::vector<LPVOID>::iterator iterate;
DA56RpcClient* pClient;
std::vector<CDMAudioDeviceInfo*>::iterator devices;
CDMAudioDeviceInfo* p_device;

...

//
for( iterate = m_AS.begin(); iterate != m_AS.end();
iterate++ ) {

pClient = (DA56RpcClient*)*iterate;
...
}
...
for ( devices = pInfo->audio_card_list_.begin();
devices != pInfo->audio_card_list_.end();
devices++ ) {

p_device = *devices;
...
}

The second for loop is drawing the compiler error. The first vector (for the m_AS structure), had to be defined as an LPVOID, because the code is running in a MFC Extension DLL which is called by a Win32 app. (don't ask!) The '
CDMAudioDeviceInfo' is a structure, not a class, but a pointer should pretty much be a pointer. The only real difference I see between the for loops is the fact that the code has to point to the second vector...

Is there something obvious I missing, or what







Answer this question

vector iterator in for loop gets compile error C2679

  • PaulFila

    std::vector<CDMAudioDeviceInfo*>::const_iterator

    Kuphryn


  • vector iterator in for loop gets compile error C2679