4 ms·
To me it's the ^^, like in ``` void print_members(T const& obj) { [:expand(nonstatic_data_members_of(^^T)):] ``` What is this ^^?
by Aardwolf 2y ago
To me it's the ^^, like in
```
void print_members(T const& obj) {
[:expand(nonstatic_data_members_of(^^T)):]
```
What is this ^^?
- edflsafoiewq 2y agoIt's the reflection operator. Reflection is supposed to be part of the yet-unreleased C++26, so it's not surprising you don't know it.
- pjmlp 2y agoIt was supposed to be only one ^ however it conflicts with Objective-C blocks, so they ended up settling on two ^^. However many of us would have prefered reflect(T), but again many on WG21 seem to use notepad for programming and don't like to type. It means the reflection data of the type.
- misnome 2y ago> however it conflicts with Objective-C blocks, so they ended up settling on two ^^. Which… were never added to C++, right? What a mess.
- pjmlp 2y agoNo, they are Objective-C only, and since there is this thing called Objective-C++, where one can combine Objective-C and C++ on the same source file, an alternative had to be chosen. Personally I would rather have reflect.
- saelthavron 2y ago> it conflicts with Objective-C blocks Why does that matter? > many of us would have prefered reflect(T), but again many on WG21 seem to use notepad for programming and don't like to type. I don't know about anyone else, but I find reflect(T) much easier to type than ^^T. I have a high error rate on hitting 6. Not only that I have to move my hand from the home row to hit it.
- pjmlp 2y agoIt matters to Apple, and those on WG21 that work on Apple platforms. Ultimetely that is how ISO driven languages work, features get decided by those willing to join the process, and vote on what features become part of the next language standard.
- jcelerier 2y ago> Why does that matter? https://github.com/search?q=lang%3AObjective-C%2B%2B+&type=repositories https://github.com/search?q=lang%3AObjective-C%2B%2B+&type=r... all of those would instantly break. I develop a C++ / Qt software that also ships on macOS and some parts of the macOS API are only realistically useable from Obj-C / Obj-C++ so any C++ software that wants deeper integration with the OS there must work with Objective-C++.
- deleted 2y ago[deleted]
- greatgib 2y agoGood news, c++ and brainfuck languages will soon be able to merge in a single language :-)