Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-01-08 17:35:50


Dan W. wrote:
> Daniel Wallin wrote:
>
>> 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 ^^^^
>> };
>
>
> template<class T>
> struct A : private B< A<T> >
> {
> private:
> //no typedefing OR typenaming,
> //as trigobj is not for export;
> //--just using type as in...
> type _typo;
> public:
> //or...
> void f()
> {
> type a_typo;
> }
> //isn't this compliant?
> ...
> };

I don't know what you are doing here, but it isn't the same thing that
you are doing in your invariants<> class. Just try compiling your own
examples with a standard conforming compiler. The nested trigobj class
needs to be referenced with typename if used in a class template.

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

   template<class T>
   struct A : B<A<T> >
   {
      void f()
      {
          /* typename */ B<A<T> >::type x;
          /* ^^^^^^^^ needed here */
      }
   };

   int main()
   {
      A<int> y;
      y.f();
   }

You can try this example, which does the same thing that your code
does, out at:

   http://www.comeaucomputing.com/tryitout/

-- 
Daniel Wallin

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