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:
Username404 2021-09-02 10:34:00 +02:00
parent d6642f9ae5
commit 76c8975e27
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 2 additions and 3 deletions

View File

@ -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)) {}
};

View File

@ -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();