Boost logo

Boost Users :

Subject: [Boost-users] boost parameter with template
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-07-18 13:39:27


Hello,

I would like to write a class with static methods for calculating
different distributions. The algorithmens of the distribution are
complet, so now I would like to put them together. Finally I would
like to have only one method for using the distribution call, like:

template<typename T> static T getDistribution( const distribution&,
<arguments> )

I have set distribution to an enum to check the kind of distribution
(normal, uniform, bernoulli, ...), so
I need for <arguments> a flexible number of arguments of float / double.

I've test the cstdargs, but it isn't the right structure, so I have
seen the "boost parameter", but I don't understand how to create a
function within my class and create a template variable in it.
My getDistribution function should have one fix parameter, the first,
with a name of the distrivution, and 1 or 2 parameters which are
optional with default values for the distribution.

Is there a complete example how to use the boost parameter (a full
source code)?

Thanks

Phil



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