David Abrahams
Because Boost.Parameter is geared towards template type parameters, it might be easier to approach this problem by starting with a different interface for VariateSampler. Let's say:
template < class TGenerator, class TDistribution, class Algorithm
struct _VariateSampler : Sampler<TDistribution> {
};
where Algorithm is required to be a function (object) callable with TDistribution and TGenerator arguments. You can easily map it onto the default you've specified using:
template
struct default_algorithm { typename TDistribution::variate_t operator()(TDistribution const& d, TGenerator const& g) const { return d->sample_default(g); } }; Default selection might be done through a simple metafunction:
template <class T> struct is_PseudoRng;
template <class U> struct is_PseudoRng
: boost::mpl::true_ {}; ... mpl::if_
, default1, default2>::type ... HTH,
Thank you very much for your help.
However, I am a little confused about some details:
I suppose you meant using mpl::if_<...> to select one of the two following
funcion objects this way:
typedef mpl::if_