aboutsummaryrefslogtreecommitdiff
path: root/args.hxx
diff options
context:
space:
mode:
authorTaylor C. Richberger <Taywee@gmx.com>2016-05-08 21:50:41 -0600
committerTaylor C. Richberger <Taywee@gmx.com>2016-05-08 21:50:41 -0600
commit29baee5b10aacc4e554f1c8c54d216406b11f69b (patch)
tree7e4f16a09e4070f9bcf2b7c12e95243e4feb1cc9 /args.hxx
parentMerge branch 'master' of ssh.gitgud.io:Taywee/args (diff)
downloadargs.hxx-29baee5b10aacc4e554f1c8c54d216406b11f69b.tar.xz
some small const improvements
Diffstat (limited to 'args.hxx')
-rw-r--r--args.hxx10
1 files changed, 3 insertions, 7 deletions
diff --git a/args.hxx b/args.hxx
index c03f381..817af7c 100644
--- a/args.hxx
+++ b/args.hxx
@@ -1007,7 +1007,7 @@ namespace args
// Check short args
} else if (!terminated && chunk.find(shortprefix) == 0 && chunk.size() > shortprefix.size())
{
- std::string argchunk(chunk.substr(shortprefix.size()));
+ const std::string argchunk(chunk.substr(shortprefix.size()));
for (auto argit = std::begin(argchunk); argit != std::end(argchunk); ++argit)
{
const char arg = *argit;
@@ -1087,16 +1087,12 @@ namespace args
{
prog.assign(argv[0]);
}
- std::vector<std::string> args;
- for (int i = 1; i < argc; ++i)
- {
- args.emplace_back(argv[i]);
- }
+ const std::vector<std::string> args(argv + 1, argv + argc);
ParseArgs(args);
}
};
- std::ostream &operator<<(std::ostream &os, ArgumentParser &parser)
+ std::ostream &operator<<(std::ostream &os, const ArgumentParser &parser)
{
parser.Help(os);
return os;