A lightweight wrapper for a key string.
A Key is constructed from a std::string_view
via Features::key() and is valid for all features within the same GOL. A Key created for one GOL cannot be used for lookups in another.
A Key object is useful in scenarios requiring lookups of the same tag across multiple features. It avoids the overhead of resolving the tag's global-string code on every lookup, leading to a performance boost of about 2x to 4x.
Key houseNumber = buildings.key(
"addr:housenumber");
{
TagValue hnSlow = building[
"addr:housenumber"];
}
A geographic feature.
Definition Feature.h:27
A lightweight wrapper for a key string.
Definition Key.h:42
The value of a Tag.
Definition TagValue.h:34
Key converts implicitly to std::string_view
.
- Warning
- The memory backing the
std::string_view
used to create this Key must remain unchanged and valid for the Key's entire lifetime to avoid undefined behavior.
- See also
- Tags, Feature