[Debtags-devel] Hello, and a few improved tag descriptions

Mike Paul mike@wyzardry.net
Fri, 03 Jun 2005 19:38:36 -0400


--=-RiJ4IhnUsEVKxxX+O0CG
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

(Oops, forgot to send this to the list the first time...  sorry about
the duplicate, Enrico.)

On Fri, 2005-06-03 at 15:22 +0200, Enrico Zini wrote:
>    TagcollConsumer now has 4 'consume' methods, of which 2 with a
>    default implementation:
>=20
>         // Process an untagged item
>         virtual void consume(const ITEM& item) =3D 0;
>         // Process a tagged item, with its tags
>         virtual void consume(const ITEM& item, const OpSet<TAG>& tags)
=3D 0;
>         // Process a set of items, all with no tags
>         virtual void consume(const OpSet<ITEM>& items);
>         // Process a set of items identically tagged, with their tags
>         virtual void consume(const OpSet<ITEM>& items, const
OpSet<TAG>& tags);
>=20
>    This means that when iterating, we're either iterating a
>       pair<ITEM, OpSet<TAG> > or a
>       pair<OpSet<ITEM>, OpSet<TAG> >.
>=20
>    Does that mean 2 different sets of iterators?

My initial reaction (but I haven't studied the code yet) is that the
first three things are just special cases of the fourth, and don't need
to be implemented separately: you have a set of one or more ITEM, and a
set of zero or more TAG.  So the first three versions of consume() would
be convenience frontends which just call the fourth version, which does
the actual work.

BTW, Boost has some templates which are helpful in writing iterators:

        http://www.boost.org/libs/iterator/doc/index.html

I plan on spending some time this weekend familiarizing myself with the
existing code.  I'll keep these issues in mind when I do.=20
--=20
Mike Paul <mike@wyzardry.net>

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBCoOn83SZkqUhyWy4RAsy5AJ9aSpEeGo1knHIylt0o33Bjjvf2cQCfVGVZ
XJeKX/D+Gw6TBwJX28m0o48=
=E1Yk
-----END PGP SIGNATURE-----

--=-RiJ4IhnUsEVKxxX+O0CG--