In C++03 ">>" is always interpreted as right shift operator. It causes problem for nested template declaration like here:
In above example for C++03 we have compilation error because of unintended interpretation of ">>". Compiler interpret it as right shift operator - not like two nested vectors. Proper syntax in above situation should include space character between two ">" characters closing nested templates like here:
It it not very comfortable and sometimes causes problems with finding reason of compilation error. Fortunately, C++11 standard solves that problem. It implements proper interpretation of nested templates without space between two right angle operators ">". Therfore in C++11 following syntax:
is properly interprated as two nested vectors.
In above example for C++03 we have compilation error because of unintended interpretation of ">>". Compiler interpret it as right shift operator - not like two nested vectors. Proper syntax in above situation should include space character between two ">" characters closing nested templates like here:
It it not very comfortable and sometimes causes problems with finding reason of compilation error. Fortunately, C++11 standard solves that problem. It implements proper interpretation of nested templates without space between two right angle operators ">". Therfore in C++11 following syntax:
is properly interprated as two nested vectors.
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteI like that change very much. It was very anoying syntax for nested templates in previous C++ version.
ReplyDelete