C ++ std :: bind rewrite function

If I bind such a function using placeholders during the bind

std::bind(memberFunctionPointer, objectPointer, _1, _2); 

Is it possible to "rebuild" it later to replace some / all placeholders, but without calling the function? I want to be able to pass in some parameters and then save them so that they can be called later. (pending answer)

+5
source share
1 answer

You can bind again:

 auto f = std::bind(memberFunctionPointer, objectPointer, _1, _2); auto g = std::bind(f, val1, val2); g(); // (objectPointer->*memberFunctionPointer)(val1, val2) 
+8
source

Source: https://habr.com/ru/post/1207770/


All Articles