Right angle brackets
Use case
Nested templates without extra spaces.
Explanation
Before C++11, >> in nested templates was parsed as right-shift operator, requiring a space (vector<int> >).
Code
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>
int main() {
std::map<uint64_t, std::vector<int>> data;
data.emplace(0x1000, std::vector<int>{1, 2});
data.emplace(0x2000, std::vector<int>{3});
for (const auto &e : data) {
std::cout << "0x" << std::hex << e.first << " : " << e.second.size()
<< " items.\n";
}
return 0;
}
Output
$ ./src/c++11/build/right-angle-brackets
0x1000 : 2 items.
0x2000 : 1 items.