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
2 answers

compiler error on calling boost::bind() inside boost::thread constructor

I am currently writing a firebreath C++ NPAPI plugin, and i an trying to invoke a boost::thread from inside the plugin. The platform i am building it is Ubuntu Linux 13.04. Here is the skeleton of the class declaration and relevant member function…
0
votes
2 answers

boost::bind() with template functions

How can I boost::bind() a template function? I want this code (inspired by the boost::bind bind_as_compose.cpp example) to compile and run. Note the evaluation is different than in the bind_as_compose.cpp example; fff() begins running before…
Adi Shavit
  • 16,743
  • 5
  • 67
  • 137
0
votes
2 answers

Transform vector of boost::shared_ptr using boost::bind and boost::static_pointer_cast

I have a std::vector of Boost shared pointers to objects, and would like to get a vector of shared pointers to the same objects casted down to a more specific type: //using boost::shared_ptr, std::vector; vector >…
dunadar
  • 1,745
  • 12
  • 30
0
votes
2 answers

using boost::function to save function pointer to arbitrary object's member functions

I am trying to store a member function from an object to call it when an appropriate event happens. Unfortunately this code gives a lot of error messages. Can anybody help me? class MainPage { public: MainPage::MainPage(void) { …
DalekSupreme
  • 1,493
  • 3
  • 19
  • 32
0
votes
1 answer

Encapsulating boost::signal and boost::bind

I have a problem now. I am trying to encapsulatie boost::signal and boost::bind into my own Event class. class MyEvent { private: boost::signal Sig; public: void Subscribe(.........) { Sig.connect(boost:bind(.........); } …
cynric4sure
  • 189
  • 1
  • 12
0
votes
1 answer

boost::bind implicit conversion to boost::function or function pointer

I'm using boost::function like this: template void run(boost::function func, string arg) { T1 p1 = parse(arg); func(p1); } When used like this, everything is ok: void test1(int i) { cout << "test1 i=" << i <<…
anorm
  • 2,255
  • 1
  • 19
  • 38
0
votes
1 answer

Using boost::bind to call a function in boost::Statechart

I'm trying to write a program to upload a file to an arduino. The program can open a serial port and receive data from the arduino. The problem comes when I try to use a callback to a function in a statechart state, the program crashes. I have…
Andre
  • 115
  • 1
  • 7
0
votes
2 answers

How to pass signal callbacks (using boost::bind)

I'm writing a wrapper for boost::signals2::signal to get a cleaner, more easy to use interface. Here's what I've come up with: #include // Wrapper class template for boost::signals2::signal template class Signal { …
Jonatan
  • 3,752
  • 4
  • 36
  • 47
0
votes
4 answers

Boost bind AIX xlc io_service run

Im trying to compile project using boost, binding asio::io_service to boost::thread, and Im getting errors that I dont know how to resolve Using: IBM XL C/C++ for AIX, V11.1 (5724-X13), Version: 11.01.0000.0006 (AIX 7.1) …
Pinker
  • 65
  • 8
0
votes
1 answer

How to get the arguments binded into boost::function?

From the boost::bind docs( http://www.boost.org/doc/libs/1_53_0/libs/bind/bind.html#with_functions ), "The arguments that bind takes are copied and held internally by the returned function object", but if there's a way I could get the arguments…
cyber4ron
  • 468
  • 5
  • 7
0
votes
1 answer

boost::bind along with qtconcurrent::map ...can't seem to make it work

Well I require your assistance because I can't seem to find a way to make QtConcurrent::map work with my static function and my sequence of elements. Here is what I'm trying to do: I want to run this function : static void…
Lex
  • 413
  • 1
  • 7
  • 19
0
votes
1 answer

Raw function pointer vs boost::bind return value

What's the difference between raw function pointer vs boost::bind pointer return value?
0
votes
1 answer

Using boost::bind with a class containing a boost::mutex

I'm working on a server using a watchdir to add items to an internal collection. The watchdir is browsed periodically by a thread which is created like this : this->watchDirThread = new boost::thread(boost::bind(&Filesystem::watchDirThreadLoop, …
Opera
  • 983
  • 1
  • 6
  • 17
0
votes
3 answers

boost::bind accessors?

Suppose I have the following code: int f(int, int); int main() { SomeFunc(boost::bind(f, 1, 2)); } From the SomeFunc() function, is it possible to access the arguments held by the bound type? Something like this (pseudo code): // Obvious…
Andrew
0
votes
1 answer

Access boost::function arguments

Is it possible to access the arguments contained in a boost::function type? I'd like to be able to retrieve the address of the function to be called, and the values of the arguments provided for that function.
Andrew