struct AttributeAccessorFunctions { bool (*exists)(const void *data, StringRef name); GVArray try_get(const void *data, StringRef name); void try_create(void *data, StringRef name); }; class AttributesAccessor { protected: void *data_; const AttributeAccessorFunctions *accessors_; public: bool exists(const StringRef name) const { return accessors_->exists(data_, name); } GVArray try_get(const StringRef name) const { return accessors_->try_get(data_, name); } }; class MutableAttributes : public Attributes { public: void try_create(const StringRef name) { accessors_->try_create(name); } }; void test(const Mesh *mesh) { GVArray attribute = curves.attributes().get("test"); Attributes mesh_attributes = bke::mesh_attributes(*mesh); MutableAttributes mutable_attributes = bke::mesh_attributes_for_write(*mesh); }