Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8472847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:11:19+00:00 2026-06-10T17:11:19+00:00

I’m sorry but there can’t be an example so we’ll have to take a

  • 0

I’m sorry but there can’t be an example so we’ll have to take a look into the real code here.
What happens is, I have class CItemElem (note this is an old source, please disconsider hungarian notations, class names etc..).
As in the example below I’m trying to do the same with CItemElem

class A
{
public:
    int value;
};

int _tmain( int argc, _TCHAR* argv[] )
{
    std::vector<A> hold;
    A a;
    hold.push_back(a);
}

Althought with class CItemElem the compiler gives me C2679 when trying to

vector<CItemElem>hold;
CItemElem item;
hold.push_back(item);

Error C2679: '=' binary :no operator found which takes a right-hand operand of type 'const CItemElem' (or there is no acceptable conversion)

by clicking at the error it leads me to this line *_First = _Val;
at this function on xutility

template<class _FwdIt,
    class _Ty> inline
    void fill(_FwdIt _First, _FwdIt _Last, const _Ty& _Val)
    {   // copy _Val through [_First, _Last)
    for (; _First != _Last; ++_First)
        *_First = _Val;
    }

The CItemElem class is too long and derived so I decided to upload it to pastebin, instead of pasting the huge code in here.
Pastebin: Class CItemElem Header (item.h)

Note that CItemElem is derived from CItemBase and has = operator overloaded, which also passes throught CItemBase = operator. This is from item.cpp:

CItemElem& CItemElem::operator =( CItemElem & ie )
{
    CItemBase::operator =( ie );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:11:20+00:00Added an answer on June 10, 2026 at 5:11 pm

    It looks as if there is no defined assignment operator (=) for CItemElem. The STL containers (e.g.vector) expect the things they contain to have certain properties, including an assignment operator. If you can modify the class, you can add one:

    class CItemElem
    {
    ...
    public:
    
      CItemElem & operator=(const CItemElem &other)
      {
        // copy whatever must be copied
        x = other.x;
    
        return *this;
      }
    }
    

    EDIT:
    I see now that the header includes a declaration of an assignment operator:

    virtual CItemElem&      operator = ( CItemElem & ie );
    

    but the signature is wrong– it’s missing const. If you can change this (in the declaration and the definition) it should work.

    EDIT:
    If you can’t edit the base class, you have a couple of options. Probably the safest is to copy the code from CItemBase::operator= into CItemElem::operator=. It’s not pretty, but that’s the original author’s fault; the argument should have been const & all along.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.