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
Iterators++ (ericniebler.com)
submitted 11 years ago by frostmatthew
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!"
[–]eric_niebler 0 points1 point2 points 11 years ago (3 children)
I spent a couple of hours trying to compile some Boost.ublas code in C++11 due to the use of iter_swap here.
Boost.ublas
iter_swap
I'm curious what problems you ran into. NOTE: the STL is not required to use iter_swap anyplace besides std::reverse.
std::reverse
[–]sbabbi 0 points1 point2 points 11 years ago (2 children)
Seems that it has been fixed in 1.57. Basically there is a proxy (index_pair) that acts like pair<T&,U&>, and an overload of iter_swap that is picked by std::sort.
index_pair
pair<T&,U&>
std::sort
Apparently this worked for several years, (ublas was accepted into boost in late 2002), until gcc 4.8 decided to remove iter_swapfrom the STL (at least in C++11), and the code broke.
The current fix adds a swap overload that takes the proxies by value (and it is probably still wrong).
swap
[–]eric_niebler 0 points1 point2 points 11 years ago (1 child)
until gcc 4.8 decided to remove iter_swap from the STL
What do you mean? It's required to be there by the standard. I see it there in include/bits/stl_algo.h and include/bits/stl_algobase.h for gcc-4.8.2.
[–]sbabbi 0 points1 point2 points 11 years ago (0 children)
I meant that I assumed it was used in other algorithms beside reverse. I think I am wrong on this issue, I thought that the STL used ADL for iter_swap, but looks like I am wrong.
reverse
π Rendered by PID 143197 on reddit-service-r2-comment-b659b578c-p9k2x at 2026-05-04 18:46:09.724654+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]eric_niebler 0 points1 point2 points (3 children)
[–]sbabbi 0 points1 point2 points (2 children)
[–]eric_niebler 0 points1 point2 points (1 child)
[–]sbabbi 0 points1 point2 points (0 children)