Does boost::flyweight do reference counting?

1k views Asked by At

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?

1

There are 1 answers

0
ildjarn On BEST ANSWER

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.