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
1
vote
1 answer

Solr MoreLikeThis and using Boost Functions (Boost recent Items)

I have a similar question as in "Boost recent item in MoreLikeThis Solr request handler" Boost recent item in MoreLikeThis Solr request handler I would like to Boost recent Items returned from the MoreLikeThis Handler or Component. I found out that…
velop
  • 3,102
  • 1
  • 27
  • 30
1
vote
2 answers

Help with boost bind/functions

I have this function signature I have to match typedef int (*lua_CFunction) (lua_State *L);//target sig Here's what I have so far: //somewhere else... ... registerFunction("testFunc", &LuaEngine::testFunc, this); ... …
jameszhao00
  • 7,213
  • 15
  • 62
  • 112
1
vote
2 answers

How to get C pointer (like `var (*)(void*, var)`) out of `boost::function`?

Possible Duplicate: demote boost::function to a plain function pointer So I use Flash C++ Compiler (aka flascc, alchemy) and havin code like: boost::function f = boost::bind(&as3_socket::socket_socketData, this, _1, _2); …
myWallJSON
  • 9,110
  • 22
  • 78
  • 149
1
vote
1 answer

A map of boost:signals with boost:function definition

I am trying to create a simple manager that will map error codes to functions. But since a map copies the values and a signal is noncopyable that is not a solution. I cannot use a map of shared_ptr pointers since the * operator is blocked in…
Middy
  • 91
  • 1
  • 9
1
vote
1 answer

Using boost::function and boost::bind to a member variable

I'm trying to create a boost::function that allows setting of a member variable of an object. I've created the simplest example I can think of to get across what I'm trying (and failing) to do. I feel like I have a grasp of boost::bind, but I'm new…
Nic Foster
  • 2,864
  • 1
  • 27
  • 45
1
vote
1 answer

Boost function composition

Suppose I want to have a function double adapter(double), is there a general way to compose it with a boost::function functor to produce another boost::function functor2 where functor2(...) == adapter(functor(...))? In…
pythonic metaphor
  • 10,296
  • 18
  • 68
  • 110
1
vote
1 answer

Boost function assignment throws exception

Boost::function is throwing me exceptions one out of ten times when I try to assign one function1 to another function1. Task is a typedef for boost::function1. Here is the specific code: // the Task object sent in as Task task …
KaiserJohaan
  • 9,028
  • 20
  • 112
  • 199
1
vote
1 answer

How to use boost::is_same in c++ template along with boost::lambda::bind

I'm trying to connect a generic boost::function to many boost::signals2 of varying signature. I'm able to use boot::lambda::bind to do the binding part by passing the return value as part of the bind parameters, but have a problem when…
Sak
  • 269
  • 1
  • 4
  • 13
1
vote
1 answer

Is it possible to find the return type of a boost::function from it's typedef?

Is it possible to find the return type of a boost::function purely from its typedef? Example: typedef boost::function CallbackType1; typedef boost::function CallbackType2; How to find the return type of the…
Sak
  • 269
  • 1
  • 4
  • 13
1
vote
1 answer

Are there important differences to know about between boost::function and std::tr1::function

I use boost a lot in my code but have so far refrained from using std::tr1. Now I need a more sophisticated function pointer, like those two can provide. Unfortunately C+11 is not an option yet. I read that boost::function can be tricky with certain…
Martin
  • 4,738
  • 4
  • 28
  • 57
1
vote
1 answer

error: ambiguous overload for ‘operator[]’ when using boost-bind to boost-function

I am attempting to map the filter functor with one of the member methods of my class based on the value of an input string. #include #include #include #include #include…
Kurt Koller
  • 334
  • 1
  • 3
  • 14
0
votes
1 answer

Boost.Lambda - dereference placeholder

Is there a way to dereference a placeholder inside lambda expression ? boost::function f = _1->myMethod(); f(myObject); I know I can make a binding: boost::function f = boost::bind(&MyClass::myMethod, _1); , but I…
Marc Andreson
  • 3,405
  • 5
  • 35
  • 51
0
votes
2 answers

cloning a boost::function into a pointer and calling the wrapped function with that pointer

I am trying to create a copy of a boost::function by using a pointer and call that function using that pointer. My questions are cloning a boost::function that way is something correct the call to fp->target() should call or not the function…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
0
votes
2 answers

boost::bind and insert of a boost::unordered_map

I want to use boost::bind to create a boost::function inserting a new key-value pair into a boost::unoredered_map but I got few compilation errors. typedef boost::unordered_map< std::string, std::string > dict_type; inline void insert(…
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
0
votes
2 answers

static declaration in a c++ class

I don't understand why the first doesn't work instead the second works! #include #include #include "concurrentQueue.h"; class TestClass { public: static…
M4rk
  • 2,172
  • 5
  • 36
  • 70