- Right-angle brackets: Goodbye to those annoying spaces between two right-angle brackets: Go for
Code: Select all
std::vector<std::vector<int> > v;
instead.Code: Select all
std::vector<std::vector<int>> v;
- Type deduction: Using auto to let the compiler deduce the type of an expression. Instead of typing
we can now say
Code: Select all
std::map<std::string, int> m; for (std::map<std::string, int>::iterator it = m.begin(); ...)
Needless to say, that saves a lot of typing. (Yes, g++ does support the __typeof extension, but it's... well, an extension.)Code: Select all
for (auto it = m.begin(); ...)
- Unordered versions of std::set and std::map: The headers <unordered_set> and <unordered_map> provide access to unordered versions of sets and maps, which are amazingly fast given that they don't keep their elements in order.