|
Boost Users : |
From: StephQ (pelux_at_[hidden])
Date: 2007-11-26 19:51:31
Thank you for your previous help with the Boost. Parameter library, I have been
able to solve my problem.
I would like to know if is it possible in any way to exploit the Boost.
Parameter library to get a template class with a constructor that automatically
deduce the correct template parameters.
If not I would like to know if there exist a convenient way to minimize the pain
resulting from template classes.
For example now I have to write:
VariateSampler<
GaussianDistribution,
MersenneTwisterPseudoRng>
gaussianSampler( myGenerator, GaussianDistribution() );
Creating a make_VariateSampler function alone does not buy me anything.
I would
like to write:
I would really like to write:
VariateSampler<> gaussianSampler = make_VariateSampler( myGenerator,
GaussianDistribution() );
VariateSampler<> poissonSampler = make_VariateSampler( myGenerator,
PossionDistribution() );
and gaussianSampler and poissonSampler be of different types
(deduced from the rhs):
gaussianSampler of type
VariateSampler<MersenneTwisterPseudoRng,GaussianDistribution>
and poissonSampler of type
VariateSampler<MersenneTwisterPseudoRng,PoissonDistribution>
Now, these types are not complicated, but I am using a template decorator
approach to modify the behaviour of these samplers and the resulting types are
too nasty for anyone to write them.
How could I improve the situation? Something like boost::function for classes?
The point is that I (the user) could not care less about these types, only the
sampler class needs to know them to operate correctly.
Do I have necessarily to create them (via a make_VariateSampler) and pass them
on the fly where needed?
Thank you
StephQ
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