Did you run this in a memory debugger like Valgrind? In any case, I don't think
make_unique()
takes a size parameter, so the parameter is only used to init the created object. Just step through the code with a debugger to find out or study the docs at cppreference.com. BTW: I'd question your choice of using dynamica allocation like that when you could just build on
vector
. Consider submitting your code (once it works properly) at codereview.stackexchange.com. —
Ulrich Eckhardt 51 secs ago