also, can one index std::vector using []? I also always thought one could, but then, it, for some reason, stopped working for me, so, I started using std::vector::at().
Just a pointer, but, might not be a problem for you after all.
Aha! Can you explain what that means. Do you mean unchecked, as you could also access information that is "out of bounds", so, it would just return "rubbish", I guess? Or, something else?
Checked verses unchecked means whether the index value is checked to be inbounds. One can use an out of bounds index with []. at() checks that index value is < size(). Slightly slower, but safer.
Do you mean unchecked, as you could also access information that is "out of bounds", so, it would just return "rubbish", I guess?
Unchecked as in it will assume you know what you're doing and let you shoot yourself in the foot. The usual term used to describe behavior for using out of bound indices is "undefined behavior."
If you're using VC++, even [] is checked in debug mode - using an invalid index will trigger a debug assertion. If I disable that and use the following code, with unchecked_out_of_bounds_access uncommented, the program will crash.