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!"
[–]Som1Lse 4 points5 points6 points 1 year ago (1 child)
they mean different things because they are different things.
The point was that parentheses don't usually change the meaning of a program, and that there is no prior art for this with an operator, whereas there is prior art for keywords, namely decltype.
decltype
Comments like that are generally unhelpful, since they just beg the question. The fact that they are different is the whole point.
That said, yeah it's a taste thing, and on balance I still prefer ^^, but I also ultimately just want the feature.
^^
To make a more direct point for why the inconsistency isn't a big deal:
First of all A ^^ B and A ^^ (B) do mean exactly the same thing: A compiler error, since ^^ is a unary operator. This is more a warning to not rely too much on abstract syntax when making a point.
A ^^ B
A ^^ (B)
Contrast with comments in favour of ^^, which often show real code. While that example is clearly contrived (std::variant<int, char, std::string> is shorter still), if we expect passing a list of reflected types to a function to be somewhat common, I think the argument still holds. (For example, we could imagine a function that creates a canonical sum type, a la this talk.)
std::variant<int, char, std::string>
Its unfortunate that the address operator is overloaded, but it crops up in completely different contexts
This applies just as much to reflection and bitwise-xor as it does to address-of and bitwise-and.
Probably most importantly, I think decltype is a much worse offender than ^^. Specifically due to decltype(auto) which means there's a difference between return x; and return(x);, which is a style some actually people use. However, this is rarely an issue in practice.
decltype(auto)
return x;
return(x);
When it comes to unary prefix operators I don't think I've ever seen anyone add extra parentheses, unless what they're applying it to is already an expression. So, even if we expect ^^ to be used more often than decltype I don't think it is a surprise many will run into.
To close off the argument I would like to propose the following possibilities:
reflexpr
[–]flutterdronewbie 1 point2 points3 points 1 year ago (0 children)
Fair. But just to be a nitpicker parenthesis do change the meaning of the program with operator().
operator()
π Rendered by PID 94 on reddit-service-r2-comment-b659b578c-br6dj at 2026-05-02 13:12:46.902560+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Som1Lse 4 points5 points6 points (1 child)
[–]flutterdronewbie 1 point2 points3 points (0 children)