title: Getting all values from an enum
body: <p>I have classes in the style of <code>Class1</code> (see code). An enum and a function to get all the values from the enum. The values (<code>FOO_1</code>, <code>FOO_2</code> etc) differ from Class to Class as well as the number of values (<code>sizeof(Foos)</code>).
  I call the function once to get the sizeof the enum, reserve memory and with the second call I want to get all the values to <code>*pFoos</code> (<code>2</code>,<code>1</code>,<code>6</code> in the sample code).
  Is there a better way then using an array with all the values in it (<code>size_t arr[3] ={FOO_1 , FOO_X, FOO_BAR }</code>)?</p>
  
  <pre><code>class Class1{
      enum Foos{
          FOO_1 = 2,
          FOO_X = 1,
          FOO_BAR = 6
      }
  };
  
  Class1::GetFoos(size_t* pFoos, size_t* pSize)
  {
      size_t len = sizeof(Foos);
      if (len &gt; *pSize)
      {   //Call function once to get the size
          *pSize= len ;
          return -1;
      }
      for(size_t i = 0; i&lt; *pSize; i++)
      {
         //copy all enum values to pFoos
      }
  };
  </code></pre>