[gtkmm] Re: [sigc] libsigc++-2.0 functor and adaptor names



Am 29.10.2003 um 13:09 Uhr haben Sie geschrieben:
> Martin Schulze wrote:
> 
> > Currently, in libsigc++-1.9.11 the functions called
> > to create functors (replacing SigC::slot()) are named
> > as following:
> >
> >   sigc::ptr_fun() (stores a function pointer)
> >   sigc::mem_fun() (stores a member function pointer; optionally 
> > together with a reference or pointer to an object instance)
> >
> > The functors returned (no equivalent in libsigc++-1.2) are called:
> >
> >   sigc::pointer_functor#<>
> >   sigc::[bound_][const_][volatile_]mem_functor#<>
> >
> > The generic container for arbitrary functors (equivalent but much
more 
> > powerful than SigC::Slot#) is called:
> >
> >   sigc::slot<>
> >
> >
> Technically, which sould be the preferred method for programmers to 
> create functors, with sigc::ptr_fun#()  and sigc::mem_fun#(), or 
> sigc::slot<>, or doesn

You should use the methods sigc::ptr_fun() and sigc::mem_fun(). 

sigc::slot<> is a structure that has an implicit templated ctor that
converts arbitrary functors (e.g. the ones returned by sigc::ptr_fun()
and sigc::mem_fun()) into a functor with a well-defined parameter
list.

E.g. sigc::signal<void,int>::conect() takes functors of type
sigc::slot<void,int>. A sigc::slot<void,int> instantiation is created
on the fly from the functors you pass into connect(). The type of this
functor might be sigc::pointer_functor<void,int>,
sigc::pointer_functor<void,float>, sigc::bound_mem_functor<void,int> or
any other type on which operator()(int) can be invoked.

Cheers!

  Martin







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]