logoalt Hacker News

senderistatoday at 6:16 AM1 replyview on HN

This is just silly. You can't even reserve capacity because you only store size and capacity is implicitly the next power of 2 >= size.


Replies

sparkietoday at 7:07 AM

The concept of not storing capacity isn't silly. If you need to reserve space then it's not the appropriate structure, but it's otherwise fine.

However, using an 2-element array to avoid using a struct is silly.