Forward declarations of template specilizations.

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Nov 16 08:11:48 PST 2008


On Sun, Nov 16, 2008 at 3:14 AM, Christian Kamm
<kamm-incasoftware at removethis.de> wrote:
>> I have an interesting issue, that makes me curious on how D handles it.
>>
>> (Traits template code)
>
> You cannot spread out template specializations across modules. If you define
>
> template Trait(T : S); in a.d and
> template Trait(T : C); in b.d and try to use
> alias Trait!(S) sinst; in use.d, you'll get
> Error: a.Trait(T : S) at a.d(3) conflicts with b.Trait(T : C) at b.d(3)
>
> because the two Traits live in separate scopes. This makes C++ style trait
> templates just not work in D.
>
> Does anyone know an equivalent?

Do D2's overload sets solve this, or are those for functions only?



More information about the Digitalmars-d mailing list