Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2005-04-01 17:41:20


Bruce Trask <Bruce.Trask_at_[hidden]> writes:

> The syntax of the SWITCH I was referring to is the one on page 439 of
> Generative Programming. I.e.
>
<snip>
>
> with the usage syntax of
> SWITCH<ti, CASE<one, First, CASE<two, Second, CASE<three, Third> > >
>>::RET::func();
>
> Am I missing what you are saying here?

Where?

> My real code is a hair more complicated but even so,
> I guess this is the heart of my question and it stems from page 62 of
> C++ Template Metaprogramming section on Type Selection, where you and
> Aleksey talk about the alternative of using classes with mnemonic names
> versus ad hoc template specializations.
>
> So my question is, do you guys have a rule of thumb for going with ad
> hoc specializations versus using metafunctions with mnemonic names or is
> it just whether is reads better at the point of the call?

Personally, I do the latter, though ad hoc specializations will tend
towards being harder to read so even that informal rule leads to
avoiding specializations. Sometimes I'm also trying to accomodate
broken compilers where partial specialization doesn't work, so I end
up avoiding them for that reason as well.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net