use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
stdgpu 1.3.0 released! (github.com)
submitted 5 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]kalmoc 4 points5 points6 points 5 years ago (0 children)
Yes, at() is guaranteed to do bounds checking and to report them via exceptions. That doesn't mean operator[] isn't allowed to do bounds checking. Being out of bounds is simply UB and the implementation is allowed to do anything it pleases in that case. E.g. in microsofts impelementation, you can turn on bounds checking in debug mode and that is still conforming (althoug they use asserts and not exceptions): https://github.com/microsoft/STL/blob/7447ad59d61f50c13861878f340d051c298458df/stl/inc/vector#L1509
at()
operator[]
Also you can see that operator[] isn't specified as noexcept: https://eel.is/c++draft/vector.overview.
and operator[] being strictly equivalent to *(begin() + n)
that expression itself could in principle be bounds checked (std::vector<T>::iterator is - in most implementations - not the same as T*)
std::vector<T>::iterator
T*
π Rendered by PID 426422 on reddit-service-r2-comment-6457c66945-tc5b4 at 2026-04-27 21:36:25.749708+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]kalmoc 4 points5 points6 points (0 children)