<p>In <a href="https://github.com/mlpack/mlpack/pull/680#discussion_r66188168">src/mlpack/core/util/cli_impl.hpp</a>:</p>
<pre style='color:#555'>> const std::string& description,
> const std::string& alias,
> bool required)
> {
> + // Temporary outstream object for detecting duplicate identifiers
> + util::PrefixedOutStream outstr(std::cerr,
> + BASH_RED "[FATAL] " BASH_CLEAR, false, true /* fatal */);
> +
> + // identifier and alias maps
> + gmap_t& gmap = GetSingleton().globalValues;
> + amap_t& amap = GetSingleton().aliasValues;
> +
> + // if found in current map, print fatal error and terminat program.
> + if (gmap.count(identifier))
> + outstr << "Parameter --" << identifier << "(-" << alias << ") "
> + << "is defined multiple times with same identifiers." << std::endl;
> + if (amap.count(alias))
> + outstr << "Parameter --" << identifier << "(-" << alias << ") "
> + << "is defined multiple times with same alias." << std::endl;
</pre>
<p>This is a good way to solve the problem of duplicate options, I like it.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/680/files/92f3cd11d129367ba1b48d79b3081409ae80707a#r66188168">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFPWqdETWzwaaNSnXgS17bT900dpbks5qJjgbgaJpZM4Iu0EJ">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFOkutfxQplrzAPeVSGW3VhoBUAdPks5qJjgbgaJpZM4Iu0EJ.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/mlpack/mlpack/pull/680/files/92f3cd11d129367ba1b48d79b3081409ae80707a#r66188168"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>