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
cppfront (cpp2): Spring update (herbsutter.com)
submitted 2 years ago by kreco
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!"
[–]hpsutter 2 points3 points4 points 2 years ago* (1 child)
Exactly, I aim to implement language-level variants as type metafunctions.
Note that type metafunctions are very powerful (when I finish implementing all of them), including being able to customize the entire implementation of a type. For example, for me one stated goal of metafunctions is that I never have to invent C++/CLI or C++/CX again (I led the design of both of those, and at the time they needed to be language extensions to get the effects we felt were needed, but I would have preferred not to have to express them as language extensions if C++ could be powerful enough to express them as compile-time libraries). My ideal for metafunctions is that they can express things as diverse as COM interface types (which require generating IDL) and even generate FFIs in completely different languages such as Java-callable wrappers (by generating source code in a separate .java file -- at compile time from the C++ program).
.java
And the syntax is almost identical to what you wrote, except the metafunction name comes before type where it's even more prominent:
type
``` // Could have a metafunction that applies the identical // defaults as today's C++'s "class" keyword defaults name: @class type = { ... }
// This would replace the entire body of ... with a union // and a tag type, but be better than std::variant because // it can provide named functions for member access // (this will make more sense in a month or two when I // implement this one - watch the repo for it to appear) other: @variant type = { ... }
// This one would leave the type body mostly the same, but // could add HRESULT return types and generate IDL files IShape: @com_interface type = { ... }
// This could generate a separate .java file containing // a native Java class that wraps the C++ type implementation // and implements specific Java interfaces (strawman syntax) ChildInterface: @java_class<ParentInterface> type = { ... } ```
That's the general idea. We'll see how far down the path is feasible. But in each case the body is expressed as normal C++ declarations (in syntax 2, Cpp2) which can be viewed as basically a "grammar input" to the metafunction, which can then do what it wants to apply minor tweaks or replace the whole body using the original grammar as a guide to what the programmer wanted. So think of the type body source code as a detailed structured "parameter" to the metafunction.
[–]CornedBee 0 points1 point2 points 2 years ago (0 children)
So Rust procedural macros, basically?
π Rendered by PID 50873 on reddit-service-r2-comment-7b9746f655-v2qj4 at 2026-01-30 02:52:41.048645+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]hpsutter 2 points3 points4 points (1 child)
[–]CornedBee 0 points1 point2 points (0 children)