
Does boost have an abstract factory? I'm reading through Alexandrescu's "Modern C++ Design" and finding the idea neat, and I'm surprised to not find an equivalent in boost. Or alternately, is there another preferred solution?

Jason Felice wrote:
Does boost have an abstract factory? I'm reading through Alexandrescu's "Modern C++ Design" and finding the idea neat, and I'm surprised to not find an equivalent in boost. Or alternately, is there another preferred solution?
Why would you need a library solution to implement an abstract factory? The class structure of the AF pattern is highly dependent on your needs, but is rather simple to write. I can't think of any library solution that would make the job easier. Can you explain what it is you are looking for? -- Michiel Helvensteijn

Michiel Helvensteijn wrote:
Why would you need a library solution to implement an abstract factory? The class structure of the AF pattern is highly dependent on your needs, but is rather simple to write. I can't think of any library solution that would make the job easier.
I don't have it in front of me, but in essence, "Modern C++ Design" describes: (1) a template that, when instantiated with a type list, provides a class with separate pure virtual methods for instantiating each type in the type list (2) another template that provides a concrete implementation of (1) based on another type list (Note that the types in (2) are derived from the types in (1). The types in (1) are normally just abstract). While it's not hard to code by hand, it is a lot of hand-written, repetitive code. All of the dull, mind-numbing sort.
Can you explain what it is you are looking for?
I don't have a particular problem to solve at the moment, I'm just a chronic self-study. It's a class of problem I've worked with before.

----- Original Message -----
From: "Jason Felice"
Why would you need a library solution to implement an abstract factory? The class structure of the AF pattern is highly dependent on your needs, but is rather simple to write. I can't think of any library solution that would make the job easier.
I don't have it in front of me, but in essence, "Modern C++ Design" describes: (1) a template that, when instantiated with a type list, provides a class with separate pure virtual methods for instantiating each type in the type list (2) another template that provides a concrete implementation of (1) based on another type list (Note that the types in (2) are derived from the types in (1). The types in (1) are normally just abstract). While it's not hard to code by hand, it is a lot of hand-written, repetitive code. All of the dull, mind-numbing sort.
Can you explain what it is you are looking for?
I don't have a particular problem to solve at the moment, I'm just a chronic self-study. It's a class of problem I've worked with before. Hi, There were some post respect to the factory pattern recently in the user and developement ML. Anyway, Tobias Schwinger's Boost.Functional/Factory library was accepted into boost last year (http://lists.boost.org/boost-announce/2007/12/0161.php), http://www.boostpro.com/vault/index.php?&direction=0&order=&directory=X-Files Here is a link to an article and code for another library some one has posted also recently http://arcticinteractive.com/2008/10/06/boost-centric-factory-pattern-implem... Vicente
participants (3)
-
Jason Felice
-
Michiel Helvensteijn
-
vicente.botet