
Posted:
Jul 12, 2003 @ 12:41am
by Guest
Thank you so much PejoSoftware! It works perfectly now on both compilers.
I got my syntax in my first post from a book called "C++ Template: The Complete Guide" by Vandevoorde and Josuttis.
By the way, you can do this
list<vector<int>>
you just need spaces between vector and list
list< vector<int> >

Posted:
Jul 13, 2003 @ 4:44am
by Kzinti
The holy standard specifies that parsing should eat as many characters as possible when generating tokens. "<" is parsed as a "<" token. ">>" is parsed as a ">>" token.
Later on, the sementic analyser will differentiate "<" used in a template syntax from an operator "<". It can do so using the context.
When the sementic analyser see ">>" it is already too late. ">>" will then be interpreted as an operator as there is no other possibility. The sementic phase is not allowed to split the token into ">" + ">".
Any compiler that doesn't work that way is not standard compliant. It is a really known "problem", just live with it.