changed return from choice to const ref
This commit is contained in:
		| @@ -26,13 +26,13 @@ namespace sc { | ||||
|             static double double_between(double from, double to); | ||||
|  | ||||
|             template <typename T> | ||||
|             static T choice(const std::vector<T>& vec) { | ||||
|             static const T& choice(const std::vector<T>& vec) { | ||||
|                 std::uniform_int_distribution<int> dist {0, static_cast<int>(vec.size()) - 1}; | ||||
|                 return vec[dist(instance()._reng)]; | ||||
|             } | ||||
|  | ||||
|             template <typename T, typename Iter> | ||||
|             static T choice(Iter from, Iter to) { | ||||
|             static const T& choice(Iter from, Iter to) { | ||||
|                 std::uniform_int_distribution<int> dist {0, static_cast<int>(to - from) - 1}; | ||||
|                 return *(from + dist(instance()._reng)); | ||||
|             } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Bob Polis
					Bob Polis