http://en.cppreference.com/w/cpp/experimental/observer_ptr
finally, a new C++ pointer type that is literally just a regular pointer that is referred to differently for no reason. i'm in heaven
@ninjawedding @revenant @er1n b-but wait, what ever was wrong with good 'ol std::valarray<*is mobbed off stage*
@revenant this is the most c++ thing I've ever read tbh
@revenant and this is in *addition* to both optionals and references? I love it
@revenant "hey guys. under our new 'experimental' apis we have this radical idea... it's a reference, to another part of memory, that doesn't make any assumptions about ownership,"
@revenant
"but is it nullable"
"you can bet your return statement it's nullable"
@revenant is there some communication of intent this actually helps with?
@00dani @sl2c @revenant Basically this, yes.
โHi, yes, I know this C++ codebase is almost all references, unique_ptr<>, and shared_ptr<>, but this raw pointer really needs to be a raw pointer and isn't a mistake or something that needs to be fixed up to match the coding styleโ
(Disclaimer: I have actually wanted observing_ptr<> for pretty much this reason)
"It is intended as a near drop-in replacement for raw pointer types, with the advantage that, as a vocabulary type, it indicates its intended use"
finally, a way to know what the intended use of a pointer is. thank god 2018 will be the year where C++ code can effectively communicate the intent of a variable by simply declaring it as an instance of `std::non_owning_const_piss_shit_hell_ptr<int>` instead of `int*`
anyway this seems like a good a time as any to remind you that if you use smart pointers, you're a cop
I would assume, from the name and description, that it is intended as a weak pointer should C++ ever get a garbage collector. So it's almost certainly not that.
I must say that while I feel your pain, as someone who works on static analysis tools for C++, I do appreciate the standards body's contribution to my job security.
i'm actually upset about std::observing_ptr. it's somehow the exact opposite of syntactic sugar. std::shared_pointer and std::unique_pointer, etc. were already unsightly enough and now for some reason the name of a raw pointer type needs to have even more letters in it, for some reason. this is the kind of thing a language would be given as punishment if it were capable of dying and going to hell
everyone on earth: "rev, it's 1 am. how about eating food and going to sleep instead of having a heart attack about a programming language feature you're never going to use or even encounter in your life"
me:
me: anyway, fuck THIS part of the STL too, and don't even fucking get me sta-
@revenant "if i wanted life pointers i wouldve kept reading c++ documentation!!! wait shit fuck
@revenant
I wrote off C++ when I read about nullptr. They added a new type and new keyword rather than relax the casting rules for (void*)0.
Actually, that's a lie. I wrote off C++ long before that.
@revenant every 4 or 5 years i (a person who has occasionally written c++ but never actually learned enough c++ to understand anything at all) catch a little windnow into the current state of c++ and it's a glimpse into some kind of weird postmodern satirical hellscape full of strange glittering mechanisms assembled entirely out of razor blades and crank ontological obsessiveness.
@brennen that sounds like a more enjoyable experience than the reality of it
@revenant leave me a few of my cherished illusions
@revenant I think I might actually like this. Help Iโm a C++ dev now arenโt I
@revenant @ninjawedding