consider adding algorithm for repeating values a specified number of times
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 487
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 296
Description
e.g. repeat([A,B,C,D],[2,3,0,4]) -> [A,A,B,B,B,D,D,D,D]
fill_by_count may be a better name as this is a generalization of fill_n
```
template
OutputIterator fill_by_count(counts_first, counts_last, values_first, result);
```
The semantics would be as if it were implemented as
```
for(; counts_first != counts_last; ++counts_first, ++values_first)
{
result = fill_n(result, *counts_first, *values_first);
}
return result;
```
Yes, fill_by_count is better because it connotes the fact that the counts should be non-negative integers. Here's a parallel implementation:
http://code.google.com/p/thrust/source/browse/examples/expand.cu
Forwarded from http://code.google.com/p/thrust/issues/detail?id=458
Contributor guide
Assessment
This issue has not been assessed yet.