From 37498e3c0d48b77118839b653a65ac35a0618ecd Mon Sep 17 00:00:00 2001 From: Zoey Greer Date: Thu, 28 May 2015 16:50:13 -0400 Subject: [PATCH] Avoid passing large parameters by value Both the Engine and Distribution may be passed by const reference, which is best practice in this case to improve performance. This was uncovered by Coverity and is related to defect CID72373. --- include/boost/random/variate_generator.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/random/variate_generator.hpp b/include/boost/random/variate_generator.hpp index 6d5aac4e4..8252a0550 100644 --- a/include/boost/random/variate_generator.hpp +++ b/include/boost/random/variate_generator.hpp @@ -66,7 +66,7 @@ class variate_generator * Throws: If and what the copy constructor of Engine or * Distribution throws. */ - variate_generator(Engine e, Distribution d) + variate_generator(const Engine& e, const Distribution& d) : _eng(e), _dist(d) { } /** Returns: distribution()(engine()) */