[v3] Optimize the default constructors of the sampling distributions

Paolo Carlini paolo.carlini@oracle.com
Wed Oct 13 13:44:00 GMT 2010


Hi,

when I fixed very easily the small issue with the call operator of
piecewise_linear_distribution segfaulting for the default constructed
object, I noticed that indeed the call operators of *all* the sampling
distributions were easy to tweak to deal at the outset with the special
case of a default constructed object, with no need to extract
information from the std::vector data members of param_type. Thus the
idea of uniformly having such data members empty (ie, default
constructed) for the default constructed object (and also all the cases
where the input parameters are equivalent to the default constructed
case, in this way operator== still works fine, see the _M_initialize
changes), thus speeding up the constructor and avoiding allocating
dynamic memory.

I'm finishing testing the below, on x86_64-linux multilib.

Paolo.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_random
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20101013/012b5526/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_random
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20101013/012b5526/attachment-0001.ksh>


More information about the Libstdc++ mailing list