Thread overview
new C++ 8.29.13 beta
Jul 21, 2002
Walter
Jul 21, 2002
Christof Meerwald
Jul 21, 2002
Christof Meerwald
Jul 22, 2002
John Fletcher
July 21, 2002
More template bugs fixed (thanks Christof!). Rewrote most of the partial specialization matching code.


www.digitalmars.com/dmc/dmcppDownload.html




July 21, 2002
A simple "std::cout << "Hello world" << std::endl;" using STLport's iostreams seems to be a good test-case:

template<class T>
struct A
{ };

template<class T>
struct B
  : public A<T>
{
  typedef A<T> &(*f1_t)(A<T>&);
  typedef B<T> &(*f2_t)(B<T>&);

  B<T> &operator<<(f1_t f) { f(*this); return *this; }
  B<T> &operator<<(f2_t f) { return f(*this); }
};

template <class T>
B<T> &f(B<T> &a)
{
  return a;
}

int main(int argc, char *argv[])
{
  B<char> a;

  a << f;
  // Error: ambiguous reference to symbol
  // Had: B<char >::operator <<(A<char >&(*C func)(A<char >&))
  // and: B<char >::operator <<(B<char >&(*C func)(B<char >&))

  return 0;
}


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw@jabber.at mailto cmeerw at web.de

...and what have you contributed to the Net?
July 21, 2002
DM seems to get confused by the first two operators:

template<class T, class T2>
struct A
{ };

template <class T, class T2>
int operator<<(A<T, T2>& a, const T *s)
{
  return 1;
}

template <class T, class T2>
int operator<<(A<T, T2> &a, const char *s)
{
  return 2;
}

template <class T2>
int operator<<(A<char, T2> &a, const char *s)
{
  return 0;
}


int main(int argc, char *argv[])
{
  A<char, int> a;

  return a << "";
  // Error: ambiguous reference to symbol
  // Had: operator <<(A<>&,char const *)
  // and: operator <<(A<>&,char const *)
}


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw@jabber.at mailto cmeerw at web.de

...and what have you contributed to the Net?
July 22, 2002

Walter wrote:

> More template bugs fixed (thanks Christof!). Rewrote most of the partial specialization matching code.
>
> www.digitalmars.com/dmc/dmcppDownload.html

Wow, these come so fast I can't keep up.  Thanks.

BTW the web page says the files are 800,000 bytes but they are actually a lot smaller.

John