When to use the Flyweight Pattern

Posted by elmt on Stack Overflow See other posts from Stack Overflow or by elmt
Published on 2010-06-06T05:07:06Z Indexed on 2010/06/06 5:12 UTC
Read the original article Hit count: 276

Filed under:
|
|

So I've just gotten on the boost train and was checking out the flyweight pattern and was interested in implementing it in my project. Obviously, it doesn't make sense to use it on any class that has only has one instance of it. However, say I have 5 instances of an class. Should I be using the flyweight pattern or should it be only used for a class that has at least N instances. I realize that many factors will influence this answer (how many fields there are, the size of the fields, etc.).

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost