Boost logo

Boost Users :

From: Evan Carew (carew_at_[hidden])
Date: 2006-02-05 20:56:33


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sebastian,

Thanks for the more detailed reply. I apologize for my earlier
response to your first message as it sounded distinctly like one of
those pedantic lurkers I run into on the C++ news group from time to
time. Usually, when I find one, I simply put them into my TB filters
list. As you may have guessed, my question was about how to make a (to
me) realistic example of the signals library work. The overly
simplistic hello example in the manual is where I stopped, having
thought the signals library was truly easy to use. Much to my
surprise, when it came time to actually put it to use in my
application, I got all kinds of strange seg fault errors. After
spending an hour or so I didn't have to spare on figuring out where
the problem was emanating from, I'll admit to being a little surprised
and frustrated (maybe even a little angry) as the hello example didn't
seem to do a good job of warning the user that all but the most
trivial examples of that use of the library would work as designed.

I suspect like most programmers in my position, time is a luxury we
can hardly afford to spare giving every dense manual of a library we
are looking at a close read, not to mention slogging through the
source code. Previous to my getting more involved with the boost
libraries, I have made heavy use of the STL. Except for the generous
SGI site and non-free texts on the subject, there are precious few
references on the STL, but that's OK as it is relatively easy to read
through the well documented source and figure out what is going on. To
some extent, that model of support is broken in boost as the level of
complexity has increased. Therefore, people like myself are at the
mercy of polite, helpful people like yourself who have already had
experience with the library or who had a hand in creating it.

Sincerely,
Evan Carew

P.S.
For the archives, the attached code is a working copy of the test code
I was trying to implement, compliments to

Sebastian Redl and Scott Collins
http://scottcollins.net/articles/a-deeper-look-at-signals-and-slots.html

using namespace std;
using namespace boost;

class tst_out{
  public:
    boost::signal<void()>timer;
    ~tst_out(){ cout << "Called del for tst_out" << endl;}
};

class tst_out2{
  public:
    void print(){
      cout << "test out 2" << endl;}
      ~tst_out2(){ cout << "Called del for tst_out2" << endl;}
};

int main(int argc, char *argv[])
{
  tst_out tst1;
  tst_out2 tst2;
  tst1.timer.connect(boost::bind(&tst_out2::print, &tst2));
  tst1.timer();
  cout << "exiting program" << endl;
  return EXIT_SUCCESS;
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD5qzQpxCQXwV2bJARAj1+AKDCSHtkkt8TdA6Z3l4OwMAVpTPEYgCeOE+A
epo6b9x3BjEoHiVVNoU7S3Y=
=3rjg
-----END PGP SIGNATURE-----


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