
Jeremiah Willcock wrote:
On Mon, 12 Dec 2011, Larry Evans wrote:
On 12/12/11 17:04, Larry Evans wrote:
On 12/12/11 16:39, Jeremiah Willcock wrote: [snip] Looking at your code, it seems you solved the problem by removing the nested specialization of is_end, with a specialization in file scope of check_unless_end. I've a vague memory of hearing some similar solution elsewhere. Is there some reason why specializations cannot occur within the class?
-regards, Larry
The reason is explained in this thread:
http://groups.google.com/group/comp.lang.c++.moderated/browse_frm/thread/c04...
I don't see anything in that thread that talks about why member templates can't be specialized in-class. I don't see a good reason for that limitation; how is a class member specialization different from one in a namespace other than that there can be template parameters on the class itself?
-- Jeremiah Willcock
First of all I want to thank everyone who contributed to this thread. I
carefully read
every single message and the links. I was really lost.
I was really bothered with the idea that the template specialization would
work
outside the class but not in it - as you were. The links didn't seem on
point on
this subject. I took my original solution and moved the specializations
outside
the class. This failed because the I wasn't defined so I added it do the
template
arguments. Then a few syntax corrections and it started to work - OK,
problem solved - but now I was left with this really annoying feature whose
behavior changed when the specialization was moved out side the class. So
I moved it back in - and voila - worked as expected. Here is my solution:
template<typename I>
struct ForwardIterator {
template