Vectors

When using vectors, is it better to use vectorName.at(i) or vectorName[i] to get values at an index?
closed account (zb0S216C)
Use at( ) when possible. With at( ) an out-of-range exception is thrown if you go too far, allowing the application to recover if the exception is caught. The sub-script operator doesn't throw exceptions.

Wazzak
Last edited on
Thanks.
Topic archived. No new replies allowed.