From 2462dff088c3c51225f571c3961119649c86d31d Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 22 Jun 2017 16:07:05 +0100 Subject: [PATCH] Updated Clara with VS ICE workaround --- include/external/clara.hpp | 15 ++++++++------- third_party/clara.hpp | 14 ++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/external/clara.hpp b/include/external/clara.hpp index 03fdf298..12a64522 100644 --- a/include/external/clara.hpp +++ b/include/external/clara.hpp @@ -31,8 +31,7 @@ #include #ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH -#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH - +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80 #endif @@ -785,9 +784,7 @@ namespace detail { public: virtual ~ParserBase() = default; virtual auto validate() const -> Result { return Result::ok(); } - virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; - virtual auto cardinality() const -> size_t { return 1; } auto parse(Args const &args) const -> InternalParseResult { @@ -926,13 +923,17 @@ namespace detail { std::vector m_optNames; public: - using ParserRefImpl::ParserRefImpl; - template explicit Opt( LambdaT const &ref ) : ParserRefImpl(std::make_shared>(ref)) {} explicit Opt( bool &ref ) : ParserRefImpl(std::make_shared(ref)) {} + template + Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + template + Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + auto operator[](std::string const &optName) -> Opt & { m_optNames.push_back(optName); return *this; @@ -1096,7 +1097,7 @@ namespace detail { } auto rows = getHelpColumns(); - size_t consoleWidth = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; + size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH; size_t optWidth = 0; for (auto const &cols : rows) optWidth = std::max(optWidth, cols.left.size() + 2); diff --git a/third_party/clara.hpp b/third_party/clara.hpp index 5ee18df1..95f28268 100644 --- a/third_party/clara.hpp +++ b/third_party/clara.hpp @@ -29,7 +29,7 @@ #include #ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH -#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80 #endif @@ -53,7 +53,7 @@ namespace clara { namespace TextFlow class Column { std::vector m_strings; - size_t m_width = TEXTFLOW_CONFIG_CONSOLE_WIDTH; + size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; size_t m_indent = 0; size_t m_initialIndent = std::string::npos; @@ -782,9 +782,7 @@ namespace detail { public: virtual ~ParserBase() = default; virtual auto validate() const -> Result { return Result::ok(); } - virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; - virtual auto cardinality() const -> size_t { return 1; } auto parse(Args const &args) const -> InternalParseResult { @@ -923,13 +921,17 @@ namespace detail { std::vector m_optNames; public: - using ParserRefImpl::ParserRefImpl; - template explicit Opt( LambdaT const &ref ) : ParserRefImpl(std::make_shared>(ref)) {} explicit Opt( bool &ref ) : ParserRefImpl(std::make_shared(ref)) {} + template + Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + template + Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + auto operator[](std::string const &optName) -> Opt & { m_optNames.push_back(optName); return *this;