cmdopt: tighten parser argument constness

This commit is contained in:
Danny Robson 2015-06-30 22:07:34 +10:00
parent fab5891efe
commit 35718cbcf7
2 changed files with 6 additions and 6 deletions

View File

@ -195,7 +195,7 @@ namespace util { namespace cmdopt { namespace option {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int int
parser::scan (int argc, char *const *argv) parser::scan (int argc, const char *const *argv)
{ {
CHECK_GE (argc, 0); CHECK_GE (argc, 0);
CHECK (argv); CHECK (argv);
@ -230,7 +230,7 @@ parser::scan (int argc, char *const *argv)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
parser::parse_long (int pos, int argc, char *const *argv) parser::parse_long (int pos, int argc, const char *const *argv)
{ {
CHECK_LT (pos, argc); CHECK_LT (pos, argc);
CHECK_GE (pos, 0); CHECK_GE (pos, 0);
@ -276,7 +276,7 @@ parser::parse_long (int pos, int argc, char *const *argv)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
parser::parse_short (int pos, int argc, char *const *argv) parser::parse_short (int pos, int argc, const char *const *argv)
{ {
CHECK_LT (pos, argc); CHECK_LT (pos, argc);
CHECK_GE (pos, 0); CHECK_GE (pos, 0);

View File

@ -134,11 +134,11 @@ namespace util { namespace cmdopt {
std::string description, std::string description,
Args&&...); Args&&...);
int scan (int argc, char *const *argv); int scan (int argc, const char *const *argv);
private: private:
int parse_long (int pos, int argc, char *const *argv); int parse_long (int pos, int argc, const char *const *argv);
int parse_short (int pos, int argc, char *const *argv); int parse_short (int pos, int argc, const char *const *argv);
using short_t = std::tuple<char,option::base&>; using short_t = std::tuple<char,option::base&>;