Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > template

Reply
Thread Tools

template

 
 
Fraser Ross
Guest
Posts: n/a
 
      09-12-2005
I cannot compile this:
template <typename T1=char,
template <typename, typename> class T2=std::basic_ifstream>
struct X {
T2<T1, std::char_traits<T1> > inputFileStream_;
T2<T1, std::char_traits<T1> >& UseInputFileStream() {
return inputFileStream_;
};
};

I get an internal compiler error with the function. Have I missed the word
typename anywhere? The compiler would probably accept code without typename
anyway. Is this a compiler bug?

Fraser.



 
Reply With Quote
 
 
 
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      09-12-2005
Fraser Ross wrote:

> I cannot compile this:
> template <typename T1=char,
> template <typename, typename> class T2=std::basic_ifstream>
> struct X {
> T2<T1, std::char_traits<T1> > inputFileStream_;
> T2<T1, std::char_traits<T1> >& UseInputFileStream() {
> return inputFileStream_;
> };
> };
>


Compiles fine with g++ after adding #include<iostream>.


> I get an internal compiler error with the function. Have I missed the
> word
> typename anywhere? The compiler would probably accept code without
> typename
> anyway. Is this a compiler bug?


"Internal compiler error" usually says the compiler died on you. In my book,
that qualifies as a compiler bug.


Best

Kai-Uwe Bux

 
Reply With Quote
 
 
 
 
Fraser Ross
Guest
Posts: n/a
 
      09-12-2005

"Kai-Uwe Bux"
> "Internal compiler error" usually says the compiler died on you. In my

book,
> that qualifies as a compiler bug.


Thats what I said too. I've had to put a workaround in my class templates.

I was wondering why std::vector for instance has an allocator as a type
parameter and not a template template parameter. Is it merely because
template template parameters were not in the language or weren't widely
supported?

Fraser.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
r H2 deduce deduce template argument of a template class inheritingfrom a non template base? nguillot C++ 5 03-08-2009 05:56 PM
How to use the template member function of a template in the memberfunction of another template class? Peng Yu C++ 3 10-26-2008 03:51 PM
template template arguments: expected a class template, got `Component<T1, T2, T3> gary.bernstein@gmail.com C++ 1 06-08-2007 07:10 AM
Re: A Newbie Question about template template template tom_usenet C++ 0 07-24-2003 12:06 PM
Re: A Newbie Question about template template template Chris Theis C++ 2 07-24-2003 09:42 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57