Boost logo

Boost Users :

From: kartoffelsack (kartoffelsack_at_[hidden])
Date: 2005-09-07 11:42:54


Hi!

I'd like to save any kind of functions/functors with void as parameter and
as return-value in a
container. I thought to use boost::bind:

Let me show you some code:

void bar( )
{
}

struct Foo
{
   void operator();
}foo;

typedef boost::signal<void ()> voidFunctionSig;

std::vector< voidFunctionSig> voidFunctions;

voidFunctionSig signal1;
voidFunctionSig signal2;

signal1.connect( &bar);
signal2.connect( &foo);

voidFunctions.push_back( signal1); //error
voidFunctions.push_back( signal2); //same error

I'm getting a Compiler-errors in the push_back-Lines:

'boost::signal<Signature>::__ctor': no nonexplicit constructor for
implicit conversion:
with
[
    Signature=void (void)
]
and
[
    Signature=void (void)
]

well, i'm not shure if boost::bind is the right choice at all, because I
do not need multiple slots.
Perhaps boost::bind/boost::mem_fn was enough but i cannot think how to use
it.

Can anybody help me to save my void (*)(void)-functions/functors and in a
container? I could do it
writing a superclass and a virtual op() but I would prefer to use
ready-to-use boost-classes for this
task.

PS: using VC 7.1


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net