> q;" and "vector > q;" I get a compilation error from the first, but ...">

What is the difference between "vector <pair <int, int >> q;" and "vector <pair <int, int >> q;"

I get a compilation error from the first, but the latter works just fine.

error: '→ should be' → in the list of template nested arguments

thanks

+4
source share
2 answers

Before C ++ 11, you had to use spaces to separate angle brackets in nested templates - otherwise the compiler interpreted it as a shift operator to the right "→". In C ++ 11, you can omit the space, and it will be interpreted as brackets.

However, some compilers (for example, MSVC ++) ignore the standard and allow you to bypass the gap, even if you do not use the C ++ 11 standard.

+4

( ) ++ 98 ++ 03 " → " " ", , , .

++ 11, " → ", , . ( , .)

( ++ 11 <::foo "" ( , ) , <: [.)

+9

Source: https://habr.com/ru/post/1612036/


All Articles