Hi, thanks for the flyweight library, looks good.
Is there a way to enumerate all values in a factory? Consider my use case:
I have a large set of data. Each element has a user defined 'tag',
implemented as a flyweightstd::string. Now the user wants to find all
elements where the 'tag' matches a regex.
Calculating the regex match for all elements in the dataset is
expensive. If I could find all matching tags in the flyweight factory
first, searching the elements is reduced to comparing two flyweights
rather than doing a regex match.
Consider:
struct data {
flyweightstd::string m_tag;
};
vector<data> m_some_data;
The straight forward approach is costly:
for (iterator i=m_some_data.begin();
i!=m_some_data.end() && regex_match(*i);
++i)
;
with the regex match calculated for every element in the vector.
A much more efficient solution is to find all elements in the flyweight
factory that match the regex and then compare the flyweights.
vector