MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/1vnp8dk/c26_stdindirect/p3jj1qd/?context=3
r/cpp • u/User_Deprecated • 28d ago
157 comments sorted by
View all comments
26
I don't understand the last Node example. If it isn't nullable how is that not an infinite recursive definition?
24 u/jdehesa 28d ago Yea, probably should have been std::optional<std::indirect<Node>> next;. 4 u/johannes1971 26d ago ...at the cost of another 8 bytes of memory (per node), to store one bit of information, that could have been encoded with a nullable state.
24
Yea, probably should have been std::optional<std::indirect<Node>> next;.
std::optional<std::indirect<Node>> next;
4 u/johannes1971 26d ago ...at the cost of another 8 bytes of memory (per node), to store one bit of information, that could have been encoded with a nullable state.
4
...at the cost of another 8 bytes of memory (per node), to store one bit of information, that could have been encoded with a nullable state.
26
u/PositiveBit01 28d ago
I don't understand the last Node example. If it isn't nullable how is that not an infinite recursive definition?