diff --git a/beast/module/core/text/LexicalCast.h b/beast/module/core/text/LexicalCast.h index 26649dc02f..c83fdda40c 100644 --- a/beast/module/core/text/LexicalCast.h +++ b/beast/module/core/text/LexicalCast.h @@ -178,6 +178,27 @@ struct LexicalCast { return parseSigned (out, std::begin(in), std::end(in)); } + + bool + operator () (bool& out, std::string in) const + { + // Convert the input to lowercase + std::transform(in.begin (), in.end (), in.begin (), ::tolower); + + if (in == "1" || in == "true") + { + out = true; + return true; + } + + if (in == "0" || in == "false") + { + out = false; + return true; + } + + return false; + } }; //------------------------------------------------------------------------------