Questions tagged [boost-function]

A Boost C++ library that provide a family of class templates that are function object wrappers, similar to generalized callbacks.

The Boost.Function library defines boost::function, a class template that is callable like a function, and wraps another callable type and forwards calls to it.

Boost.Function was proposed for standardisation and was included in the Technical Report on C++ Library Extensions () as std::tr1::function and included in the C++ 2011 standard as std::function ().

162 questions
0
votes
1 answer

Boost Overload strange behaviour.. how `int (int ), int (std::string )` differs from `int (int ), int (std::string ), std::string (std::string)`?

So there is that great lib called OverLoad (link to downloadable svn directory, lib is header only). it can accept functions of any types into it and automatically decide which one you are calling. It is like boost function but better. Here are 2…
myWallJSON
  • 9,110
  • 22
  • 78
  • 149
0
votes
0 answers

Can a ros::Subscriber be initialized using std::function as callback object?

I am trying to pass the subscriber callback function from another class as std::function object. const std::function cmd_vel_callback; test_sub =…
0
votes
1 answer

Boost.Bind with Function and Python

I get some compile time errors and I can't understand why that is. The following code will refuse to compile, giving me the following errors: error C2664: 'void (PyObject *,const char *,boost::type *)' : cannot convert parameter 1 from 'const char…
Paul Manta
  • 30,618
  • 31
  • 128
  • 208
0
votes
0 answers

Equality comparing boost::function with functor.members.func_ptr

I'm currently trying to implement an event manager in C++. In principle it keeps a map of event types (uint64_t) to a list of boost::functions. User can register new listeners by calling…
0
votes
2 answers

Question about the object adress of a return object with the type of boost::function &

Why the addresses of this two variable(i.e hoofunc and Ctx::hookFunc4Boost) are not same whereas the Ctx::getBoostHookFun() return a left reference to Ctx::hookFunc4Boost? I intend to avoid the copy of a temporary object by returning a left…
John
  • 2,963
  • 11
  • 33
0
votes
2 answers

Storing boost::function object with variable number of arguments

What I'm trying to achieve is creating a struct which stores any kind of method. I can later call struct_object.run() to run the method I've stored. This method can return any kind of value and, most importantly, use any amount of parameters;…
someCoder
  • 185
  • 3
  • 15
0
votes
1 answer

Class internal lambdas and boost function

I'm using C++0x's lambdas to define boost functions. I have some classes where I define some of their behaviour using lambdas/boost functions. What I was wondering is, is it possible to expose data about the classes into the lambda's context without…
Megatron
  • 2,871
  • 4
  • 40
  • 58
0
votes
2 answers
0
votes
1 answer

solr function queries with 'def'

I am trying to use solr 'def' function with bf , but it is not working as given in documentation The documentation says : def is short for default. Returns the value of field "field", or if the field does not exist, returns the default value…
dname
  • 153
  • 2
  • 10
0
votes
2 answers

Replacing boost::function and boost::bind with Templates

I'm attempting to remove boost libraries from my code. I don't have std::function, and i'm working with C++98, not c++11. I still need to store a vector of simple void Funcs() from different classes. I'm using a simple template to get the Class…
aquawicket
  • 524
  • 1
  • 9
  • 27
0
votes
1 answer

Linker errors when using Boost Unique pointer with Boost Bind and Boost Function

Using Boost Bind with a Boost Unique Pointer and Boost Function I am receiving linker errors depending on how I pass a callback to the receiving function. If I create a Boost Function member variable by binding a callback containing a boost unique…
boneill
  • 31
  • 4
0
votes
0 answers

Error while trying to use boost::factory

I am trying to use boost factory and I am experiencing the following problem. All I am trying to do is having a bunch of derived classes to have a mechanism that will be initializing the derived class that is matched with a corresponding string. To…
user3111197
  • 83
  • 2
  • 11
0
votes
1 answer

Getting boost::function from boost::lambda::bind of new_ptr with parameters

I am trying to obtains a boost::function to a new_ptr (with parameters) which can be stored in a hash table for later use. A kind of registrar of ids to constructors for modules to use. Below is the simplified problem : #include…
jinc
  • 1
  • 2
0
votes
1 answer

pass a bound member function

I am trying to pass a bound member function into a routine and have the result type be determined by the template class: template< class Fun, class P> auto splat(double start, double finish, int steps, Fun fun, double bias) { typedef…
doby
  • 545
  • 4
  • 9
0
votes
0 answers

Use of boost libraries apply_visitor, bind and function in C++

I am new to the use of the boost library and have questions regarding its use. I have a vector union of ints and strings generated by use of boost::variant. Assume the vector is called myvec. I tried following the advice on this post to extract…
Sid
  • 266
  • 5
  • 13