random: use decltype for choose
return type
This simplifies support for const-ref arguments
This commit is contained in:
parent
60b0d1d05d
commit
3bf2c2205d
@ -211,7 +211,7 @@ namespace cruft::random {
|
||||
//
|
||||
/// \return An iterator to the chosen value.
|
||||
template <typename ContainerT, typename GeneratorT>
|
||||
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>
|
||||
typename ContainerT::iterator
|
||||
decltype(auto)
|
||||
choose (ContainerT &data)
|
||||
{
|
||||
return choose (data, generator ());
|
||||
|
Loading…
Reference in New Issue
Block a user