From 467bde6dbfb45b03ed75f116352a658682f91a5f Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 10 Oct 2017 22:51:42 +0200 Subject: [PATCH] small improvement --- alib2str/src/abstraction/StringReaderRegistry.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/alib2str/src/abstraction/StringReaderRegistry.cpp b/alib2str/src/abstraction/StringReaderRegistry.cpp index e7eadf1298..e7ba537e8d 100644 --- a/alib2str/src/abstraction/StringReaderRegistry.cpp +++ b/alib2str/src/abstraction/StringReaderRegistry.cpp @@ -16,8 +16,9 @@ std::shared_ptr < abstraction::OperationAbstraction > StringReaderRegistry::getA return entry.first ( ss ); }; - typename ext::deque < std::pair < std::function < bool ( std::istream & ) >, std::unique_ptr < Entry > > >::iterator callback = find_if ( getEntries ( ) [ group ].begin ( ), getEntries ( ) [ group ].end ( ), lambda ); - if ( callback == getEntries ( ) [ group ].end ( ) ) + const auto & entries = getEntries ( ) [ group ]; + typename ext::deque < std::pair < std::function < bool ( std::istream & ) >, std::unique_ptr < Entry > > >::const_iterator callback = find_if ( entries.begin ( ), entries.end ( ), lambda ); + if ( callback == entries.end ( ) ) throw exception::CommonException ( "Entry not available." ); return callback->second->getAbstraction ( ); -- GitLab