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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:50:24+00:00 2026-05-14T18:50:24+00:00

I am trying to get the below code snippet to compile. But it fails

  • 0

I am trying to get the below code snippet to compile. But it fails with:

error C2665: ‘boost::lambda::function_adaptor::apply’ : none of the 8 overloads could convert all the argument types. Specifying the return type when calling bind does not help.

Any idea what I am doing wrong?

#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <string>
#include <map>

int main()
{

    namespace bl = boost::lambda;
    typedef std::map<int, std::string> types;
    types keys_and_values;
    keys_and_values[ 0 ] = "zero";
    keys_and_values[ 1 ] = "one";
    keys_and_values[ 2 ] = "Two";

    std::for_each(
        keys_and_values.begin(),
        keys_and_values.end(),
        std::cout <<  bl::constant("Value empty?: ") << std::boolalpha <<  
                        bl::bind(&std::string::empty,
                                bl::bind(&types::value_type::second, _1)) << "\n");




    return 0;
}
  • 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-14T18:50:24+00:00Added an answer on May 14, 2026 at 6:50 pm

    minor changes to make it compile with g++ (time for better compiler 🙂 ?)

     1 #include <boost/lambda/lambda.hpp>
     2 #include <boost/lambda/bind.hpp>
     3 #include <algorithm>
     4 #include <iostream>
     5 #include <string>
     6 #include <map>
     7
     8 int main()
     9 {
    10
    11     namespace bl = boost::lambda;
    12     typedef std::map<int, std::string> types;
    13     types keys_and_values;
    14     keys_and_values[ 0 ] = "zero";
    15     keys_and_values[ 1 ] = "one";
    16     keys_and_values[ 2 ] = "Two";
    17
    18     std::for_each(
    19                   keys_and_values.begin(),
    20                   keys_and_values.end(),
    21                   std::cout <<  bl::constant("Value empty?: ") << std::boolalpha <<
    22                   bl::bind(&std::string::empty,
    23                            bl::bind(&types::value_type::second, bl::_1)) << "\n");
    24
    25
    26
    27
    28     return 0;
    29 }
    

    notice missing includes and bl::_1

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

Sidebar

Related Questions

I'm trying to get from Line #1 to Line #2 in the below code:
I'm having some problems trying to get the code below to output the data
I have a C extension (code below) in which I'm trying to get access
The code below is what I am trying to use in order to get
I have the following code snippet.. I get the error Expected identifier, string or
I am trying to implement the code snippet below. However I am unable to
I have the code below: from the getData function im trying to call get_xml
I am trying to get the below linq query to return -1 if there
I'm trying to get the below cURL operation to login on a bangme.net picture
Below is my program and I am trying to get the call stack when

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.