cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Vectors
Vectors
Jun 18, 2011 at 5:18pm UTC
Zking773
(3)
When using vectors, is it better to use vectorName.at(i) or vectorName[i] to get values at an index?
Jun 18, 2011 at 6:15pm UTC
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
Jun 18, 2011 at 6:16pm UTC
Jun 26, 2011 at 2:20am UTC
Zking773
(3)
Thanks.
Topic archived. No new replies allowed.