Commit 96af75c9 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

sampler.hh: fix uniform_sample()

parent 6bc2aa62
...@@ -149,9 +149,11 @@ auto uniform_sample_iter(Container& v, RNG& rng) ...@@ -149,9 +149,11 @@ auto uniform_sample_iter(Container& v, RNG& rng)
} }
template <class Iter, class RNG> template <class Iter, class RNG>
auto&& uniform_sample(Iter&& begin, const Iter& end, RNG& rng) typename std::iterator_traits<Iter>::reference
uniform_sample(const Iter& begin, const Iter& end, RNG& rng)
{ {
return *uniform_sample_iter(begin, end, rng); auto iter = uniform_sample_iter(begin, end, rng);
return *iter;
} }
template <class Container, class RNG> template <class Container, class RNG>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment