It looks to me like vtzero::feature depends on having a pointer to its vtzero::layer object (specifically for getting property data):
|
inline property feature::next_property() { |
|
const auto idxs = next_property_indexes(); |
|
property p{}; |
|
if (idxs.valid()) { |
|
p = {m_layer->key(idxs.key()), |
|
m_layer->value(idxs.value())}; |
|
} |
|
return p; |
|
} |
However, this requirement isn’t enforced--it's possible, for instance, to do:
vtzero::feature getFeature(vtzero::tile tile, std::string layer, uint64_t id) {
return tile.get_layer_by_name(layer).get_feature_by_id(id);
}
and end up with a feature whose owning layer has been destroyed.
Since presumably the overhead of enforcing this with a shared_ptr would be undesirable, would it make sense to at least make a note of this in the documentation for feature?
It looks to me like
vtzero::featuredepends on having a pointer to itsvtzero::layerobject (specifically for getting property data):vtzero/include/vtzero/layer.hpp
Lines 388 to 396 in 62d2640
However, this requirement isn’t enforced--it's possible, for instance, to do:
and end up with a
featurewhose owninglayerhas been destroyed.Since presumably the overhead of enforcing this with a
shared_ptrwould be undesirable, would it make sense to at least make a note of this in the documentation forfeature?