Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-12-31 19:57:09


David Abrahams wrote:
> Lastly, I know that Aleksey will argue with me about this,

Yep, I will :).

> but I have a strong preference for "class" rather than "typename" in
template
> parameter lists. Aside from the fact that it's longer, "typename" is
> visually confusable because it can mean other multiple things when it
> appears between <...>:
>
> template <typename T, typename U = typename metafunction<T>::type>
>
> vs
>
> template <class T, class U = typename metafunction<T>::type>

IMO it's more a problem with the layout of template parameters than with
anything else:

    template<
          typename T
        , typename U = typename metafunction<T>::type
>
    class her;

In short, my motivation for using 'typename's here is that I perceive the
'class' keyword as rather high-weight, semantically loaded, and prefer to
use it in its only original context - that is, for declaring/defining a
user-defined type that is more than a POD. Using it in other places cheapens
the word.

That's all subjective, of course.

Just clarifying my position :).

Aleksey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk