I need to have a variable struct inside a struct. So, I want to be able to include the data from any kind of struct in another struct. I think this is possible with a template but it isn't working out:
namespace BaseStructs
{
template<typedef T>
struct packet
{
int ID;
T data;
};
}
So, this is what I have but if I make an object of this struct like this:
BaseStructs::packet packet;
it doesn't work because the program wants me to choose a template for THIS struct but I want the "data" variable to be changeable. Any ideas on how to solve this?
What I want to do is create a small object that holds an ID like in my example and I need to add extra data from another object to it (which might differ in number of variables and such).