title: "Conditional" parsing of command-line arguments
body: <p>Say I have an executable (running on mac, win, and linux)</p>
  
  <pre><code> a.out [-a] [-b] [-r -i &lt;file&gt; -o &lt;file&gt; -t &lt;double&gt; -n &lt;int&gt; ]
  </code></pre>
  
  <p>where an argument in <code>[ ]</code> means that it is optional. However, if the last argument <code>-r</code> is set then <code>-i</code>,<code>-o</code>,<code>-t</code>, and <code>-n</code> have to be supplied, too. </p>
  
  <p>There are lots of good C++-libraries out there to parse command-line arguments, e.g. gflags (<a href="http://code.google.com/p/gflags/" rel="noreferrer">http://code.google.com/p/gflags/</a>), tclap (<a href="http://tclap.sourceforge.net/" rel="noreferrer">http://tclap.sourceforge.net/</a>), simpleopt(<a href="http://code.jellycan.com/simpleopt/" rel="noreferrer">http://code.jellycan.com/simpleopt/</a>), boost.program_options (<a href="http://www.boost.org/doc/libs/1_52_0/doc/html/program_options.html" rel="noreferrer">http://www.boost.org/doc/libs/1_52_0/doc/html/program_options.html</a>), etc. But I wondered if there is one that lets me encode these conditional relationships between arguments directly, w/o manually coding error handling</p>
  
  <pre><code>if ( argR.isSet() &amp;&amp; ( ! argI.isSet() || ! argO.isSet() || ... ) ) ...
  </code></pre>
  
  <p>and manually setting up the <code>--help</code>.</p>
  
  <p>The library <a href="http://tclap.sourceforge.net/" rel="noreferrer">tclap</a> allows to XOR arguments, e.g. either <code>-a</code> or <code>-b</code> is allowed but not both. So, in that terminology an AND for arguments would be nice. </p>
  
  <p><em>Does anybody know a versatile, light-weight, and cross-platform library that can do that?</em></p>