I require a vector of integers, where I can distinguish between 0 and -0. So far i've come up with the idea of defining a new class called zero_int for this special case..
However, now I can't push both normal integers and the zero_int into the same vector. The solution std::variant has the size of 8 Bytes and I need to retain the size of 4 per variable.. Defining a virtual base class my_int and setting zero_int to be its derived class increases the size of zero_int to 32 Bytes...
I'm aware one could use something like a vector<void*>
but I don't know how.. - Also, are objects pointed to by the pointers in a vector of pointers contiguous in memory?? - This is important in this case.
I would appreciate any suggestions on how to solve this