Commit bd890e24a1f081d6db1a59a0cc372eccc64e9e52

Authored by Henry Fredrick Schreiner
1 parent b2327535

A few more explicit constructors

Showing 1 changed file with 3 additions and 3 deletions
include/CLI/Error.hpp
@@ -160,7 +160,7 @@ class CallForHelp : public ParseError { @@ -160,7 +160,7 @@ class CallForHelp : public ParseError {
160 /// Does not output a diagnostic in CLI11_PARSE, but allows to return from main() with a specific error code. 160 /// Does not output a diagnostic in CLI11_PARSE, but allows to return from main() with a specific error code.
161 class RuntimeError : public ParseError { 161 class RuntimeError : public ParseError {
162 CLI11_ERROR_DEF(ParseError, RuntimeError) 162 CLI11_ERROR_DEF(ParseError, RuntimeError)
163 - RuntimeError(int exit_code = 1) : RuntimeError("Runtime error", exit_code) {} 163 + explicit RuntimeError(int exit_code = 1) : RuntimeError("Runtime error", exit_code) {}
164 }; 164 };
165 165
166 /// Thrown when parsing an INI file and it is missing 166 /// Thrown when parsing an INI file and it is missing
@@ -242,7 +242,7 @@ class ExcludesError : public ParseError { @@ -242,7 +242,7 @@ class ExcludesError : public ParseError {
242 /// Thrown when too many positionals or options are found 242 /// Thrown when too many positionals or options are found
243 class ExtrasError : public ParseError { 243 class ExtrasError : public ParseError {
244 CLI11_ERROR_DEF(ParseError, ExtrasError) 244 CLI11_ERROR_DEF(ParseError, ExtrasError)
245 - ExtrasError(std::vector<std::string> args) 245 + explicit ExtrasError(std::vector<std::string> args)
246 : ExtrasError((args.size() > 1 ? "The following arguments were not expected: " 246 : ExtrasError((args.size() > 1 ? "The following arguments were not expected: "
247 : "The following argument was not expected: ") + 247 : "The following argument was not expected: ") +
248 detail::rjoin(args, " "), 248 detail::rjoin(args, " "),
@@ -279,7 +279,7 @@ class HorribleError : public ParseError { @@ -279,7 +279,7 @@ class HorribleError : public ParseError {
279 /// Thrown when counting a non-existent option 279 /// Thrown when counting a non-existent option
280 class OptionNotFound : public Error { 280 class OptionNotFound : public Error {
281 CLI11_ERROR_DEF(Error, OptionNotFound) 281 CLI11_ERROR_DEF(Error, OptionNotFound)
282 - OptionNotFound(std::string name) : OptionNotFound(name + " not found", ExitCodes::OptionNotFound) {} 282 + explicit OptionNotFound(std::string name) : OptionNotFound(name + " not found", ExitCodes::OptionNotFound) {}
283 }; 283 };
284 284
285 /// @} 285 /// @}