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


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)?



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at