The Unclear Impact

Today I learned that "" is an operator in C++ and it can be overloaded.

I thought clangd had a bug when it showed me operator"" _icon

@be i vaguely recall playing with a GCC extension in some homework at uni that allows you to make a template <typename Char, Char... Xs> operator""_ and takes the characters of the literal for you to metaprogram with. (for reasons, i implemented a recursive descent parser as a template metaprogram that makes the type of the string literal vary based on the contents of the literal blobfoxcomputerowo )

my homework had -Wgnu-string-literal-operator-template in it to compile with clang++, but I can’t find anything about that in current docs

hopefully, the lack of docs means that this extension never got standardized


@kristof That's so cursed.

@be this for a symbol?


Ok, I give up...I can't read it.

Next time C++ allows overloading null - that would be fun...😶

@janriemer let's overload nullptr to... wait, it's already null. Dang, how do we get rid of it??? :P

@be That makes me wonder how a regular human brain can have a valid mental model for C++ code.

@civodul String literal? Oh no, that's the input to the string literal operator which makes the actual string literal.

@be I don't believe you