Add choose implementation for fixed size arrays
This commit is contained in:
parent
c3a268b2c3
commit
d6c0a821f4
@ -43,6 +43,12 @@ namespace util {
|
|||||||
return *cursor;
|
return *cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, size_t N>
|
||||||
|
T&
|
||||||
|
choose (T (&v)[N]) {
|
||||||
|
return v[static_cast<size_t> (random<float> () * N)];
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename T::value_type&
|
typename T::value_type&
|
||||||
choose (T begin, T end) {
|
choose (T begin, T end) {
|
||||||
|
Loading…
Reference in New Issue
Block a user