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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:45:55+00:00 2026-06-07T04:45:55+00:00

Please bear with me if the question is silly. The following are defined in

  • 0

Please bear with me if the question is silly.

The following are defined in a header file :

typedef char NAME_T[40];

struct NAME_MAPPING_T
{
    NAME_T englishName;
    NAME_T frenchName;
};

typedef std::vector<NAME_MAPPING_T> NAMES_DATABASE_T;

Later the need comes that a particular english name be found :

const NAMES_DATABASE_T *wordsDb;

string str;

std::find_if(   wordsDb->begin(), 
                wordsDb->end(), 
                [str](const NAME_MAPPING_T &m) -> bool { return strncmp(m.englishName, str.c_str(), sizeof(m.englishName)) == 0; } );

This code (which I copy-pasted to be honest) compiles, but if I want to check the value returned by find_if(), like this :

NAMES_DATABASE_T::iterator it;
it = std::find_if(blah ..)

the code will NOT compile !

In effect the line
it = std::find_if(…)
will return the error :

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_Vector_const_iterator<_Myvec>' (or there is no acceptable conversion)

What is wrong ?

Thanks for your time.

  • 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-07T04:45:56+00:00Added an answer on June 7, 2026 at 4:45 am

    const NAMES_DATABASE_T *wordsDb;

    Your wordsDb is const, therefore wordsDb->begin() returns a const iterator, therefore find_if returns a const iterator as well. You’re trying to assign that const iterator to the non-const NAMES_DATABASE_T::iterator it, hence the error.

    You can use NAMES_DATABASE_T::const_iterator to get a const iterator. And you should use std::string instead of those char buffers, unless there are some rare circumstances that require otherwise.

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

Sidebar

Related Questions

This is a very basic question, so please bear with me. Consider the following
This is a bit of a silly question, but please bear with me. ;)
Please bear in mind that I'm totally new to Rails when answering this.My question
This is not really a programming question but please bear with me as I
I agree that this question is duplicate. Please bear with me. I was also
This is not a really Programming Question, but please bear with me as it's
I am very new to Perl, so please bear with my simple question: Here
I don't know really how to word the question so please bear with me...
This question is a bit long, please bear with me. In REST, i think
Ok, please bear with my noob question here. I'm doing the simple task of

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.