Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > ****t to gcc-4....
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 45705 of 48612
Post > Topic >>

****t to gcc-4.3 (template template issue)

by "ndbecker2@[EMAIL PROTECTED] " <ndbecker2@[EMAIL PROTECTED] > May 2, 2008 at 04:19 AM

On upgrading from gcc-4.1.2 to gcc-4.3, this (stripped down) code is
now
rejected:

#include <vector>
#include <iostream>

template<typename T, template <typename A> class CONT=std::vector>
class Ring {

};


template<typename Cont>
inline std::ostream& operator<<(std::ostream& os, const Ring<Cont>& r)
{
  os << '[';
  os << ']';
  return os;
}
g++ -c test1.cc
test1.cc:11: error: type/value mismatch at argument 2 in template
parameter
list for  template<class T, template<class A> class CONT> class Ring
test1.cc:11: error:   expected a template of type  template<class A>
class
CONT , got  template<class _Tp, class _Alloc> class std::vector

What is a reasonable way to fix this?  The problem is that the 2nd
parameter
says

template<typename A> class CONT, which doesn't match std::vector
because it
has an optional 2nd parameter (class _Alloc).

I don't want to only match class CONT with those having a 2nd
parameter
(class _Alloc) - that is too restrictive.
 




 3 Posts in Topic:
Port to gcc-4.3 (template template issue)
"ndbecker2@[EMAIL PR  2008-05-02 04:19:16 
Re: Port to gcc-4.3 (template template issue)
dizzy <dizzy@[EMAIL PR  2008-05-02 14:55:07 
Re: Port to gcc-4.3 (template template issue)
"ndbecker2@[EMAIL PR  2008-05-02 05:08:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 15:34:10 CST 2008.