What is the smallest #cplusplus "full" vector/dynamic_array class you've ever seen/made?
Been awhile since I wrote one, but I needed to and was surprised at how small it is. 150 LOC. Supports custom allocators, copy/move, all the usuals.
-
Näytä tämä ketju
-
Vastauksena käyttäjälle @tloch14
This is not a troll tweet, even though it might sound like it. Trust me. What prevented you from just using <vector>? I know you had a good reason, and it's probably worth talking about on Twitter.
1 vastaus 0 uudelleentwiittausta 1 tykkäys -
Vastauksena käyttäjälle @kurtismcc
Nothing *preventing* per-se, but there are reasons. 1) Targeting exotic platforms, meaning stl implementation can vary quite a bit; can't rely on consistency. 2) Targeting embedded systems, so executable size matters.
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjälle @tloch14
Sorry, preventing is the wrong word. Yeah, these were the kinds of reasons I guessed.
1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjälle @kurtismcc
A good dynamic array class is also a foundational container to have. Can implement lots of other containers using an array internally. Some containers which the stl doesn't have (or implements poorly/too generically).
1 vastaus 0 uudelleentwiittausta 0 tykkäystä
I should clarify: poorly/too generically for my use cases. I understand that the stl needs to serve many industries, so I can't fault them for their broad coverage.
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.