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 7663909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:10:06+00:00 2026-05-31T14:10:06+00:00

Hi can anyone tell me why VS2010 gives me an error with this code,

  • 0

Hi can anyone tell me why VS2010 gives me an error with this code, I can’t see what’s the problem with it?

Error code : error C2679: binary ‘=’ : no operator found which takes a right-hand operand of type ‘std::vector<_Ty>’ (or there is no acceptable conversion)

// Elements container
typedef std::vector<CFVFElementPtr> ElementArray;
typedef std::map<CVertexSemantic::Type, ElementArray> ElementsMap;

// Create an empty array of elements
ElementsMap::value_type::second_type allElements;

// Concatinate each std::vector found within the map
std::transform(m_elementsMap.begin(), m_elementsMap.end(),
std::insert_iterator<ElementArray>(allElements, allElements.end()),
select2nd<ElementsMap::value_type>() );

All I am trying to do is this

for (auto i = m_elementsMap.begin(); i != m_elementsMap.end(); ++i)
{
    const ElementArray& elements = (*i).second;
    allElements.insert(allElements.end(), elements.begin(), elements.end());
}

As a response to Pablo, I tried creating a custom iterator that accepts an array of ElementArray, but I’m now getting a bucket load of errors.

template < class Container >
class container_insert_interator
{
public:
    typedef container_insert_interator<Container> this_type;
    typedef Container container_type;
    typedef typename Container::const_reference const_reference;
    typedef typename Container::value_type valty;

    explicit container_insert_interator (Container& cont, typename   Container::iterator iter) 
            : container(&cont), iter(iter)
    { }

    this_type& operator = (typename const_reference value)
    { 
        iter = container->insert( iter, std::begin(value), std::end(value) );
        ++iter;
        return *this;
    }

    this_type& operator* ()
    { 
       return *this;
    }

    this_type& operator++ ()
    { 
           return *this;
    }

    this_type operator++ (int)
    {
       return *this;
    }

protected:
    Container* container; // pointer to container
    typename Container::iterator iter ; // iterator into container
};
  • 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-05-31T14:10:07+00:00Added an answer on May 31, 2026 at 2:10 pm

    The problem is ElementsMap::value_type::second_type is ElementArray. That is, you’re trying to insert instances of ElementArray into an ElementArray, which really holds instances of CFVFElementPtr.

    Update: Changing your declaration of operator= from

    this_type& operator = (typename const_reference value)
    

    to

    template<typename OtherContainer>
    this_type& operator = ( OtherContainer const& value)
    

    almost works. Except that neither VS 2010 or GCC 4.6.1 provide the vector::insert overload that returns an iterator. You’ll probably need a newer compiler if you want your ranged insert to return an iterator to replace iter.

    Changing the implementation to always insert at the end, namely

    container->insert( container->end(), std::begin(value), std::end(value) );
    

    in operator= compiles fine with GCC 4.6.1 (and, of course, you can remove all references to iter in your iterator class).

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

Sidebar

Related Questions

Can anyone tell me what exactly does this Java code do? SecureRandom random =
Can anyone tell me why this code crashes with SIGABRT unrecognised selector sent to
can anyone tell me why this animation isn't starting? i've tried putting code in
Can anyone tell me what is going wrong with this code? I tried to
Can anyone tell me why this code generates queue after starting the threads? Basically,
Can anyone tell me why this code is returning undefined . I was hoping
Can anyone tell me what I a doing wrong with this code? I am
Can anyone tell me how to open Auto CAD file in HTML5? Is this
can anyone tell me why this doesn't work? db = openOrCreateDatabase(database.db, SQLiteDatabase.CREATE_IF_NECESSARY, null); db.setLocale(Locale.getDefault());
Can anyone tell me how to make connection in webconfig file (which don't require

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.