samedi 25 avril 2015

STL SET Iterator assignment no viable candidate


I have a C++ program using an STL Set with an iterator. The set and iterator are defined as:


 set<TokenTableEntry*, Comparator> _XCLITokenTable;

 set<TokenTableEntry*>::const_iterator it;

I have a routine called findToken (shown below), that has a statement: it = _XCLITokenTable.find(_TokenTableEntry);

Which is producing the error message:

"implicit std::_Tree std::less,std::allocator,0> >::const_iterator::operator=(const
std::_Tree,std::allocator,0> >::const_iterator &)" is not a viable candidate.

I have no idea what this message is telling me or how to correct it. Can anyone make a suggestion?

Thanks for any help.

John

int XCLITokenTable::findToken (string name,  TokenTableEntry *_TokenTableEntry) 
{

    int type;
    type = -1;

    string lookupName(name);

    std::transform(name.begin(), name.end(), name.begin(), ::tolower);

    _TokenTableEntry->name = lookupName;

    **it = _XCLITokenTable.find(_TokenTableEntry);**

    if (it != _XCLITokenTable.end())
    {
        if ((*it)->name == name)
        {
            type = (*it)->type;
            tokenCount++;
            *_TokenTableEntry = *(*it);
            return type;
        }

    }
    return type;
}


Aucun commentaire:

Enregistrer un commentaire