title: How to get number of elements in enumerated type
body: <p>With an enumerated type, like the below, is there a nice way to get the number of elements in the enumerated type <code>enum_t</code>:</p>
  
  <pre><code>type enum_t is (ALFA, BRAVO, CHARLIE);  -- Number of elements is 3
  
  -- Don't work: length is not valid attribute for enum_t
  constant ENUM_LENGTH : natural := enum_t'length;  -- illegal!
  </code></pre>
  
  <p>Based on answer from David Koontz it can be done as:</p>
  
  <pre><code>constant ENUM_LENGTH : natural := enum_t'pos(enum_t'right) + 1;
  </code></pre>