template

F

Fraser Ross

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.
 
K

Kai-Uwe Bux

Fraser said:
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?

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


Best

Kai-Uwe Bux
 
F

Fraser Ross

"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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top