$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2008-01-11 06:25:10
Doug Gregor wrote:
> On Jan 10, 2008, at 3:40 PM, Michael Fawcett wrote:
>> My questions are - when creating your own library, when do you choose
>> nested typedefs over a traits class,
>
> Never.
>
>> and what effects does it have on
>> a library user, both from a usability and extensibility point of view.
>> What questions do you ask yourself to come to a decision?
>
>
> Traits classes are far better than nested typedefs, because one can
> always specialize a traits class for an existing type---even if you
> can't modify the type because it is built-in or comes from another
> library that you can't modify.
>
Type members are inherited by derived classes -- traits specializations
are not. So I don't think it's generally true that either one is better
than the other -- it depends on what you're trying to achieve.
Regards,
Tobias