Use a reference in the Argument "==" operator, and move the currentArg variable of main.cpp into the loop used for arguments
This commit is contained in:
parent
d6642f9ae5
commit
76c8975e27
|
@ -18,7 +18,7 @@ protected:
|
|||
return (not str.empty()) && longVersion == str && hasPrefix;
|
||||
}
|
||||
public:
|
||||
bool operator ==(const string_view it) { return is(it); }
|
||||
bool operator ==(const string_view& it) { return is(it); }
|
||||
explicit Argument(string name): longVersion(move(name)) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ using namespace std;
|
|||
int main(int argc, char* argv[]) {
|
||||
if ((argc == 2) && (((string) argv[1]) == "--version")) { cout << Yerbacon::getVersion() << endl; exit(EXIT_SUCCESS); }
|
||||
string target = ".lua";
|
||||
string_view currentArg;
|
||||
bool printResult = false;
|
||||
bool parallel = false;
|
||||
|
||||
|
@ -20,7 +19,7 @@ int main(int argc, char* argv[]) {
|
|||
vector<string_view> files;
|
||||
for (signed int i = 0; i < argc; ++i)
|
||||
{
|
||||
currentArg = static_cast<string_view>(argv[i]);
|
||||
const string_view currentArg (argv[i]);
|
||||
if (currentArg == ArgumentShort("printresult")) printResult = true;
|
||||
else if (currentArg == ArgumentAssignable("target")) {
|
||||
target.clear();
|
||||
|
|
Loading…
Reference in New Issue