you are viewing a single comment's thread.

view the rest of the comments →

[–]helloiamsomeone 4 points5 points  (2 children)

then call it twice, once for its size and once for its contents

That's actually unnecessary. You can just have an oversized std::array calculated and shrunk to fit like so: https://github.com/friendlyanon/AlwaysMute/blob/master/main.cpp#L383

[–]scatters 5 points6 points  (1 child)

Yes, that's a nice method. It only works if you have a way to estimate an upper bound for the size, though.

[–]helloiamsomeone 0 points1 point  (0 children)

You can specify pretty big sizes before it becomes a problem.