I realize there are better compilers out there but I have preferred to stick with vc6, every once in a while, I find weird flukes and was wondering if this one is localized to my installation or everyone's.
Keep in mind that the compiler in question is:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
(the linker, etc not relevant since this question doesnt seem to involve them)
Tried declaring a class inheriting from std::vector, which works fine, unless you also try to be specific with defining the second template parameter:
10: class foo : public std::vector<LPTSTR,std::allocator<LPTSTR>>
11: {
12: public:
13: foo();
14: ~foo();
15: };
does not compile and gives this error: c:\foo\foo.h(10) : error C2143: syntax error : missing '>' before '{'
now, the real question is, WHY is this legal:
10: class foo : public std::vector<LPTSTR,std::allocator<LPTSTR>>>
11: {
12: public:
13: foo();
14: ~foo();
15: };
note the extra >
at the end of line 10... and what I want to know is:
I tried to research this as much as possible but as most programmers know it isn't so easy to search online because the search engines seem far to limited without even regular expression searches it becomes hit-or-miss and/or a popularity contest (is the topic of interest popular enough to be ranked up on Google, etc).
I thank you much in advance for your prompt (or even not prompt) reply on this one. I try to answer questions to others even if it seems ridiculously easy to me and try to remember knowledge always starts with lack of knowledge.
It probably means that your compiler isn't parsing the >>
symbol as you expect, i.e it isn't supporting C++11 in this respect.
Try this
std::vector<LPTSTR,std::allocator<LPTSTR> >
^ note space
and also read up on why it might not be a good idea to inherit from a standard library container.
As for the question "why is >>> legal", well, it isn't legal at all, not on C++03, not on C++11. I can only conclude that it is a feature of your compiler.