[squid-dev] [CODE] iterating over enums

Alex Rousskov rousskov at measurement-factory.com
Thu Aug 13 21:39:31 UTC 2015


On 08/13/2015 03:20 AM, Kinkie wrote:

> On Wed, Aug 12, 2015 at 9:11 PM, Alex Rousskov wrote:
>       template <typename Enum>
>       EnumRangeT<Enum> EnumRange(Enum begin, Enum end) {
>           return EnumRangeT<Enum>(begin, end);
>       }


> Done.


>  * Typical use:
>  * for ( auto enumvalue : EnumRangeT<EnumType>(EnumType::somevalue,
>  *                        EnumType::someOtherValue) )
>  * { do_stuff(); }


Sorry, forgot to mention: This "typical usage" example should probably
be adjusted and moved to EnumRange() because using EnumRangeT directly
ought to be _atypical_.

Alex.



More information about the squid-dev mailing list