[Debtags-devel] Hello, and a few improved tag descriptions
Enrico Zini
enrico@enricozini.org
Sun, 5 Jun 2005 15:11:01 +0200
--RASg3xLB4tUQ4RcS
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
On Fri, Jun 03, 2005 at 07:38:36PM -0400, Mike Paul wrote:
> On Fri, 2005-06-03 at 15:22 +0200, Enrico Zini wrote:
> > // Process an untagged item
> > virtual void consume(const ITEM& item) = 0;
> > // Process a tagged item, with its tags
> > virtual void consume(const ITEM& item, const OpSet<TAG>& tags)
> = 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);
[...]
> 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.
Formally this is true; however, using the first three avoids to build
a std::set (or OpSet) structure when it's not needed. But maybe I'm
trying to optimize too early in the development?
- - -
/me also starts considering getting rid of OpSet and using algorithm
functions instead of overridden operators. However, I'm quite attached
to being able to say:
ts += (ts - ts1)
Instead of something like:
set_difference(ts.begin(), ts.end(), ts1.begin(), ts1.end(), back_inserter(temp));
copy(temp.begin(), temp.end(), ts);
This is another big doubt of mine: I hate OpSets because they're just
std::set with some operators overridden, and when one sees them it's
hard to figure out what the heck they are; however, the whole Debtags
code is full of set operations, and they make it all so easier to read.
> BTW, Boost has some templates which are helpful in writing iterators:
> http://www.boost.org/libs/iterator/doc/index.html
Oh, boost! Long time I want to dig in that! Thanks for the link, I'm
excited to finally have an opportunity to have a look at it!
Ciao,
Enrico
--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico@enricozini.org>
--RASg3xLB4tUQ4RcS
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFCovnl9LSwzHl+v6sRAsX9AKCSB4PMu5JbpN9Ewn6K/n6a8KhOygCdGp0L
G7QSe23MAu5LLiiiLrsYWpU=
=IA/H
-----END PGP SIGNATURE-----
--RASg3xLB4tUQ4RcS--