This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
densities() functions?Section: 29.5.9.6.2 [rand.dist.samp.pconst] Status: C++11 Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [rand.dist.samp.pconst].
View all issues with C++11 status.
Discussion:
Addresses US-134
These two distributions have a member function called
densities() which returns a vector<double>. The
distribution is templated on RealType. The distribution
also has another member called intervals() which returns
a vector<RealType>. Why doesn't densities return
vector<RealType> as well? If RealType is long double,
the computed densities property isn't being computed to
the precision the client desires. If RealType is float, the
densities vector is taking up twice as much space as the client desires.
[ Resolution proposed by ballot comment: ]
Change the piecewise constant and linear distributions to hold / return the densities in a
If this is not done, at least correct 29.5.9.6.2 [rand.dist.samp.pconst] p. 13 which describes the return of densities as avector<result_type>.vector<result_type>.
[ Batavia 2010: After reviewing this issue, the working group concurred with the first of the suggestions proposed by the NB comment: "Change the piecewise constant and linear distributions to hold/return the densities in a vector. " ]
[ Adopted at 2010-11 Batavia ]
Proposed resolution:
piecewise_constant_distribution synopsis
and the prototype description 29.5.9.6.2 [rand.dist.samp.pconst] before p. 13 as indicated:
vector<doubleresult_type> densities() const;
piecewise_linear_distribution synopsis
and the prototype description 29.5.9.6.3 [rand.dist.samp.plinear] before p. 13 as indicated:
vector<doubleresult_type> densities() const;