Why use non-member begin and end functions in C++11?

Every standard container has a begin and end method for returning iterators for that container. However, C++11 has apparently introduced free functions called std::begin and std::end which call the begin and end member functions. So, instead of writing auto i = v.begin(); auto e = v.end(); you’d write auto i = std::begin(v); auto e = … Read more

Why can’t I make a vector of references?

When I do this: std::vector<int> hello; Everything works great. However, when I make it a vector of references instead: std::vector<int &> hello; I get horrible errors like error C2528: ‘pointer’ : pointer to reference is illegal I want to put a bunch of references to structs into a vector, so that I don’t have to … Read more