In my code, I have the following struct
:
struct foo {
int a;
int b;
};
In b
, only values between 0 and 100 are stored. So in general, I could replace it by a char
. But than the size of the struct
is the same due to padding effects. As my code contains vectors
and sets
of these structure with several million entries, it would bring the memory usage down by more than one third if I could circumvent padding in some way. Is there any possibility to do this, e.g. some other (boost) data container which behaves in the same way?
Edit: I use both, the GNU and the Intel compiler on Linux systems: