Overloaded function overload

This code was developed and initially worked with a boost of 1.48. Since the update to raise 1.52, it refuses to compile.

boost::signals2::signal<void (uint32_t)> foo;
boost::shared_ptr<boost::circular_buffer<uint32_t>> _foo_buffer = new boost::circular_buffer<uint32_t>(32);
_foo.connect(boost::bind(&boost::circular_buffer<uint32_t>::push_front, _foo_buffer, _1));

The goal is to foo(42)place 42on the front of the circular buffer.

My compilation error No matching function for call to 'bind'with bundle Candidate template ignored: couldn't infer template argument 'R'and similar pattern errors.

I suspect the problem is that between the versions of boost that I use, the definition of push_front has changed from

void push_front(const_reference item = value_type());

to three definitions

void push_front(param_value_type);
void push_front(rvalue_type);
void push_front();

and that confused my compiler.

I am very grateful for the help in the syntax of the connect expression, which will work with the new boost library. Thanks

+3
source share
1 answer

let's say you have two functions

void foo( int ) {}
void foo( double* ) {}

&foo, .

static_cast, , :

static_cast<void(*)(int)>( &foo )

, - .


, - ++ bind ( ++ 03 ).

+1

All Articles