Is this C++ code valid or undefined behaviour? The idea is to be able to wrap a POD you have no control over into another struct to provide helper functions but still be able to use it as if it was the original POD.
struct Data
{
...//POD
};
struct Wrapper
{
Data data;//contains only this
void HelperFuncA();
void HelperFuncB();
...//only member functions
};
...
//is this legal?
std::vector<Wrapper> vec_of_wrappers;
Data* array_of_data = reinterpret_cast<Data*>(vec_of_wrappers.data());