Topic: c++0x rand.dist: param_type?
Author: Ares Lagae <ares.lagae@gmail.com>
Date: Tue, 22 Jun 2010 16:41:38 CST Raw View
Hi all,
Can someone explain the goal of param and param_type in all the random
number distribution class templates?
Thanks,
Ares Lagae
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: =3D?ISO-8859-1?Q?Daniel_Kr=3DFCgler?=3D <daniel.kruegler@googlemail.c=.om>
Date: Wed, 23 Jun 2010 13:12:26 CST Raw View
On Jun 23, 12:41 am, Ares Lagae <ares.la...@gmail.com> wrote:
> Hi all,
>
> Can someone explain the goal of param and param_type in all the random
> number distribution class templates?
A meaningful use-case is, that you can write generic code
- aka template code - that works for every type that satisfies
the requirements for a random number distribution, e.g.
template<class D>
typename D::param_type compute(D& distr, const typename D::param_type&
p) {
distr.param(p);
...
std::cout << distr;
std::cin >> distr;
return d.param();
}
See also the proposal document
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1933.pdf
section 4.4.2 (page 4).
HTH & Greetings from Bremen,
Daniel Kr=FCgler
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: Ares Lagae <ares.lagae@gmail.com>
Date: Sat, 26 Jun 2010 14:08:16 CST Raw View
I haven't though of that, it makes sense.
Thanks for your reply.
Best regards,
Ares
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]