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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:41:41+00:00 2026-06-09T07:41:41+00:00

I tried to compile this code: #include <boost/range/adaptors.hpp> #include <boost/range/algorithm.hpp> #include <vector> int main()

  • 0

I tried to compile this code:

#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <vector>

int main() {
    std::vector<int> v{
        1,5,4,2,8,5,3,7,9
    };
    std::cout << *boost::min_element(v | boost::adaptors::transformed(
            [](int i) { return -i; })) << std::endl;
    return 0;
}

The compilation failed with the following error message (after a long template instantiation novel):

/usr/local/include/boost/iterator/transform_iterator.hpp:84:26: error: use of deleted function ‘main()::<lambda(int)>::<lambda>()’
../main.cpp:12:5: error: a lambda closure type has a deleted default constructor

I googled the problem, and found this in the Boost Users mailing list archive. It suggested that using #define BOOST_RESULT_OF_USE_DECLTYPE would solve the problem. I put it into the very beginning of my code, but it still doesn’t compile. The length of the error message seems to be much shorter, but the error message at the end is the same. I’m currently using Boost 1.50.

What can be the problem here? Is there any way to make this work?

  • 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-09T07:41:43+00:00Added an answer on June 9, 2026 at 7:41 am

    http://smellegantcode.wordpress.com/2011/10/31/linq-to-c-or-something-much-better/

    But you can use this, that works well.

    #include <boost/range/adaptors.hpp>
    #include <boost/range/algorithm.hpp>
    #include <vector>
    #include <functional>
    
    int main() {
        std::vector<int> v{
            1,5,4,2,8,5,3,7,9
        };
        std::function<int(int)> func = [](int i) { return -i; };
        std::cout << *boost::min_element(v | boost::adaptors::transformed(
        func)) << std::endl;
        return 0;
    }
    

    http://liveworkspace.org/code/b78b3f7d05049515ac207e0c12054c70

    #define BOOST_RESULT_OF_USE_DECLTYPE works fine in VS2012 for example.

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

Sidebar

Related Questions

I tried to compile this example: #include <stdio.h> #include <stdlib.h> #include <stddef.h> main(){ size_t
I have this simple code #include <stdio.h> #include <OpenGL/glext.h> #include <OpenGL/gl.h> int main (int
I tried the following code: #include <iostream> using std::cout; using std::ostream; class X {
I tried to compile Ercia Sadun's sample code here , but this error came
I tried following code : #include<iostream> #include<string> using namespace std; string f1(string s) {
My question is related to this thread. Here is the code #include <stdio.h> int
The following code: #include <boost/variant.hpp> #include <iostream> #include <string> struct A { A() {
I'm having trouble compiling the following code: #include <iostream> #include <string> #include <boost/regex.hpp> using
I've been looking at C++0x threads and have this code: #include <vector> #include <iostream>
This very simple code gives me tons of errors: #include <iostream> #include <string> int

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.