[squid-dev] [RFC] Refactor HttpHeader

Alex Rousskov rousskov at measurement-factory.com
Thu Jul 30 16:42:25 UTC 2015


On 07/30/2015 01:44 AM, Kinkie wrote:

> headerDescription: a std::vector keyed by header ID containing header type

HeaderDescriptions (plural) then.


> template <typename EnumType>
> typedef struct LookupTableRecord
> {
>    const char *name;
>    EnumType id;
> }

Please avoid "struct" whenever possible. Typing "public:" once is better
that always remembering whether to search for and forward-declare a
"struct Foo" or a "class Foo".


> template<typename Enumtype, typename RecordType =
> LookupTableRecord<EnumType> >
> class LookupTable
> {
>    //...
> }
> 
> This would make it so that someone could define a custom Record type,
> and as long as that record type matches the signature of
> LookupTableRecord, LookupTable won't care.

Do not add that template parameter until you actually need to customize
the record type. If you end up using this design, just typedef Record to
be LookupTableRecord.


HTH,

Alex.



More information about the squid-dev mailing list