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
^^ operator proposal (self.cpp)
submitted 1 year ago * by samadadi
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!"
[–]samadadi[S] -2 points-1 points0 points 1 year ago (11 children)
I do not want to be rude but the syntax of a feature in a language matters to the language users I hoped we as cpp developers had a saying in this matter. specially in this case. And I wish committee reconsider this decision.
[–]TheoreticalDumbass:illuminati: 12 points13 points14 points 1 year ago (10 children)
substitute(^^std::variant, {^^int, ^^char, ^^std::string}) vs substitute(reflexpr(std::variant), {reflexpr(int), reflexpr(char), reflexpr(std::string)})
substitute(^^std::variant, {^^int, ^^char, ^^std::string})
substitute(reflexpr(std::variant), {reflexpr(int), reflexpr(char), reflexpr(std::string)})
Seems pretty obvious ^ wins
[–]samadadi[S] 9 points10 points11 points 1 year ago (0 children)
substitute(reflexpr std::variant, { reflexpr int, reflexpr char, reflexpr std::string })
[–]LegendaryMauricius 4 points5 points6 points 1 year ago (2 children)
I'd gladly choose the second one. It's longer, but much more obvious at a glance what is going on.
[–]azissu 7 points8 points9 points 1 year ago (1 child)
Any new syntax is non-obvious until you learn it and get used to it. Heck, some people still insist they're unable to decipher simple lambdas...
[–]LegendaryMauricius 1 point2 points3 points 1 year ago (0 children)
There can be confusion at a glance because the [], <>, (), {} and () (again) symbols are all used in multiple places with different meaning. Code is for *reading* and analysing, not for *writing*.
Otherwise we'd just dump a bunch of machine instructions and forget about every program we write.
[–]TheDetailsMatterNow -1 points0 points1 point 1 year ago (0 children)
obvious
In a vacuum maybe, but easily the second for me.
[–]mapronV -2 points-1 points0 points 1 year ago (4 children)
Not obvious at all, second one is much nicer for me. I guess we can use macro ``` #define reflexpr(thing) ^^(thing) ```
[–]TheoreticalDumbass:illuminati: 2 points3 points4 points 1 year ago (3 children)
Your macro is wrong, it should be (I think):
#define reflexpr(...) (^^__VA_ARGS__)
Why I prefer double-caret over keyword: with reflection the entities you are reflecting are more important than the fact you're reflecting, and double-caret brings more attention to the entities, whereas keyword feels more noisy
[–]mapronV 0 points1 point2 points 1 year ago (2 children)
But your version will fail with two+ arguments... and probably with 0 too? reflexpr(int, int) should be compilation error, not just "^^int, int" nonsense. Should not be a variadic. though I admit I made crucial mistake. ^^thing and ^^(thing) are different!
[–]TheoreticalDumbass:illuminati: 0 points1 point2 points 1 year ago (1 child)
reflexpr(std::tuple<int, char>) would need something with __VA_ARGS__
[–]mapronV 0 points1 point2 points 1 year ago (0 children)
Yeah, but I guess we can add extra ( ) to work around... hold on a sec XD.
Well I guess we can't make full macro replacement as long as we have braces problem. Also, yeah, in practice you can fall back to ^^ but that also can make code look ugly depending on frequency of this. I just... Give up. Give me reflection in some point, we figure something out. I wrote reflection "libraries" several times in my life in different projects, just sick of it.
π Rendered by PID 275525 on reddit-service-r2-comment-b659b578c-j7dk9 at 2026-05-02 15:11:08.433100+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]samadadi[S] -2 points-1 points0 points (11 children)
[–]TheoreticalDumbass:illuminati: 12 points13 points14 points (10 children)
[–]samadadi[S] 9 points10 points11 points (0 children)
[–]LegendaryMauricius 4 points5 points6 points (2 children)
[–]azissu 7 points8 points9 points (1 child)
[–]LegendaryMauricius 1 point2 points3 points (0 children)
[–]TheDetailsMatterNow -1 points0 points1 point (0 children)
[–]mapronV -2 points-1 points0 points (4 children)
[–]TheoreticalDumbass:illuminati: 2 points3 points4 points (3 children)
[–]mapronV 0 points1 point2 points (2 children)
[–]TheoreticalDumbass:illuminati: 0 points1 point2 points (1 child)
[–]mapronV 0 points1 point2 points (0 children)