What is an std::uniform_real_distribution<>::param_type?

Viewed 38

When calling an std::uniform_read_distribution<>, there is an option to specify the range by passing a param_type. dist(generator, decltype(dist)::param_type{1, 2}) seems to work, but I can't find where param_type is defined. Can someone explain what it is or provide a link to its definition in cppreference or the standard?

1 Answers

I looked through the docs more carefully and it turns out I missed it earlier.

cppreference

P, the type named by D::param_type, which

  • satisfies CopyConstructible
  • satisfies CopyAssignable
  • satisfies EqualityComparable
  • has a constructor taking identical arguments as each of the constructors of D that - take arguments corresponding to the distribution parameters.
  • has a member function with the identical name, type, and semantics, as every member function of D that returns a parameter of the distribution
  • declares a member typedef using distribution_type = D;

C++17 Standard

  1. P shall satisfy the requirements of CopyConstructible, CopyAssignable, and EqualityComparable types.
  2. For each of the constructors of D taking arguments corresponding to parameters of the distribution, P shall have a corresponding constructor subject to the same requirements and taking arguments identical in number, type, and default values. Moreover, for each of the member functions of D that return values corresponding to parameters of the distribution, P shall have a corresponding member function with the identical name, type, and semantics.
  3. P shall have a declaration of the form using distribution_type = D;
Related