none
C2679 error: binary '=' : no operator found which takes a right-hand operand of type

    Question

  • Hello,

     

    When compling VC ++ 6.0 build source on VC++ 2010. Recieved following error.

    And note there is no '=' operator overloading method is defined. Hence I tried to define operator overloading '=' , compiled and noticed the same error.

    CLinkRule.h

    {

    ....

    vector<CLinkRule> CLinkRules;

    ...

    }

    CLinkRuleReader.h

    #include "CLinkRule.h"

    CLinkRules            m_LinkRules;

    ...

    CLinkRuleReader.cpp

     

    void CLinkRuleReader::Check()

    {

    ....

    CLinkRules::iterator    startRule;

    CLinkRules::iterator currentRule = startRule;

    ...

    while (currentRule->getJumpToRuleId() != CLinkRule::JumpToEndId)

    {

    ...

    currentRule =  &(m_LinkRules[currentRule->getJumpToRulePos()]);

    ...

    }

    }

    =========================

    error C2679: binary '=' : no operator found which takes a right-hand operand of type 'bmwDMS::CLinkRule *' (or there is no acceptable conversion)
    1>          C:\Program Files\Microsoft Visual Studio 10.0\VC\include\vector(388): could be 'std::_Vector_iterator<_Myvec> &std::_Vector_iterator<_Myvec>::operator =(const std::_Vector_iterator<_Myvec> &)'
    1>          with
    1>          [
    1>              _Myvec=std::_Vector_val<bmwDMS::CLinkRule,std::allocator<bmwDMS::CLinkRule>>
    1>          ]
    1>          while trying to match the argument list '(std::_Vector_iterator<_Myvec>, bmwDMS::CLinkRule *)'
    1>          with
    1>          [
    1>              _Myvec=std::_Vector_val<bmwDMS::CLinkRule,std::allocator<bmwDMS::CLinkRule>>
    1>          ]
    1>

    =====================

    Thanks,

    Johnson


    • Edited by John_IN Tuesday, June 14, 2011 2:07 PM update
    Tuesday, June 14, 2011 2:03 PM

Answers

  • The error is fixed after adding "currentRule =  m_LinkRules.begin() + currentRule->getJumpToRulePos();"
    • Marked as answer by Rob Pan Monday, June 27, 2011 9:08 AM
    Tuesday, June 21, 2011 9:49 AM

All replies