[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange construct
From: |
Han-Wen Nienhuys |
Subject: |
Re: Strange construct |
Date: |
Tue, 9 Oct 2007 23:43:44 -0300 |
2007/10/9, Ralph Little <address@hidden>:
> Hi,
> Sorry for my C++ ignorance, but what does the following do?
>
> =========================================
> void
> performer_each (SCM list, Performer_method method)
> {
> for (SCM p = list; scm_is_pair (p); p = scm_cdr (p))
> {
> Performer *e = dynamic_cast<Performer *> (unsmob_translator
> (scm_car (p)));
> if (e)
> (e->*method) ();
> }
this calls the derived method (as specified in the function pointer
method) for the instance e. eg.
performer_each(l, &Class::member)
will call
c->member()
for each element of the list.
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen
- Strange construct, Ralph Little, 2007/10/09
- Re: Strange construct,
Han-Wen Nienhuys <=