r/cpp • • Aug 13 '26

C++26: std::indirect

https://www.sandordargo.com/blog/2026/08/12/cpp26-indirect
164 Upvotes

157 comments sorted by

View all comments

Show parent comment

-3

u/NilacTheGrim Aug 14 '26

not sure where your code is going to depend in such tiny amount of space a

Well, you just lack experience solving some types of problems. You can imaging having millions or perhaps billions of objects you are creating and tracking .. in that situation every byte matters.

I have had to hand-roll my own containers more than once to shave 8 bytes here, 12 bytes there. It starts to stack up when we are talking about billions of objects. 1 billion times 8 is 8 GB.

So this looks to me like hyperbole and complaining for the sake of doing it.

No. I have 30 years' experience writing programs. Some problems care about RAM/space.

I think this design, given that C++ has no destructive move, is about the best that we can get and I do not think it is that "unergonomic" as I see all around here.

Agree to disagree then. I think it's broken.

Have a nice day.

5

u/wyrn Aug 14 '26

Well, you just lack experience solving some types of problems.

I think you lack experience with std::indirect and std::polymorphic. We have been using them in production for several years now, and not once has their supposed nullability been an issue.

4

u/germandiago Aug 15 '26

Yes, after over 20 years coding, I know what a corner case is. Just create a wrapper your own or specialize optional if the standard lets you.

 It seems that for 30 years of coding you cannot handle the situation properly. I am not here to take such basic 98% of the time made-up imaginary lessons.

Greetings.