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

  • Home
  • SEARCH
  • 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 75947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:35:45+00:00 2026-05-10T20:35:45+00:00

I have a vector that I want to insert into a set . This

  • 0

I have a vector that I want to insert into a set. This is one of three different calls (the other two are more complex, involving boost::lambda::if_()), but solving this simple case will help me solve the others.

std::vector<std::string> s_vector; std::set<std::string> s_set; std::for_each(s_vector.begin(), s_vector.end(), s_set.insert(boost::lambda::_1)); 

Unfortunately, this fails with a conversion error message (trying to convert boost::lambda::placeholder1_type to std::string).

So… what’s wrong with this?

  • 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. 2026-05-10T20:35:46+00:00Added an answer on May 10, 2026 at 8:35 pm

    The error is really nasty, but boils down to the fact that it can’t figure out which set::insert to use, since there’s three overloads.

    You can work around the ambiguity by giving bind a helpful hand, by specifying a pointer to the function you wish to use:

    typedef std::set<std::string> s_type; typedef std::pair<s_type::iterator, bool>(s_type::*insert_fp)(const s_type::value_type&); std::for_each(s_vector.begin(), s_vector.end(), boost::bind(static_cast<insert_fp>(&s_type::insert), &s_set, _1)); 

    It’s not pretty, but it should work.

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

Sidebar

Related Questions

I have a set of three vectors: x, y, and z that I want
I have two vector signals with different lenghts in a simulink-model. Now, I want
I have a vector that I want to use to create a heap. I'm
I have a vector X that contains positive numbers that I want to bin/discretize.
I have a vector of beans that holds information I want to display in
I have a Vector receiptOrder and I want to print that receipt to thermal
I have a std::vector. I want to create iterators representing a slice of that
Suppose that I have a vector of key-value pairs that I want to put
I have two vectors in a game. One vector is the player, one vector
I have a vector of type Fruit. I can insert different types of fruits

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.