function object
std::ranges::sample
- Header
<algorithm>- Draft
- [alg.random.sample]
- Scope
std::ranges- cppreference
- std::ranges::sample
Synopsis
inline constexpr /* implementation-defined */ sample = {};Call signatures
sample is a function object; these are its call operators as libycxx declares them, written as the functions the draft declares.
- (1)
template<std::ranges::input_range R, std::weakly_incrementable O, class Gen> requires (std::ranges::forward_range<R> || std::random_access_iterator<O>) && std::indirectly_copyable<iterator_t<R>, O> && std::uniform_random_bit_generator<std::remove_reference_t<Gen>> O sample(R&& r, O out, std::ranges::range_difference_t<R> n, Gen&& g); - (2)
template< std::input_iterator I, std::sentinel_for<I> S, std::weakly_incrementable O, class Gen> requires (std::forward_iterator<I> || std::random_access_iterator<O>) && std::indirectly_copyable<I, O> && std::uniform_random_bit_generator<std::remove_reference_t<Gen>> O sample(I first, S last, O out, std::iter_difference_t<I> n, Gen&& g);