Prev: Temporaries passed to constructor yield invalid member references
Next: Can there be parallel initialization of global variables in C++0x?
From: micode on 1 Jun 2010 22:51 Are there trait definitions and common names for the param_type access methods of std::random (i.e., #include <random>)? The distribution- specific names are sensible, but is there introspection support? Each distribution template defines a struct param_type { ... }, as well as access methods. Access methods are distribution-centric. For example, the first parameter is _RealType mean() for normal, double mean() for poisson, result_type a() for uniform, and _RealType a() for cauchy, weibull and extreme_value distributions. Summary of /usr/local/include/c++/4.5.0/bits/random.h (scalars only) is uniform_int_distribution, uniform_real_distribution result_type a() const { return _M_a; } result_type b() const { return _M_b; } cauchy_distribution, weibull_distribution, extreme_value_distribution _RealType a() const { return _M_a; } _RealType b() const { return _M_b; } normal_distribution\ _RealType mean() const { return _M_mean; } _RealType stddev() const{ return _M_stddev; } lognormal_distribution _RealType m() const { return _M_m; } _RealType s() const { return _M_s; } fisher_f_distribution _RealType m() const { return _M_m; } _RealType n() const { return _M_n; } gamma_distribution _RealType alpha() const { return _M_alpha; } _RealType beta() const { return _M_beta; } chi_squared_distribution, student_t_distribution _RealType n() const { return _M_n; } bernoulli_distribution, geometric_distribution double p() const { return _M_p; } binomial_distribution _IntType t() const { return _M_t; } double p() const { return _M_p; } negative_binomial_distribution _IntType k() const { return _M_k; } double p() const { return _M_p; } poisson_distribution double mean() const { return _M_mean; } exponential_distribution _RealType lambda() const { return _M_lambda; } -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |