Вопрос

I've been reading the documentation of boost::flyweight but i don't see any mention to deallocation or reference counting policies. Basically a flyweight object should behave like a repository of distinct values, but its not clear what happens when a distinct value is not used anymore.

Is it already supported? can it be enabled with some custom factory?

Это было полезно?

Решение

As with most things in Flyweight, this behavior is dictated by policy, specifically by the Tracking Policy. The default tracking policy is refcounted:

Tracking Policy providing flyweight instantiations with reference counting semantics: when all the flyweight objects associated to a given value are destroyed, the corresponding entry is erased from flyweight's internal factory.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top