Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rlib
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
rlib
Commits
d65ebaee
There was an error fetching the commit references. Please try again later.
Unverified
Commit
d65ebaee
authored
4 years ago
by
Bensong Liu
Browse files
Options
Downloads
Patches
Plain Diff
fix msvc compilation issue on opt_parser::getValueArg overloading
parent
69f44ebd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
opt.hpp
+21
-14
21 additions, 14 deletions
opt.hpp
with
22 additions
and
15 deletions
Makefile
+
1
−
1
View file @
d65ebaee
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
opt.hpp
+
21
−
14
View file @
d65ebaee
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment