|
![](/i/fill.gif) |
"Anthony D. Baye" <Sha### [at] spamnomore hotmail com> wrote:
> Warp <war### [at] tag povray org> wrote:
> > Anthony D. Baye <Sha### [at] spamnomore hotmail com> wrote:
> > > The problem I'm having, at the moment, is that the explanation (Explicitly for
> > > Beginners) in the boost documentation seems rather confusing, to say the least.
> >
> > > They "begin" by introducing "an object with a slot" in the form of a struct with
> > > an overloaded ()() operator... How is this a "Beginner" tutorial, again?
> >
> > Uh... I don't think they are talking about "beginner C++ programmer"
> > tutorial. Rather, "beginner to Boost signals" tutorial.
> >
> > If you are using a library like Boost, it can be safely assumed that you
> > know your way around C++ already.
> >
>
> This is true. The problem I had with it was on of unnecessary complexity. At
> least it seemed unnecessary to me.
>
> > Writing a functor (iow. an object that behaves like a function) should be
> > trivial at that point.
> >
> > > And I'll set aside my prejudices about
> > > the use of structs, which are likely irrational anyway.
> >
> > What exactly is the problem with them?
> >
> > (They are used there just for brevity. You could just as well use a class
> > if you want. In simple cases a struct will do just fine on itself, though.)
> >
>
> As I said, my problem with them is likely irrational. I realize that they are
> semantically similar to classes, but I never use them as such, or view the two
> as interchangeable.
>
>
> > > Now here's my problem: Slots are functions. it would make more sense to me, to
> > > start with a simple, unadorned function, and connect it with a signal.
> >
> > As said, if you are using a library like Boost, one could assume you are
> > already fluent in C++, and that functors are as trivial to you as plain
> > functions.
> >
>
> Obviously we have different ideas of fluency. Although I suppose that I would
> call myself more conversant than fluent. I know the grammar and syntax but not
> all the nuances.
>
> Still, it seems strange to me to bind a signal to a struct rather than to the
> member function thereof. After all, when the signal is raised/emitted, it is
> the function that is called, not the containing object.
>
> It seemed different from the way I thought I understood signals and slots,
> that's all. I have trouble with understanding this particular usage, as it
> seems to be outside my experience.
>
Though, I also don't recall my c++ instructor ever mentioning class-type
functors. (I feel embarrassed now)
> A.D.B
Post a reply to this message
|
![](/i/fill.gif) |