Boost logo

Boost Users :

From: kartoffelsack (kartoffelsack_at_[hidden])
Date: 2005-09-08 13:49:14


After some significant time of reading and trying I found out that it will
work with boost::function instead of boost::signal (didn't know of
boost::function before).
boost::function is enough for me cause I'm not using multiple slots.
Anyway I would be interestet in wheter it is possible to have a vector<
boost::signal<...> >

so long and thanks for thinkin about my former problem :-)

Am Wed, 07 Sep 2005 18:42:54 +0200 schrieb kartoffelsack
<kartoffelsack_at_[hidden]>:

> 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

-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/

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