Boost logo

Boost :

From: Csaba Szepesvari (szepes_at_[hidden])
Date: 2000-10-19 09:54:02

> I'm going to assume now that you're using MSVC, which won't compile the
> above. Trying to think of a workaround... um... I dunno! Anyone else got
> some bright ideas? The best kind of solution would be only included for
> MSVC, and written so no code would have to change when/if MSVC fully
> supports member templates. For anyone who has MSVC out there, how does
> their std::auto_ptr handle this?
> -Steve

Even in MSVC (VC6.4), you can have member templates of templates if those are
implemented inline (this also held for VC5.3)

E.g. this compiles and runs:

struct B
  B() : i(0), j(1) {};
  int i;
  int j;

struct D : public B
  D() : k(2) {};
  int k;

template <typename T1>
struct A
  template<typename T2> f( T2 t2 ) { t1 = T1(t2); };

  template<typename T2> g( A<T2> a ) { t1 = T1(a.t1); };

  T1 t1;

void main()
  A<B> a1;
  A<D> a2;

  a1.f( D() );

  a1.g( a2 );

Am I talking rubbish??

- Csaba

Boost list run by bdawes at, gregod at, cpdaniel at, john at