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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:31:19+00:00 2026-06-15T08:31:19+00:00

Im trying to use std::bind to bind this to method that is used in

  • 0

Im trying to use std::bind to bind this to method that is used in QtConcurrent::blockingMapped

Header:

class TuringMachine
{
private:
    TRTable table;
    std::set<ConfigNode*> currentConfigs;

    //function object
    std::function<std::set<ConfigNode*>( const TuringMachine*, ConfigNode*)> step_f;
    //method it will hold
    std::set<ConfigNode *> step(TuringMachine* this_m ,ConfigNode *parent);

    std::set<ConfigNode*>& makeStep();

}

Source:

    TuringMachine::TuringMachine(/**/)  
{

    step_f = std::bind(&TuringMachine::step, this, std::placeholders::_1);
}

std::set<ConfigNode*> &TuringMachine::makeStep(){

    auto configSet = QtConcurrent::blockingMapped<QLinkedList<std::set<ConfigNode*>>>(currentConfigs, step_f);//concurrent execution!

   /**/ 
   return currentConfigs;
}
std::set<ConfigNode*> TuringMachine::step(TuringMachine *this_m, ConfigNode * parent){     //the actual step
  /**/
}

So what Im doing here is running step conncurrently with blockingMapped on each ConfigNode in currentConfigs. Im using std::bind to bind this to step so it only requires one argument, as in the documentation of blockingMapped.

Im getting

error: no match for call to '(std::_Bind<std::_Mem_fn<std::set<ConfigNode*> (TuringMachine::*)(TuringMachine*, ConfigNode*)>(TuringMachine*, std::_Placeholder<1>)>) (const TuringMachine*, ConfigNode*)'
.../Qt/474/gcc/include/QtCore/qtconcurrentmapkernel.h:121: error: no match for call to '(std::function<std::set<ConfigNode*>(const TuringMachine*, ConfigNode*)>) (ConfigNode* const&)'
.../Qt/474/gcc/include/QtCore/qtconcurrentmapkernel.h:136: error: no match for call to '(std::function<std::set<ConfigNode*>(const TuringMachine*, ConfigNode*)>) (ConfigNode* const&)'

And note: 2 arguments expected, 1 provided

Where did I go wrong?

EDIT

Corrected, working version (for future “reference”):

Header:

    //function object
    std::function<std::set<ConfigNode*>( ConfigNode*)> step_f;
    //method it will hold
    std::set<ConfigNode *> step(ConfigNode *parent);

Source:

    TuringMachine::TuringMachine(/**/)  
{
    step_f = std::bind(&TuringMachine::step, this, std::placeholders::_1);
}
  • 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-15T08:31:20+00:00Added an answer on June 15, 2026 at 8:31 am

    If you want to bind a member function, you would have to pass a this pointer, which in your case would mean that you would have to pass 2 this-pointers:

    Normal call to member function:

    struct bar {
      int a;
      void foo() {
        std::cout << a << std::endl;
      }
    
      void call_yourself() {
         auto f = std::bind(&bar::foo, this);
         f();
      }
    };
    

    Your case:

        step_f = std::bind(&TuringMachine::step, this, this,std::placeholders::_1);
    

    Without understanding your code, I would probably redesing your code such that you can avoid the double this pointer.

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

Sidebar

Related Questions

I have a C++ class where I'm trying to use std::bind1st to bind a
I am trying to use boost::bind with a boost::function using this. It seems a
This does not work. I'm trying to learn how to use std::copy but I
I'm trying to use Boost::bind and std::copy to print out the values in a
I am trying to figure out the proper use of std::bind with a boost::signal2
I'm trying to use boost::bind with the std::sort function. I want to bind sort
I'm trying to use std::function in conjunction with std::bind , but I'm having some
I'm trying to use std::ostringstream to convert a number into a string (char *),
I'm trying to use std::string instead of char* whenever possible, but I worry I
I'm trying to use templates to get std:list of items, where each item has

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.