Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-02-07 19:13:11 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:33:24 +0300
commit188b9e8ec3b14c4e4a539f53b9d43e0fe1b29e74 (patch)
tree2e649426e94ed1d081b1c697a488853b19e387ae /search/feature_offset_match.hpp
parent583a3b20a83b745fdf5bb570120013cc978653e2 (diff)
[search] Fix lat lon results bug. Closed #523.
Diffstat (limited to 'search/feature_offset_match.hpp')
-rw-r--r--search/feature_offset_match.hpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/search/feature_offset_match.hpp b/search/feature_offset_match.hpp
index 60487330df..597090c121 100644
--- a/search/feature_offset_match.hpp
+++ b/search/feature_offset_match.hpp
@@ -119,17 +119,17 @@ void PrefixMatchInTrie(TrieIterator const & trieRoot,
}
}
-template <class FilterT> struct OffsetIntersecter
+template <class FilterT> class OffsetIntersecter
{
typedef unordered_set<uint32_t> SetType;
FilterT const & m_filter;
scoped_ptr<SetType> m_prevSet;
scoped_ptr<SetType> m_set;
- bool m_bFirstStep;
+public:
explicit OffsetIntersecter(FilterT const & filter)
- : m_filter(filter), m_bFirstStep(true), m_set(new SetType()) {}
+ : m_filter(filter), m_set(new SetType()) {}
void operator() (uint32_t offset)
{
@@ -149,7 +149,12 @@ template <class FilterT> struct OffsetIntersecter
m_prevSet.swap(m_set);
m_set->clear();
- m_bFirstStep = false;
+ }
+
+ template <class ToDo> void ForEachResult(ToDo & toDo) const
+ {
+ for (SetType::const_iterator i = m_prevSet->begin(); i != m_prevSet->end(); ++i)
+ toDo(*i);
}
};
@@ -183,9 +188,7 @@ void MatchFeaturesInTrie(vector<vector<strings::UniString> > const & tokens,
intersecter.NextStep();
}
- typedef typename impl::OffsetIntersecter<FilterT>::SetType::const_iterator IT;
- for (IT it = intersecter.m_prevSet->begin(); it != intersecter.m_prevSet->end(); ++it)
- toDo(*it);
+ intersecter.ForEachResult(toDo);
}