changeset 658:868663a44b5e

options: use std::string_view::compare for better readability
author David Demelier <markand@malikania.fr>
date Mon, 15 Jul 2019 20:58:11 +0200
parents 11fa64b69530
children e40d082f9161
files cpp/options/options.hpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cpp/options/options.hpp	Mon Jul 15 13:54:17 2019 +0200
+++ b/cpp/options/options.hpp	Mon Jul 15 20:58:11 2019 +0200
@@ -86,7 +86,7 @@
 			break;
 		}
 
-		if (token.size() > 0 && token[0] != '-') {
+		if (token.compare(0, 1, "-") != 0) {
 			std::get<0>(result).push_back(std::string(token));
 			continue;
 		}
@@ -99,7 +99,7 @@
 			if (idx == std::string_view::npos)
 				throw std::runtime_error("invalid option");
 
-			if (idx + 1U == fmt.size() || fmt[idx + 1] != ':') {
+			if (fmt.compare(idx + 1U, 1, ":") != 0) {
 				std::get<1>(result).emplace(sub[i], "");
 				continue;
 			}