Add a gather overload that infer element type
This commit is contained in:
parent
09e1ec97a9
commit
d2dac558e7
|
@ -53,7 +53,7 @@ template<typename Range>
|
|||
using IteratorOf = decltype(std::begin(std::declval<Range>()));
|
||||
|
||||
template<typename Range>
|
||||
using ValueOf = typename Range::value_type;
|
||||
using ValueOf = decltype(*std::declval<IteratorOf<Range>>());
|
||||
|
||||
template<typename Range>
|
||||
struct SkipView
|
||||
|
@ -450,6 +450,16 @@ auto gather()
|
|||
});
|
||||
}
|
||||
|
||||
template<template <typename Element> class Container>
|
||||
auto gather()
|
||||
{
|
||||
return make_view_factory([](auto&& range) {
|
||||
using std::begin; using std::end;
|
||||
using ValueType = std::remove_cv_t<std::remove_reference_t<decltype(*begin(range))>>;
|
||||
return Container<ValueType>(begin(range), end(range));
|
||||
});
|
||||
}
|
||||
|
||||
template<typename ExceptionType, size_t... Indexes>
|
||||
auto elements(bool exact_size = false)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user