POV-Ray : Newsgroups : povray.off-topic : To anyone who has worked with boost : Re: To anyone who has worked with boost Server Time
28 Jul 2024 20:24:46 EDT (-0400)
  Re: To anyone who has worked with boost  
From: Anthony D  Baye
Date: 17 Feb 2013 04:20:01
Message: <web.51209edd6e8f7c38d97ee2b90@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Anthony D. Baye <Sha### [at] spamnomorehotmailcom> 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.

A.D.B


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.