operator[] returns a T& for every value of T except for bool, where it gives a reference proxy. See this old column by Herb Sutter on why using vector in generic code is bad idea (and why it is not even a container). There is also a special Item about it in Effective STL by Scott Meyers, and tons of questions on it here at SO.