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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:21:07+00:00 2026-05-27T13:21:07+00:00

std::vector<std::string>::iterator it; it = NULL; do { if(it == NULL) it = init.begin(); else

  • 0
std::vector<std::string>::iterator it;

it = NULL;
do
{
    if(it == NULL)
        it = init.begin();
    else
        ++it;
    if(it == init.end())
        return 1; 
}
while(it->empty());

The above piece of code works fine with VS2003, but when it is migrated to VS2010, it is giving compilation error saying

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'int' (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<std::string,std::allocator<std::string>>
1>          ]
1>          while trying to match the argument list '(std::_Vector_iterator<_Myvec>, int)'
1>          with
1>          [
1>              _Myvec=std::_Vector_val<std::string,std::allocator<std::string>>
1>          ]
1>d:\vs2010_ws\acct ford 6.2.4 source code\acct_ford_ws\vector\src\driver\cancardxl.cpp(81): error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::_Vector_iterator<_Myvec>' (or there is no acceptable conversion)
1>          with
1>          [
1>              _Myvec=std::_Vector_val<std::string,std::allocator<std::string>>
1>          ]
  • 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-27T13:21:08+00:00Added an answer on May 27, 2026 at 1:21 pm

    You were assuming that a vector iterator could be initialized and assigned from an int (or some form of pointer?). That’s not the case.

    You can transform your loop to something like:

    if (init.empty())
      return 1;
    
    it = init.begin();
    while (it->empty())
    {
      ++it;
      if (it == init.end())
        return 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a code like this.... std::vector<string>::iterator p; p = find(v.begin(),v.end(),asdasda); cout << *p
std::vector<string> names; std::vector<string>::iterator start = names.begin(); std::vector<string>::iterator end = names.end(); sort (start,end); //are my
for (std::vector<const std::string>::const_iterator it = serverList.begin(); it != serverList.end(); it++) { // found a
I'm trying to get CMtoaPlugin::listArnoldNodes() to return an array of strings std::vector<std::string> ArnoldNodes =
vector<string> MyStrings; vector<string>::iterator ItStr; I'm using c_str() to return the pointer to the string.
g++ doesn't like: vector<int> x; x += 1,2,3,4,5; vector<string> y(x.size()); transform(x.begin(), x.end(), y.begin(), lexical_cast<string>);
While iterating through a std::map or std::vector or any container which has iterator in
I got a strange problem while used luabind to return a stl::vector::iterator to lua
I have a std::vector<std::string> m_vPaths; I iterate over this vector and call ::DeleteFile(strPath) as
With a vector defined as std::vector<std::string> , Wondering why the following is valid: if

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.