From 3bf2c2205d59a4c95abd824e0ee2c8bd130145a7 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 14 Dec 2020 13:08:39 +1000 Subject: [PATCH] random: use decltype for `choose` return type This simplifies support for const-ref arguments --- random.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/random.hpp b/random.hpp index c6a4e367..f9c4aece 100644 --- a/random.hpp +++ b/random.hpp @@ -211,7 +211,7 @@ namespace cruft::random { // /// \return An iterator to the chosen value. template - typename ContainerT::iterator + decltype(auto) choose (ContainerT &data, GeneratorT &&gen) { if (data.empty ()) @@ -235,7 +235,7 @@ namespace cruft::random { /// /// \return An iterator to the chosen value. template - typename ContainerT::iterator + decltype(auto) choose (ContainerT &data) { return choose (data, generator ());