Questions tagged [stdbind]

The C++11 function std::bind() fixes some or all arguments of a function object, returning another function object that takes fewer arguments.

std::bind performs Partial Function Application of arbitrary C++ function objects, fixing some or all arguments of a function object and returning another function object that takes fewer arguments.

The function is based on boost::bind() which originated in the library (see ) and an earlier version was included in as std::tr1::bind().

371 questions
-1
votes
1 answer

Using std::bind in an event system with a parameter of an inherited type?

That's one cryptic title, but I couldn't think of a way to better describe my problem. I'm writing up a small event system using std::function and std::bind and so far things are working pretty nicely. The problem I'm experiencing now, however, is…
Qub1
  • 1,154
  • 2
  • 14
  • 31
-1
votes
1 answer

Call wrapper inside shared_ptr<> instance on its member function

I'm trying to make a forwarding call wrapper with std::bind() of an internal member function inside instance which has been created as a shared_ptr<>. Look like there's no chance. In a nutshell: std::shared_ptr
danilabagroff
  • 602
  • 1
  • 7
  • 23
-1
votes
1 answer

std::bind causes illegal indirection error

I am working through the SFML Game Development book, but I have encountered a problem with std::bind. I searched for a solution, and it seems others have had a similar problem. However, I still was unable to find a solution to this particular…
AlecM
  • 23
  • 1
  • 3
-1
votes
2 answers

Executing bound std::function throws std::bad_function_call

I want to bind a member function to a std::function. I heard that member functions take one extra parameter which is the instance pointer. Therefore I call std::bind(&Class::Function, this, parameter) but when I execute the function…
danijar
  • 32,406
  • 45
  • 166
  • 297
-2
votes
1 answer

How to use a base class template member function in derived?

how to use a base class template function in a derived case? Example: Class A{ protected: template std::vector generate_value(const size_t& generated_points, std::function
mas
  • 13
  • 4
-2
votes
1 answer

C++ std::Bind function instance error with placeholder

Need help to identify what am I doing wrong. I am trying to use _1 ,_2 for to find instance of the class object to bind a function. class CL_2 { public: void set_item(item_t* item){ ... } }; class CL_1{ CL_2**…
bh987
  • 19
  • 3
-2
votes
1 answer

creating a std::bind to be called on a specific class instances within another class

So apparently std::bind takes a bit of processing power/ time to do, so I figure I want to execute any binds at the start of a program, when I'm defining my classes and such, rather than do a lot of them during runtime. Here's what I WANT to be able…
DSiegmeyer
  • 17
  • 3
-2
votes
3 answers

Can you use std::bind (or something else) to change return type?

Say I've got a function, bool my_func(bool input_val) { return !input_val; } and I want to pass it around as a function that returns void and takes nothing, so it would be something like: bool the_truth = true; void…
TankorSmash
  • 12,186
  • 6
  • 68
  • 106
-2
votes
1 answer

How to pass a parameter to std::bind from a function

I am working on c++ 11. I want to write a function funA in a class, which binds another function funB within the same class. And funB function is a parameter in the function funA. What could be the syntax of the funcA ? I tried using std::function…
SuryaRao
  • 51
  • 1
  • 6
-2
votes
1 answer

std::function from std::bind initialization in the initializer list

I have a map of actions to be taken upon certain choice, struct option { int num; std::string txt; std::function action; }; void funct_with_params(int &a, int &b) { a = 3; b = 4; } int param1 = 1; int param2 = 3; I want to…
cerkiewny
  • 2,761
  • 18
  • 36
-2
votes
1 answer

std::function extract and remove argument

I'm learning c++11/14 these days and it seems like a whole new language to me with all the great additions but I still can't quite make use of all these new features: typedef std::function void_f; typedef std::function
Petar
  • 1,034
  • 1
  • 12
  • 18
1 2 3
24
25