I knew that if we don't put space after closing angle brackets in a variable declaration, C++ throws the following error.
‘>>’ should be ‘> >’ within a nested template argument list
But the error doesn't come if I use #define like in this code. Can someone explain me this?
I think #define is just a macro expansion and works like find-replace, so both the ways of declaring variable here should be identical.
Also this error doesn't occur if I compile it with C++11.
#include <bits/stdc++.h> using namespace std; #define vi vector<int> int main(){ //Doesn't work, compile error vector<vector<int>> v; //Works vector<vi> vv; }
>>became valid, via a special rule, because the space requirement was such an annoyance.cppover the file, you can see that a space is added between the two>characters.test.cc:1:10: fatal error: 'bits/stdc++.h' file not found.