Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-01-08 15:12:10


Dan W. wrote:
> Daniel Wallin wrote:
>
>> Dan W. wrote:
>>
>>> I don't understand: If my derived class would be foo< int, bar >,
>>> I'd end up with invariants< foo< int, bar > >::trigobj, and I'm not
>>> sure what the problem is with that. The thired class, "my_class3" in
>>> the test program is exactly like that, BTW.
>>
>>
>> You should probably try that with a standard conforming compiler.
>>
>> invariants<my_class<I, J> >::foo
>>
>> is a dependent name, and should be:
>>
>> typename invariants<my_class<I, J> >::foo
>>
>> But that's impossible to deduce. So either your solution will work with
>> class templates only, or non-templates only.
>
>
> I still don't get it. Class my_class knows its own type, whether
> template or not, and knows about class invariants< my_class >, since it
> is inheriting it. Do you mean in the case that some other class would
> need to refer to trigobj? That could not happen since I'm inheriting the
> invariants class privately.

Consider:

   template<class T>
   struct B
   {
       struct type {};
   };

   template<class T>
   struct A : B<A<T> >
   {
       typedef typename B<A<T> >::type type;
        dependent, needs typename ^^^^
   };

Please try this with a more conforming compiler than the one you are
using.

-- 
Daniel Wallin

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