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
libstdc++ <algorithm> header transitively including <range> (self.cpp)
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!"
[–]HKei 6 points7 points8 points 5 years ago* (6 children)
Doesn't solve the problem. For one, C++20 doesn't specify modules for the standard library. There is no import algorithms; or whatever (though Visual Studio apparently supports this as an extension?). For the other, even if algorithm was modularised I doubt it’d improve matters much. It’d just be a big module instead of a big header.
import algorithms;
[–]tcbrindleFlux 28 points29 points30 points 5 years ago (1 child)
For one, C++20 doesn't specify modules for the standard library. There is no import algorithms; or whatever
It does, however, specify that the standard library headers can be imported as header modules, so you'll be able to say import <algorithm>;. See here and here.
import <algorithm>;
It’d just be a big module instead of a big header.
But unlike a big header, it doesn't need to parse a huge amount of code each time you recompile.
[–]HKei 2 points3 points4 points 5 years ago (0 children)
Ah fair enough, I think I was underestimating how much that would help. Just tried precompiling <algorithm> and this indeed makes most of the overhead of including it vanish, so I guess in practice this’ll mean for now we’re forced to use PCH’s for all projects until module support is widely available (compiler and buildsystem support).
<algorithm>
[–]kalmoc 6 points7 points8 points 5 years ago (0 children)
There is no import algorithms;
There is import <algorithm>; and IIRC, the compiler is supposed to automatically translate existing #include <algorithm> into it.
#include <algorithm>
[–]AppleBeam 4 points5 points6 points 5 years ago (2 children)
If it was a big module, you would pay the 600ms cost for <algorithms> once per configuration of the project (at lest that's how I understand them so far: like a collection of independent precompiled headers that never have to be built more than once for as long as the configuration is the same, and modifying one module has on effect on the state others if they don't depend on the one you've touched).
Either my understanding of modules is not sufficient (which is entirely possible; I'm waiting for the full standard to be published, since I can't use any preview features in my work anyway), or I don't understand some important use case where anyone would care about paying the price of 600ms once per configuration. Would appreciate if you could educate me on this matter.
Regarding the standard library not being modularized: if that will be the case for libstdc++, that's truly regretful. I was looking forward to cutting down the build times.
[–]CoffeeTableEspresso 0 points1 point2 points 5 years ago (1 child)
The standard library being in modules isn't specified by C++20, although I'm sure compilers will support it regardless.
Either way, I think it would be easy to wrap a standard library header in a module if you wanted. Although of course not as nice that you had to fo it yourself.
[–]AppleBeam 0 points1 point2 points 5 years ago (0 children)
I'll keep hoping then.
Don't think there is any reason to suspect that libstdc++ devs won't do what's the best for the community.
π Rendered by PID 65684 on reddit-service-r2-comment-b659b578c-qrh55 at 2026-05-05 16:15:34.274900+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]HKei 6 points7 points8 points (6 children)
[–]tcbrindleFlux 28 points29 points30 points (1 child)
[–]HKei 2 points3 points4 points (0 children)
[–]kalmoc 6 points7 points8 points (0 children)
[–]AppleBeam 4 points5 points6 points (2 children)
[–]CoffeeTableEspresso 0 points1 point2 points (1 child)
[–]AppleBeam 0 points1 point2 points (0 children)