Namespaces
Variants
Actions

User talk:Bregma

From cppreference.com

Structure

Hi. I noticed while documenting the pseudo-random number facilities you began reimplementing article structure resembling that of the containers library, where one template is used in several articles. I'd like to offer some guidance.

The idea is that we use one template for a bunch of functions to increase maintainability. However, the function pages themselves are supposed to be unique, that is, the base template is passed the name of the distribution and the template then does necessary customizations by, for example, pulling correct sidebar. So essentially we end up with structure like this:

cpp/numeric/random/uniform_int_distribution
...
cpp/numeric/random/uniform_int_distribution/min ->  
  uses Template:cpp/numeric/random/distribution/min via 
  {{cpp/numeric/random/distribution/min|uniform_int_distribution}}
...
cpp/numeric/random/uniform_real_distribution
...
cpp/numeric/random/uniform_real_distribution/min -> 
  uses Template:cpp/numeric/random/distribution/min via 
  {{cpp/numeric/random/distribution/min|uniform_real_distribution}}
...

Template:cpp/numeric/random/distribution/min -> 
  contains the actual content specialized using {{{1}}}
  Includes e.g. {{cpp/numeric/random/{{{1|}}}/navbar}}
  which ends up being either Template:cpp/numeric/random/uniform_int_distribution/navbar or
  Template:cpp/numeric/random/uniform_real_distribution/navbar depending on the parameter 

Template:cpp/numeric/random/uniform_int_distribution/navbar ->
  sidebar for uniform_int_distribution

Template:cpp/numeric/random/uniform_real_distribution/navbar ->
  sidebar for uniform_real_distribution

You can see a lot of examples in the containers library, e.g. Template:cpp/container/empty, or a more complex Template:cpp/container/insert. The only difference that here all templates are mixed in one 'directory'. We can't do this in the pseudo-number library, since engines and distributions, while being different beasts, have functions with same names.

Hope that helps. If something is unclear, you can ask here and I'll try to explain.

P12 19:06, 29 October 2011 (PDT)