title: boost::program_options read an integer array from console
body: <p>I want to read an integer array from console using boost::program_options. The length of the array is not known and I don't want to read all the data in one attempt. How can I do that?</p>
  
  <p>What I am doing now is</p>
  
  <blockquote>
    <p>$ ./foo --array "1, 2, 3"</p>
  </blockquote>
  
  <p>and then populate arr[] by splitting input string.</p>
  
  <p>But I want something like</p>
  
  <blockquote>
    <p>$ ./foo --array 1 --array 2 --array 3</p>
  </blockquote>
  
  <p>and read it in arr[]. Also want to know the length of arr[], don't want to make that a command-line param.</p>