Commit 220cd929 authored by Volker Krause's avatar Volker Krause
Browse files

Make tags and tag keys generally comparable

We need that in multiple places.
parent b0e9d066
......@@ -213,6 +213,9 @@ public:
QByteArray value;
};
inline constexpr bool operator<(const Tag &lhs, TagKey rhs) { return lhs.key < rhs; }
inline constexpr bool operator<(TagKey lhs, const Tag &rhs) { return lhs < rhs.key; }
/** An OSM node. */
class KOSM_EXPORT Node {
public:
......@@ -378,7 +381,7 @@ private:
template <typename Elem>
inline QByteArray tagValue(const Elem& elem, TagKey key)
{
const auto it = std::lower_bound(elem.tags.begin(), elem.tags.end(), key, [](const auto &lhs, const auto &rhs) { return lhs.key < rhs; });
const auto it = std::lower_bound(elem.tags.begin(), elem.tags.end(), key);
if (it != elem.tags.end() && (*it).key == key) {
return (*it).value;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment