diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-03 20:28:30 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-12-03 20:34:06 +0100 |
commit | 7363356682ff3609bbf8fbd8aacf2908e81a6587 (patch) | |
tree | c72b93ebdaa7c74ca6afa0ace963e716d4be6883 /juniper/src | |
parent | 7d79f28b0c89ecc4f314423a9d49ff54b52b8f9e (diff) |
Remove old juniper stl workaround.
Diffstat (limited to 'juniper/src')
-rw-r--r-- | juniper/src/vespa/juniper/Matcher.cpp | 4 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/Matcher.h | 1 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/keyocc.h | 1 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/matchelem.h | 4 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/mcand.h | 2 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/multiset.h | 81 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/sumdesc.h | 2 |
7 files changed, 6 insertions, 89 deletions
diff --git a/juniper/src/vespa/juniper/Matcher.cpp b/juniper/src/vespa/juniper/Matcher.cpp index 9b91166fa29..bb5bc0bdcae 100644 --- a/juniper/src/vespa/juniper/Matcher.cpp +++ b/juniper/src/vespa/juniper/Matcher.cpp @@ -375,8 +375,8 @@ void Matcher::log_matches(int printcount) _log_text.append("<table>"); if (m.size() > 0) { _log_text.append("<tr class=shade>"); - sprintf(buf, "<td colspan=%d align=center><b>Topmost %d matches out of %d", - nterms+2, std::min(printcount, m.size()),m.size()); + sprintf(buf, "<td colspan=%d align=center><b>Topmost %zu matches out of %zu", + nterms+2, std::min(static_cast<size_t>(printcount), m.size()),m.size()); _log_text.append(buf); _log_text.append("</b></td></tr>"); } diff --git a/juniper/src/vespa/juniper/Matcher.h b/juniper/src/vespa/juniper/Matcher.h index 6bbb307b74c..db90a5a3091 100644 --- a/juniper/src/vespa/juniper/Matcher.h +++ b/juniper/src/vespa/juniper/Matcher.h @@ -16,7 +16,6 @@ #include <vector> #include <list> -#include "multiset.h" #include <map> #include <string> #include "ITokenProcessor.h" diff --git a/juniper/src/vespa/juniper/keyocc.h b/juniper/src/vespa/juniper/keyocc.h index fae4861d1ef..c957909ac90 100644 --- a/juniper/src/vespa/juniper/keyocc.h +++ b/juniper/src/vespa/juniper/keyocc.h @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "multiset.h" #include "matchelem.h" #include "querynode.h" diff --git a/juniper/src/vespa/juniper/matchelem.h b/juniper/src/vespa/juniper/matchelem.h index 23510c6d333..b0af8f3364f 100644 --- a/juniper/src/vespa/juniper/matchelem.h +++ b/juniper/src/vespa/juniper/matchelem.h @@ -4,7 +4,7 @@ #pragma once #include <string> -#include "multiset.h" +#include <set> #include "querynode.h" class Matcher; @@ -20,7 +20,7 @@ struct sequential_elem return m1->starttoken() < m2->starttoken(); } }; -typedef JUNIPER_SET<key_occ*, sequential_elem<key_occ*> > keylist; +typedef std::set<key_occ*, sequential_elem<key_occ*> > keylist; class MatchElement { diff --git a/juniper/src/vespa/juniper/mcand.h b/juniper/src/vespa/juniper/mcand.h index 0928c55ddea..fee86fd83af 100644 --- a/juniper/src/vespa/juniper/mcand.h +++ b/juniper/src/vespa/juniper/mcand.h @@ -18,7 +18,7 @@ struct gtematch_cand { bool operator()(const MatchCandidate* m1, const MatchCandidate* m2) const; bool gtDistance(const MatchCandidate* m1, const MatchCandidate* m2) const; }; -typedef JUNIPER_MULTISET<MatchCandidate*, gtematch_cand> match_candidate_set; +typedef std::multiset<MatchCandidate*, gtematch_cand> match_candidate_set; class MatchCandidate : public MatchElement { diff --git a/juniper/src/vespa/juniper/multiset.h b/juniper/src/vespa/juniper/multiset.h deleted file mode 100644 index 5c4495080fe..00000000000 --- a/juniper/src/vespa/juniper/multiset.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once -#include <algorithm> -#include <vector> -#include <cstddef> - -#ifdef __GNUC__ -#define USE_STL_WORKAROUNDS 1 -#endif - -#ifdef USE_STL_WORKAROUNDS - -namespace fast { - -// STL like wrapper around Fast_Array providing multiset functionality - - -template <class ValueType, class Comparator> -class multiset -{ -public: - - class iterator - : public std::iterator<std::bidirectional_iterator_tag, ValueType, - ptrdiff_t, ValueType*, ValueType&> - { - public: - iterator(multiset<ValueType, Comparator>& mset, int pos) : _myset(mset), _pos(pos) {} - inline ValueType operator*() { return _myset._values[_pos]; } - inline iterator& operator++() { _pos++; return *this; } - inline iterator& operator--() { _pos--; return *this; } - inline bool operator!=(const iterator& i2) { return i2._pos != _pos; } - inline bool operator==(const iterator& i2) { return i2._pos == _pos; } - protected: - friend class multiset; - const multiset<ValueType, Comparator>& _myset; - int _pos; - }; - - inline multiset() : _values(), _sorted(true) {} - - inline bool insert(ValueType& v) - { - _sorted = false; - _values.push_back(v); - return true; - } - - inline void clear() { _values.clear(); _sorted = true; } - - inline int size() const { return _values.size(); } - - iterator begin() { sort(); return iterator(*this, 0); } - iterator end() { return iterator(*this, size()); } - -protected: - inline void sort() - { - if (!_sorted) { - std::stable_sort(_values.begin(), _values.end(), Comparator()); - _sorted = true; - } - } - -private: - friend class iterator; - std::vector<ValueType> _values; - bool _sorted; -}; // end class multiset - -} // end namespace fast - -#define JUNIPER_MULTISET fast::multiset -#define JUNIPER_SET fast::multiset - -#else -#include <set> -#define JUNIPER_MULTISET std::multiset -#define JUNIPER_SET std::set -#endif - diff --git a/juniper/src/vespa/juniper/sumdesc.h b/juniper/src/vespa/juniper/sumdesc.h index 0af1f2d3cd2..e80bf9ba9f2 100644 --- a/juniper/src/vespa/juniper/sumdesc.h +++ b/juniper/src/vespa/juniper/sumdesc.h @@ -61,7 +61,7 @@ protected: void add_desc(off_t pos, ssize_t len, bool highlight); - typedef JUNIPER_SET<MatchCandidate*,sequential_elem<MatchCandidate*> > cand_list; + typedef std::set<MatchCandidate*,sequential_elem<MatchCandidate*> > cand_list; typedef std::list<highlight_desc> print_list; /** Helper function to build a simple query highlight of the complete document */ |