3 ms·
Eh I'd say using malloc in place of new is more code smell than anything here. If you want a byte array make a byte array std::make_unique<std:::array<char
by unlinked_dll 7y ago
Eh I'd say using malloc in place of new is more code smell than anything here. If you want a byte array make a byte array
std::make_unique<std:::array<char, SIZE>>()
If you don't know how big you want the byte array make a vector.
std::vector<char>(size)
It's baffling to me how many C++ developers don't use the standard collections. The only one that really sucks is unordered_map.
- ipmifatwa 7y agostd::list sucks at least as much as std::unordered_map.
- mgraczyk 7y agovector<bool> also sucks
- unlinked_dll 7y agoThat's fair. But in my experience that's rather rare and easy to work around.
- vardump 7y agoSmall vectors are also bad. There should be some kind of small vector optimization, just like what is common for std::string.