[mlpack-git] [mlpack/mlpack] fix default output problem and some styles (#680)

Ryan Curtin notifications at github.com
Tue Jun 7 23:33:47 EDT 2016


>                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;

This is a good way to solve the problem of duplicate options, I like it.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/680/files/92f3cd11d129367ba1b48d79b3081409ae80707a#r66188168
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160607/48a46adf/attachment.html>


More information about the mlpack-git mailing list