I need to store a pre-known size of about 30 integers in my code, I have gone for
constexpr std::array<size_t, 30> MAPPING{1, 2, 3, ...};
If i am not wrong, the above will be evaluated at compile time, but it would also take up a single sequential block of memory of a size of 30 integers?
If it does, is it worth using a std::deque instead
const std::deque<int> MAPPING{1, 2, 3, ...};
This way, with a deque, we would not be using a single large sequential memory block and it might use a bunch of fragmented blocks instead and thus it will work fine even if the memory is fragmented?
Please let me know if I have missed anything, thanks
Aucun commentaire:
Enregistrer un commentaire