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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:04:13+00:00 2026-06-13T03:04:13+00:00

I tried to call boost::phoenix::function based on lambda function with parameters and failed. If

  • 0

I tried to call boost::phoenix::function based on lambda function with parameters and failed. If I call it without parameters in such a way:

const auto closure = [](){
    cout<< "test" << endl;
};

typedef decltype(closure) ClosureType;
const boost::phoenix::function<ClosureType> lazyFunc (std::move(closure));
lazyFunc()();

all compiles nice. But when I declare at least one parameter of lambda:

const auto  closure = [](int& param)  { cout<<"Test" << param << endl; };

typedef decltype(closure) ClosureType;
const boost::phoenix::function<ClosureType> lazyFunc (std::move(closure));
lazyFunc(arg1)(a);

compilation fails with tremendous stack trace deep inside of boost::result_of

  • 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-13T03:04:15+00:00Added an answer on June 13, 2026 at 3:04 am

    Assuming the error points to somewhere deep inside Boost.ResultOf (as seen in this demo), that would be because the closure type of a lambda expression does not implement the ResultOf protocol.

    A somewhat simple workaround to that is to define BOOST_RESULT_OF_USE_DECLTYPE, which makes boost::result_of bypass its own ResultOf protocol by instead using decltype to compute return types. This is not enabled by default because not many compilers (at the time of the release of Boost 1.51) are conformant enough for this feature to work; it is planned that this symbol be defined automatically (by Boost.Config) for those compilers that can deal with it for 1.52.

    Here is a demo of what it looks like to use Boost.Phoenix with a decltype-powered boost::result_of. I had to change the int& to int const& because i is apparently being forwarded as a const int. This appears to be a fundamental limitation of boost::phoenix::function, using boost::phoenix::val doesn’t have this problem.

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

Sidebar

Related Questions

I am trying to call c# function from javascript the code i have tried
I would like to call JavaScript function many time . I have tried like
I've dug the manual and tried extensivelly to drop the extra function(){...} call after
Using boost::phoenix::function I encountered some problems. As far as I know this lazy function
I've been trying to call the overloaded table::scan_index(std::string, ...) member function without success. For
I want to call member function by passing it as template parameter, without using
I tried to call a .NET web service with KSOAP2 and it throws an
When I tried to call a class called ShowHistory in Java, an error shows:
I want to ask,i tried to call webapp.RequestHandler ,but this handler didn't called: this
I am trying datatables. I successfully tried on ajax call. But now I am

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.