[Dev] STL for_each underwhelms me

Tanner Lovelace dev@trilug.org
11 Feb 2002 17:23:00 -0500


--=-AgSLD0tK93kUO12lB6Ly
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Mon, 2002-02-11 at 16:53, M. Mueller (bhu5nji) wrote:
> So that's what a functor is.  Function adapter is a better name - by far.

I agree.  I think the name functor comes from something in higher
mathematics, so if you're familiar with that it works ok.  For those
of us who are mere mortals, however... :-)
=20
> Function is an address and method is an offset from the base of the table=
?

Exactly!  To call a method you actually need two addresses: that of the
class, and that of the method inside the class (i.e. table base offset).
Functions only require one.  That's why you can get into trouble
trying to pass a non-static method.  (BTW, static methods are the same
for each class, so they're implemented exactly like a regular function.
That's why you can substitute a static method for a regular function.)
=20
> I am truly amazed how the containers in STL have so rapidly changed that =
way=20
> I approach design.   I've OO-ing things in my product (www.signalnetware.=
com)=20
> since last summer and I've had some handsome payoffs for the work.  I can=
=20
> sense their is more value to be had.  I really got frustrated with the=20
> for_each algorithm, though.
>=20

Well, I personally don't consider containers an example of OO.  Instead,
I consider them an example of generic programming, but hopefully the
result is the same: better code and maintainance.

Tanner
--=20
Tanner Lovelace | lovelace@wayfarer.org | http://wtl.wayfarer.org/
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
GPG Fingerprint =3D A66C 8660 924F 5F8C 71DA  BDD0 CE09 4F8E DE76 39D4
GPG Key can be found at http://wtl.wayfarer.org/lovelace.gpg.asc
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
 Those who are willing to sacrifice essential liberties for a little=20
 order, will lose both and deserve neither.  --  Benjamin Franklin=20

 History teaches that grave threats to liberty often come in times
 of urgency, when constitutional rights seem too extravagant to=20
 endure.  --  Justice Thurgood Marshall, 1989=20

--=-AgSLD0tK93kUO12lB6Ly
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA8aERDzglPjt52OdQRAsI3AJ9g4CWq9aDSUxa/pAZJbJeXXTcvvwCfT9qw
qi3EUiDDOvN6gKf7bvP9vU0=
=/sMH
-----END PGP SIGNATURE-----

--=-AgSLD0tK93kUO12lB6Ly--