From abac1b34bcb84d65ef857076321af3acd22a3c9b Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 23 Mar 2017 00:11:58 +0100 Subject: Core/Utilities: Rename RandomResizeList->RandomResize as it is no longer restricted to a list * Also fix gcc build (cherry picked from commit f097e341f5afcac2dd0ae9dbb265201c0de2a934) --- src/common/Utilities/Containers.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/common/Utilities/Containers.h') diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h index dc0f4d7c244..0a437b0e4d8 100644 --- a/src/common/Utilities/Containers.h +++ b/src/common/Utilities/Containers.h @@ -54,7 +54,7 @@ namespace Trinity } template - void RandomResizeList(C& container, std::size_t requestedSize) + void RandomResize(C& container, std::size_t requestedSize) { uint32 currentSize = uint32(Size(container)); while (currentSize > requestedSize) @@ -67,7 +67,7 @@ namespace Trinity } template - void RandomResizeList(C& container, Predicate&& predicate, std::size_t requestedSize) + void RandomResize(C& container, Predicate&& predicate, std::size_t requestedSize) { //! First use predicate filter C containerCopy; @@ -75,7 +75,7 @@ namespace Trinity if (requestedSize) { std::copy_if(std::begin(container), std::end(container), std::inserter(containerCopy, std::end(containerCopy)), predicate); - RandomResizeList(containerCopy, requestedSize); + RandomResize(containerCopy, requestedSize); } container = std::move(containerCopy); @@ -87,7 +87,7 @@ namespace Trinity * Note: container cannot be empty */ template - inline auto SelectRandomContainerElement(C const& container) -> decltype(*std::begin(container)) const& + inline auto SelectRandomContainerElement(C const& container) -> typename std::add_const::type& { auto it = std::begin(container); std::advance(it, urand(0, uint32(Size(container)) - 1)); @@ -104,7 +104,7 @@ namespace Trinity * Note: container cannot be empty */ template - auto SelectRandomWeightedContainerElement(C const& container, std::vector weights) -> decltype(std::begin(container)) + inline auto SelectRandomWeightedContainerElement(C const& container, std::vector weights) -> decltype(std::begin(container)) { auto it = std::begin(container); std::advance(it, urandweighted(weights.size(), weights.data())); -- cgit v1.2.3