Skip to content
Snippets Groups Projects
Unverified Commit d65ebaee authored by Bensong Liu's avatar Bensong Liu
Browse files

fix msvc compilation issue on opt_parser::getValueArg overloading

parent 69f44ebd
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ ARFLAGS = rcs
PREFIX ?= /usr
def:
@echo Run make install
@echo This library is header-only, and no need to compile. Run make install if you would like.
install_header:
[ ! -d $(PREFIX)/include/rlib ] || rm -rf $(PREFIX)/include/rlib
......
......@@ -79,20 +79,8 @@ namespace rlib {
}
}
rlib::string getValueArg(const std::string &longName, const char *shortName)
{ //getValueArg("--long", "-l") may be converted to getValueArg("--long", true).
return getValueArg(longName, shortName, true);
}
bool getBoolArg(const std::string &argName)
{ //Return if it's defined.
auto pos = std::find(args.cbegin(), args.cend(), argName);
if(pos == args.cend()) return false;
args.erase(pos);
return true;
}
rlib::string getValueArg(const std::string &longName, const std::string &shortName, bool required = true, const std::string &def = std::string())
// rlib::string getValueArg(const std::string &longName, const std::string &shortName, bool required = true, const std::string &def = std::string()) // MSVC doesn't allow this overload.
rlib::string getValueArg(const std::string &longName, const std::string &shortName, bool required, const std::string &def)
{
using rlib::literals::operator "" _format;
std::string valueL = getValueArg(longName, false);
......@@ -107,6 +95,25 @@ namespace rlib {
}
return std::move(value);
}
rlib::string getValueArg(const std::string &longName, const std::string &shortName, bool required) {
return getValueArg(longName, shortName, required, std::string());
}
rlib::string getValueArg(const std::string &longName, const std::string &shortName) {
return getValueArg(longName, shortName, true, std::string());
}
rlib::string getValueArg(const std::string &longName, const char *shortName)
{ //getValueArg("--long", "-l") may be converted to getValueArg("--long", true).
return getValueArg(longName, shortName, true);
}
bool getBoolArg(const std::string &argName)
{ //Return if it's defined.
auto pos = std::find(args.cbegin(), args.cend(), argName);
if(pos == args.cend()) return false;
args.erase(pos);
return true;
}
bool getBoolArg(const std::string &longName, const std::string &shortName)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment