[squid-dev] [CODE] iterating over enums

Kinkie gkinkie at gmail.com
Wed Aug 5 15:33:42 UTC 2015


Hi guys,
  while working on coverity-fixes (aka HttpHeader refactor) I crossed the
topic of enumerating over iterations. We kind-of follow (C-ish)best
practices on that, but that got me wondering if we can do better.

I came up with a trinket which on its face looks quite elegant to me, and
I'd like to understand with you guys if it makes sense to deploy it in our
code. It is generic, it requies exactly one line of code per enum to
specialize. The only assumption it makes is that enum elements are
represented by a sequence of integral values.
What do you think?

-- 
    Kinkie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150805/4b869d64/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: enum-iter.cc
Type: text/x-c++src
Size: 1172 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150805/4b869d64/attachment.cc>


More information about the squid-dev mailing list