Questions tagged [boost-bind]

boost::bind is a generalization of the standard C++ functions std::bind1st and std::bind2nd. It supports arbitrary function objects, functions, function pointers, and member function pointers, and is able to bind any argument to a specific value or route input arguments into arbitrary positions.

boost::bind is a generalization of the standard C++ functions std::bind1st and std::bind2nd. It supports arbitrary function objects, functions, function pointers, and member function pointers, and is able to bind any argument to a specific value or route input arguments into arbitrary positions. bind does not place any requirements on the function object; in particular, it does not need the result_type, first_argument_type and second_argument_type standard typedefs.

boost::bind was proposed for standardization and a version of it was included in as std::tr1::bind and an improved version is included in the standard as std::bind (see ).

352 questions
0
votes
4 answers

How to convert a function that returns a int to a function that returns a bool using boost::bind?

I have something like the following: struct A{ virtual int derp(){ if(herp()) return 1; else return 0; } void slurp(){ boost::function purp = /** boost bind derp to match lvalue sig **/; } } Any…
dchhetri
  • 6,926
  • 4
  • 43
  • 56
0
votes
1 answer

boost::bind help for callback with member function

Hello I am a student working on a program I have that uses a callback of a member function. I came across the use of bind which is exactly what I need. I just am having difficulties getting it working. Below is the relevant code and compile errors …
ldg
  • 15
  • 1
  • 3
0
votes
1 answer

Boost::bind with object placeholder

I am trying to implement the observer pattern with the catch that I need to add new functionality into each observer later on in the project. class Obsevers { public: virtual ~Obsevers() {} }; class TestObserver : public Obsevers { public: …
andre
  • 7,018
  • 4
  • 43
  • 75
0
votes
2 answers

Crash related to boost::function usage in thread pool

I am trying to implement thread pool in C++ using pthread. I want to encapsulate logic related to threads management in one object which is taking ownership of these threads. That means whenever this object is destroyed, threads must be stopped and…
Marcin
  • 279
  • 1
  • 4
  • 13
0
votes
3 answers

boost::bind together with boost::asio. boost::bind follow up

Now I'd like to add two parameters to the function of the former question: boost::bind together with boost::asio. boost::bind not working, copied from an example EDIT: Sorry, forgot to add the type of timer_result: boost::optional…
deinocheirus
  • 1,833
  • 5
  • 26
  • 44
0
votes
1 answer

typedef of a function pointer for std::string doesn't work

I am trying to defining a specific function pointer type to be used in my calls of boost::bind to resolve issue related to function overloaded not recognized ( by calling static_cast ). I am defining that typedef explicitly for resolving ambiguity…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
0
votes
2 answers

C++ with templates, operator overloading and boost::bind - what this small code does?

#include #include struct FCall3Templ { template ARG1 operator()(ARG1 arg1, ARG2 arg2) { return arg1+arg2; } }; int main() { boost::bind(FCall3Templ(), 45, 56)(); // call…
user827992
  • 1,743
  • 13
  • 25
0
votes
1 answer

boost:asio:read_until issue with boost::bind

I am having an issue compiling this piece of code error /usr/include/boost/bind/bind_mf_cc.hpp:91:5: error: initializing argument 5 of ‘boost::_bi::bind_t, typename boost::_bi::list_av_4::type> boost::bind(R (T::*)(B1, B2, B3), A1, A2, A3, A4)…
gda2004
  • 718
  • 13
  • 32
0
votes
1 answer

C++ Functors and Zero

First a disclaimer, I am replacing a bunch of code which uses boost::function and boost::bind. However, I am moving to a codebase which does not allow rtti. I would like to keep using boost but don't know if there is a way around this…
ohnnyj
  • 53
  • 2
  • 6
0
votes
1 answer

Using boost::bind with a templated object

I want to pass to boost::bind a templated object, but g++ always yield an error. I have found how to pass a templated function, but is it possible to pass a templated object?. Here's the code. #include #include…
Adri C.S.
  • 2,909
  • 5
  • 36
  • 63
0
votes
1 answer

boost::bind error while using asio with accepter.async_accept

I am going through this boost tutorial on http://gwenael-dunand.developpez.com/tutoriels/cpp/boost/asio/ and It is giving me loads of error on boost::bind(&tcp_server::handle_accept, this, new_connection, boost::asio::placeholders::error); I am…
Dipro Sen
  • 4,350
  • 13
  • 37
  • 50
0
votes
2 answers

Actual signature of async_wait() handler

I have a two-layer object structure where the contained object has a deadline_timer and the outer object has the handler function, as: class Internal { asio::deadline_timer t; public: void QueueTick(void (*handler)(boost::system::error_code…
Mike C
  • 1,224
  • 10
  • 26
0
votes
2 answers

"No matching function for call to bind" while using websocketpp

I'm making an (c++) application which is a websocket client and websocket server. To be able to do this, I'm using the library websocketpp. To make the application both a client and server, I want the endpoint1.run() and endpoint2.listen(port) to be…
Rogier
  • 346
  • 8
  • 19
0
votes
2 answers

std::make_pair error with boost::bind in VS2010

I was wondering if someone could help me with this issue. I have been reading that the are some problems with the use of the std::make_pair in VS2010 because it is overloaded, and I have found some workarounds that would work, however, I just can…
0
votes
1 answer

How to get a class member to behave like a function pointer using Boost

I would like to have a class member function behave like a function pointer. I need this behavior to integrate my own classes into some existing code. It seems that this may be possible using Boost::function and Boost::bind, but I can't seem to get…
slaughter98
  • 1,759
  • 14
  • 20
1 2 3
23
24