Re: [squid-dev] [CODE] iterating over enums

2015-08-13 Thread Kinkie
On Wed, Aug 12, 2015 at 9:11 PM, Alex Rousskov rouss...@measurement-factory.com wrote: On 08/12/2015 09:36 AM, Kinkie wrote: So I went ahead and just implemented it, starting from your observations. It's a bit more complex that your proposal, as I took the chance to implement

Re: [squid-dev] [CODE] iterating over enums

2015-08-13 Thread Alex Rousskov
On 08/13/2015 03:20 AM, Kinkie wrote: On Wed, Aug 12, 2015 at 9:11 PM, Alex Rousskov wrote: template typename Enum EnumRangeTEnum EnumRange(Enum begin, Enum end) { return EnumRangeTEnum(begin, end); } Done. * Typical use: * for ( auto enumvalue :

Re: [squid-dev] [CODE] iterating over enums

2015-08-13 Thread Alex Rousskov
On 08/13/2015 03:20 AM, Kinkie wrote: On Wed, Aug 12, 2015 at 9:11 PM, Alex Rousskov wrote: I would encourage you to show actual Squid usage examples (besides artificial test cases), either in the patch itself or in the patch cover email. ./src/HttpHdrCc.cc:HttpHdrCcType

Re: [squid-dev] [CODE] iterating over enums

2015-08-12 Thread Kinkie
Hi Alex, it turns out that the itch is real, and this is actually going to be useful in carrying forward the HttpHeader restructuring I'm doing in lp:~kinkie/squid/coverity-fixes, to iterate over the list of header types for various purposes (compacting, etc). So I went ahead and just

Re: [squid-dev] [CODE] iterating over enums

2015-08-12 Thread Alex Rousskov
On 08/12/2015 09:36 AM, Kinkie wrote: So I went ahead and just implemented it, starting from your observations. It's a bit more complex that your proposal, as I took the chance to implement bidirectional forward and reverse iterators. The attached patch is in changeset 14235 of

Re: [squid-dev] [CODE] iterating over enums

2015-08-05 Thread Kinkie
On Thu, Aug 6, 2015 at 12:38 AM, Alex Rousskov rouss...@measurement-factory.com wrote: On 08/05/2015 09:33 AM, Kinkie wrote: I crossed the topic of enumerating over iterations. You mean iterating enum[eration]s :-) I have my thinking cap backwards ;) We kind-of follow (C-ish)best

Re: [squid-dev] [CODE] iterating over enums

2015-08-05 Thread Alex Rousskov
On 08/05/2015 09:33 AM, Kinkie wrote: I crossed the topic of enumerating over iterations. You mean iterating enum[eration]s :-) 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