title: boost::program_options for single-byte variables
body: <p>*emphasized text*How can I use Boost program options to accept single-byte variables from the command line? </p>
  
  <p>Command line parameters of <code>--id1=1 --id2=1</code> results in values of id1=49 (or '1', 0x31) and id2=1.</p>
  
  <pre><code>#include &lt;stdint.h&gt;
  #include &lt;iostream&gt;
  #include &lt;boost/program_options.hpp&gt;
  
  using namespace std;
  
  int main(int argc, char** argv)
  {
      (void)argc;
      (void)argv;
      namespace po = boost::program_options;
  
      const int myargc = 3;
      const char* myargv[] = {"foo","--id1=1","--id2=2" };
  
      uint8_t  id1;
      uint16_t id2; // works as expected.
  
      po::variables_map vm;
      po::options_description cmd_options( "Command options" );
      cmd_options.add_options()
      ( "id1", po::value&lt;uint8_t &gt;( &amp;id1 )-&gt;default_value( 0 ), "A 1-byte ID" )
      ( "id2", po::value&lt;uint16_t&gt;( &amp;id2 )-&gt;default_value( 0 ), "A 2-byte ID" )
      ;
  
      po::store( po::parse_command_line( myargc, myargv, cmd_options ), vm );
      po::notify( vm );
      // Using command line parameters of --id1=1 --id2=1,    
      // at this point, id1=49 (or '1', 0x31) and id2=1.
      cout &lt;&lt; "BPO parsing of " &lt;&lt; myargv[1] &lt;&lt; " and " &lt;&lt; myargv[2] &lt;&lt; endl;
      cout &lt;&lt; "id1: " &lt;&lt;      id1 &lt;&lt; endl;
      cout &lt;&lt; "id1: " &lt;&lt; (int)id1 &lt;&lt; endl;
      cout &lt;&lt; "id2: " &lt;&lt;      id2 &lt;&lt; endl;
  
      id1 = boost::lexical_cast&lt;uint8_t&gt;("1");
      id2 = boost::lexical_cast&lt;int&gt;("2");
  
      cout &lt;&lt; "Using boost::lexical_cast" &lt;&lt; endl;
      cout &lt;&lt; "id1: " &lt;&lt;      id1 &lt;&lt; endl;
      cout &lt;&lt; "id1: " &lt;&lt; (int)id1 &lt;&lt; endl;
      cout &lt;&lt; "id2: " &lt;&lt;      id2 &lt;&lt; endl;
  
  }
  </code></pre>
  
  <p>output is:</p>
  
  <pre><code>BPO parsing of --id1=1 and --id2=2
  id1: 1
  id1: 49
  id2: 2
  Using boost::lexical_cast
  id1: 1
  id1: 49
  id2: 2
  </code></pre>
  
  <p>Boost  eventually calls boost::lexical_cast("1")' which converts as a char rather than a numeric value - a "1" becomes a '1' which is 49. </p>
  
  <p>Is there a way to change the boost::program_options::add_options() initialization to treat single-bye values as ints rather than string/char? If not, what options do I have to change the parsing or mapping? Obvious (but unfavorable) options are: [1] don't use char-like values [2] manually parse (bypass Boost) or [3] perform a secondary conversion after Boost does its parsing.</p>