From bb6296ef6e1c55f49f5414c66e341bfd4cc13bdf Mon Sep 17 00:00:00 2001 From: ado Date: Sat, 26 Dec 2020 00:56:39 +0100 Subject: [PATCH] replace None with none --- include/ss/parser.hpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/ss/parser.hpp b/include/ss/parser.hpp index 25dab2b..5093cb1 100644 --- a/include/ss/parser.hpp +++ b/include/ss/parser.hpp @@ -11,7 +11,7 @@ namespace ss { -struct None {}; +struct none {}; template class composite; @@ -95,9 +95,9 @@ public: // as optional, additionally, if a parameter is passed, and // that parameter can be invoked using the converted value, // than it will be invoked in the case of a valid conversion - template + template composite>> or_else( - Fun&& fun = None{}) { + Fun&& fun = none{}) { using Value = no_void_validator_tup_t; std::optional value; try_convert_and_invoke(value, fun); @@ -106,8 +106,8 @@ public: // same as or_else, but saves the result into a 'U' object // instead of a tuple - template - composite> or_else_object(Fun&& fun = None{}) { + template + composite> or_else_object(Fun&& fun = none{}) { std::optional value; try_convert_and_invoke(value, fun); return composite_with(std::move(value)); @@ -138,7 +138,7 @@ public: return {std::move(merged_values), parser_}; } - template + template void try_convert_and_invoke(std::optional& value, Fun&& fun) { if (!parser_.valid()) { std::optional new_value; @@ -172,9 +172,9 @@ public: // tries to convert a line and returns a composite which is // able to try additional conversions in case of failure - template + template composite>> try_next( - Fun&& fun = None{}) { + Fun&& fun = none{}) { std::optional> value; auto new_value = get_next(); if (valid()) { @@ -193,9 +193,9 @@ private: // false, the function sets an error, and allows the invoke of the // next possible conversion as if the validation of the current one // failed - template + template void try_invoke(Arg&& arg, Fun&& fun) { - constexpr bool is_none = std::is_same_v, None>; + constexpr bool is_none = std::is_same_v, none>; if constexpr (!is_none) { using Ret = decltype(try_invoke_impl(arg, std::forward(fun))); constexpr bool returns_void = std::is_same_v; @@ -209,14 +209,14 @@ private: } } - // tries to invoke the function if not None + // tries to invoke the function if not none // it first tries to invoke the function without arguments, // than with one argument if the function accepts the whole tuple // as an argument, and finally tries to invoke it with the tuple // laid out as a parameter pack - template + template auto try_invoke_impl(Arg&& arg, Fun&& fun) { - constexpr bool is_none = std::is_same_v, None>; + constexpr bool is_none = std::is_same_v, none>; if constexpr (!is_none) { if constexpr (std::is_invocable_v) { return fun();