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

mismatch in the number of arguments passed to boost function using boost::bind

I am trying to create a Functor using boost function and bind, but i cant pass only a single argument to the destination function which has 3 arguments: #include #include template void…
rahman
  • 4,820
  • 16
  • 52
  • 86
0
votes
2 answers

How to pass a functionpointer when the arguments are not known yet

I have a static function Bar::Function(std::string s1, std::string s2, std::string s3 ) that I want to pass as a functionpointer to the constructor of class Foo which has a boost::function member. But the three strings are created in the Foo() class…
tzippy
  • 6,458
  • 30
  • 82
  • 151
0
votes
3 answers

warning: derived class's member variable is initialized after base class

The title of the question is plain and simple. here is the code: class xxx : public Scheduled { long int _wait_time; boost::function< void() > _cb; mutable boost::mutex _mutex; public: xxx(boost::function< void() > callback,…
rahman
  • 4,820
  • 16
  • 52
  • 86
0
votes
1 answer

using std::function in a std::map

I have a class... #include #include enum class ECmd { one, two, three }; class C { public: void Command(ECmd e) { auto pos = m_fnCmd.find(e); if (pos != m_fnCmd.end()) { //…
0
votes
1 answer

errors using boost::function with boost::bind with boost::asio

i am facing problems combining boost::function with boost::bind and boost::asio. i am facing snippets of code down, the compiler throws tons of errors, i am pasting the root errors. static void startAccept(boost::asio::io_service &io, …
Ravikumar Tulugu
  • 1,702
  • 2
  • 18
  • 40
0
votes
1 answer

boost function instantion with nothing

I am currently using the following piece of code in my dll file: typedef boost::function Function_Callback_type; #pragma data_seg(".SHARED") int common = 0 ; Function_Callback_type funct_callback; #pragma data_seg() #pragma…
MistyD
  • 16,373
  • 40
  • 138
  • 240
0
votes
1 answer

boost::function variable is empty in destructor

I need to use different implementations of some of the methods in my class, therefore I use a couple of boost::function variables to point to correct method. everything seems working except this variable: boost::function onExit which is…
rahman
  • 4,820
  • 16
  • 52
  • 86
0
votes
0 answers

How can I typedef boost::function requiring a type argument?

Piecing together some examples I found on stackoverflow, I'd like to do the following: template using FuncPtr = boost::function< int (const T) >; Perhaps to later use it like so: template build_fancy_lookup_table( string…
Bitdiot
  • 1,506
  • 2
  • 16
  • 30
0
votes
2 answers

binding to boost::function class member compilation error

boost::function test_func; struct test_t { boost::function foo_; void test() { // This works as expected test_func = boost::bind(test_t::foo_, 1); } }; int main(int argc, _TCHAR* argv[]) { test_t…
7.62
  • 3
  • 1
0
votes
2 answers

Make boost::function take a reference to my function object

I want to pass a struct implementing operator() in to a function that accepts boost::function. This struct keeps track of the number of times it's been called. struct CallCounter { CallCounter() : count( 0 ) {} void operator()() { …
Brian Schlenker
  • 4,966
  • 6
  • 31
  • 44
0
votes
2 answers

unresolved external symbol "public: void __thiscall..."

I'm using boost::function to enable the passing of a function to a Button constructor so it holds that function. Calling it whenever it is activated. typedef boost::function< void() > Action; In my TitleState I've constructed a Button like this. …
Person
  • 429
  • 1
  • 8
  • 16
0
votes
1 answer

Member function template using boost::function

The following TestClass works: #include #include #include void ext_fun(const float f, int i) { std::cout << f << '\t' << i << std::endl; } template class TestClass { public: …
Matteo M.
  • 65
  • 1
  • 3
0
votes
1 answer

function with function object argument of different signatures

I tried overloading a function with boost::function with different signatures, it did not work. I tried using template Connection *connect(boost::function f) which also failed because boost::bind doesn't implicitly convert that…
Saif Ur Rehman
  • 338
  • 3
  • 14
0
votes
1 answer

storing the output of boost::bind in a boost::function

I currently have something like this void asomeMethod(int q) { std::cout << "Method with parameter " << q ; } int main() { boost::function parfunct; parfunct = boost::bind(&asomeMethod,12); parfunct; //Does not call…
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
0
votes
1 answer

boost::function parameter definition not working

I created two special types that I want to use in my get_property_function.hpp in my application: typedef boost::function GetFunction; typedef map PropertyToGetFunction; typedef boost::function
M.H.
  • 223
  • 3
  • 10
  • 23
1 2 3
10
11