|
Boost Users : |
Subject: Re: [Boost-users] [Preprocessor] Auitomatic switch generation for template class instanciation
From: Manfred Doudar (manfred.doudar_at_[hidden])
Date: 2008-11-23 20:04:05
On Sun, 23 Nov 2008 18:04:18 +0100
"Olivier Tournaire" <olitour_at_[hidden]> wrote:
> Thank you Manfred.
>
> [...]
>
> >
> > Looks like an awful lot of repetition, and would have to take a
> > closer look at your problem for advice on design. However, to get
> > you going, below is the Boost.PP work to do what you want - but
> > think even that could be done better..
> >
> >
> This is the design of the lib I use. The class I need is templated and
> policy based. Usually, when I know the instanciation I would like to
> have, I define a typedef and use it in the rest of the programm. Now,
> to be more generic, the programm need to let a user choose how to
> instanciate the class. If you have any idea about a better design, I
> will be very interesting in reading it.
>
Of the top of my head, you might want to look down Boost.variant - sure
enough under the hood it may probably be a glorified switch (don't
quote me on that), but your code will be all the better for it.
Cheers,
-- Manfred
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net