summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--getoptpp.hpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/getoptpp.hpp b/getoptpp.hpp
index 92f8e82..a9791d1 100644
--- a/getoptpp.hpp
+++ b/getoptpp.hpp
@@ -116,14 +116,14 @@ class Options {
if(index >= (int)options.size()) {
break;
}
- auto const & opt = options.at(index);
- std::string args;
+ auto const & opt = options.at(static_cast<std::size_t>(index));
+ std::string _args;
switch(opt.has_arg) {
case required_argument:
- args = "<x>";
+ _args = "<x>";
break;
case optional_argument:
- args = "[x]";
+ _args = "[x]";
break;
case no_argument:
default:
@@ -133,11 +133,12 @@ class Options {
std::string option_str;
if(opt.val >= '!' && opt.val <= '~')
{
- option_str = " -" + std::string(1, opt.val) + ", --" + opt.name + " " + args;
+ auto c = static_cast<char>(opt.val);
+ option_str = " -" + std::string(1, c) + ", --" + opt.name + " " + _args;
}
else
{
- option_str = " --" + std::string(opt.name) + " " + args;
+ option_str = " --" + std::string(opt.name) + " " + _args;
}
std::string padding;
@@ -158,8 +159,8 @@ class Options {
{
if((c == '\n') || (i > column_width && (c == ' ' || c == '\t')))
{
- std::string padding(width, ' ');
- std::cout << '\n' << padding;
+ std::string _padding(width, ' ');
+ std::cout << '\n' << _padding;
i = width;
continue;
}
@@ -172,7 +173,7 @@ class Options {
}
private:
- std::size_t num_flags{};
+ int num_flags{};
std::vector<option> options{};
std::deque<std::string> names{};
std::vector<std::string> help_texts{};