diff --git a/include/clara.hpp b/include/clara.hpp index c78bf09..c6ca12e 100644 --- a/include/clara.hpp +++ b/include/clara.hpp @@ -116,7 +116,7 @@ namespace detail { void loadBuffer() { m_tokenBuffer.resize( 0 ); - // Note: not skiping empty strings + // Note: not skipping empty strings if( it != itEnd ) { auto const &next = *it; @@ -979,9 +979,6 @@ namespace detail { } } - struct ParserInfo { - ParserBase const* parser = nullptr; - }; const size_t totalParsers = m_options.size() + m_args.size(); assert( totalParsers < 512 ); // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do @@ -1007,7 +1004,8 @@ namespace detail { while( result.value().remainingTokens() ) { bool tokenParsed = false; - for (auto& parser : parsers) { + for (size_t i = 0; i < totalParsers; ++i) { + ParserBase const* parser = parsers[i]; if( parser->canParse() ) { result = parser->internalParse(exeName, result.value().remainingTokens()); if (!result) diff --git a/single_include/clara.hpp b/single_include/clara.hpp index 84eb21f..2beaad4 100644 --- a/single_include/clara.hpp +++ b/single_include/clara.hpp @@ -456,7 +456,7 @@ namespace detail { void loadBuffer() { m_tokenBuffer.resize( 0 ); - // Note: not skiping empty strings + // Note: not skipping empty strings if( it != itEnd ) { auto const &next = *it; @@ -1319,9 +1319,6 @@ namespace detail { } } - struct ParserInfo { - ParserBase const* parser = nullptr; - }; const size_t totalParsers = m_options.size() + m_args.size(); assert( totalParsers < 512 ); // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do @@ -1347,7 +1344,8 @@ namespace detail { while( result.value().remainingTokens() ) { bool tokenParsed = false; - for (auto& parser : parsers) { + for (size_t i = 0; i < totalParsers; ++i) { + ParserBase const* parser = parsers[i]; if( parser->canParse() ) { result = parser->internalParse(exeName, result.value().remainingTokens()); if (!result)