How to instantiate a std::list contained in a struct.
I'm new to C++ (math major here). Here's a simple example of what I'm trying to do.
Suppose I have some struct, we'll call it simple.
Now, suppose I have another struct that contains some data, and an std::list that will hold type simple:
typedef struct simple
Now, in main, if I want to create a type of tx_info, and use that list, I'm not sure what the
typedef struct _tx_info
syntax is just to instantiate the list..
Obviously, this will segfault because I never instantiate the list.
int main(int argc, char ** argv)
tx_info * info = (tx_info*)malloc(sizeof(tx_info));
simple * s = (simple*)malloc(sizeof(simple));
s->a = 10;
What's confusing to me, is if at the top of the C++ file, I do
that will both declare and instantiate a list. I'm not sure how to instantiate it when my list is
declared within a struct.
Thanks so much for the help!