Re: [sigc] current work on libsigc2



Am 2003.09.04 08:57 schrieb(en) Murray Cumming:
On Wed, 2003-09-03 at 21:31, Martin Schulze wrote:
> Am 2003.09.03 18:29 schrieb(en) Murray Cumming:
> > I think you forgot to add reference_wrapper.h to cvs.
>
> Yes, thanks for notifying me.
>
> > All the recent ChangeLog stuff looks very impressive but mostly
> > incomprehensible to me. I'll try to get familiar with the code
again.
> >
> > I'm surprised that you could do without typeof, but I don't know
the
> > details. Is the boost thing using typeof?
>
> No, boost is not using typeof(). typeof() seems to be supported by
gcc
> only (and has a bug with references there).

That's good then. Well done.

> The details in short are that we have to make the assumption that
> functors define "typedef ... result_type;". If you use 3rd-party
> functors in libsigc++2 there are two policies:
> - writing "namespace sigc { namespace functor {
>                                   SIGC_FUNCTORS_HAVE_RESULT_TYPE }
}"
>    in your source means that all 3rd-party functors you use define
>    "typedef ... result_type".
> - writing "namespace sigc { namespace functor {
>          SIGC_FUNTOR_TRAIT(your_functor, the_result_type) } }"
>    specifies the result type of functor "your_functor".
> Multi-type functors can only be supported through typeof().

And does boost have a similar system, or limitation?

Yes. E.g. the documentation of boost::bind states:

"The first form instructs bind to inspect the type of f in order to determine its arity (number of arguments) and return type. Arity errors will be detected at "bind time". This syntax, of course, places some requirements on f. It must be a function, function pointer, member function pointer, or a function object that defines a nested type named result_type; in short, it must be something that bind can recognize."

I'd probably need
an example, to understand what a "3rd party functor" really is, or how
I
might use it. I suspect it's not a big deal.

Probably, "3rd-party" is incorrect english. What I meant by it is:
E.g. std::mem_fun_t is a 3rd-party functor for us. Or if the user
defines

struct norm {
  double operator()(double arg1, double arg2)
    { return sqrt( arg1*arg1 + arg2*arg2 ); }
};

then norm is a 3rd-party functor for us.

Regards,

  Martin



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