title: Can I put a list in a struct?
body: <p>I am trying to use a list as part of a struct due to the fact our products come in several colors.  Is this some thing I can do or should i just use an array?  Either way i have not found any examples on the web.</p>
  
  <pre><code>#include "stdafx.h"
  #include&lt;iostream&gt;  
  #include&lt;string&gt;  
  #include&lt;sstream&gt;  
  #include&lt;cctype&gt; 
  #include&lt;list&gt;
  
  using namespace std;
  
  ////////////////////////////////////////////////////////////////////////////////////////
  //  Constances
  ////////////////////////////////////////////////////////////////////////////////////////
  
  #define N_PRODUCT 3
  
  struct Brand_t {
  int Model_Num;
  string Product_Name;
  list&lt;string&gt; Colors;
  } brands [N_COLOR];
  
  ////////////////////////////////////////////////////////////////////////////////////////
  //  Functions
  ////////////////////////////////////////////////////////////////////////////////////////
  
  
  int main()
  {
  string mystr;
  int n;
  
  for (n=0; n &lt; N_PRODUCT; n++)
  {
      cout &lt;&lt; "Enter Model Number: ";
      std::getline (cin,mystr);
      stringstream(mystr) &gt;&gt; brands[n].model_Num,4;
      cout &lt;&lt; "Enter Product Name: ";
      getline(cin,classrooms[n].Product_Name);
      list&lt;string&gt;::iterator it;
      Students.push_back ("Red");
      Students.push_back ("Yellow");
      Students.push_back ("Blue");
  }
  
  return 0;
  }
  </code></pre>