I'm not sure if the question here answers this question due to the weird wording, but:
if i have:
struct numpair
{
some_type_with_a_size_of_2 a,b;
};
struct bignum
{
some_type_with_a_size_of_4 a;
};
Can I reinterpret_cast a vector of bignums to a vector of numpairs? If not, are there other workarounds that don't require me to make a new vector and go through reinterpret casting each element?
edit: on visual studio 2017 windows, which i am using, these two types are the same size.
edit: I have now learned if this strict aliasing rule. This is supposed to be binary data, viewed with different interfaces. Putting aside reinterpret_cast, could I possibly use a union of vectors of these types?
Why do you think the types are the same?