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.
|
/// \return An iterator to the chosen value.
|
||||||
template <typename ContainerT, typename GeneratorT>
|
template <typename ContainerT, typename GeneratorT>
|
||||||
typename ContainerT::iterator
|
decltype(auto)
|
||||||
choose (ContainerT &data, GeneratorT &&gen)
|
choose (ContainerT &data, GeneratorT &&gen)
|
||||||
{
|
{
|
||||||
if (data.empty ())
|
if (data.empty ())
|
||||||
@ -235,7 +235,7 @@ namespace cruft::random {
|
|||||||
///
|
///
|
||||||
/// \return An iterator to the chosen value.
|
/// \return An iterator to the chosen value.
|
||||||
template <typename ContainerT>
|
template <typename ContainerT>
|
||||||
typename ContainerT::iterator
|
decltype(auto)
|
||||||
choose (ContainerT &data)
|
choose (ContainerT &data)
|
||||||
{
|
{
|
||||||
return choose (data, generator ());
|
return choose (data, generator ());
|
||||||
|
Loading…
Reference in New Issue
Block a user