C++ has pointers, smart pointers and references for indirect access, so what is std::indirect?
C++26 apparently introduces a new type template named std::indirect<T>. If it's an "indirect T", then it's some sort of reference to a T, or pointer to a T, right? Well - why do we need those? C++ already has not just raw pointers and references, but also smart pointers with ownership semantics - std::unique_ptr, std::shared_ptr etc.; as well as std::reference_wrapper if you want fancier references. So why yet another one of these reference-types? What's so special about it?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.