Fixed build [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-10-28 06:44:06 +03:00
parent 9c96d5c2ab
commit 33f56fc035

View File

@ -6,12 +6,14 @@
template <typename F, typename C> template <typename F, typename C>
struct RangeFiltered struct RangeFiltered
{ {
using RawIterator = typename C::iterator; /// Template parameter C may be const. Then const_iterator is used.
using RawIterator = decltype(std::declval<C>().begin());
class Iterator; class Iterator;
/// Will iterate over elements for which filter(*it) == true /// Will iterate over elements for which filter(*it) == true
RangeFiltered(F && filter, const C & container) template <typename F_, typename C_> /// Another template for universal references to work.
: filter(std::move(filter)), container(container) {} RangeFiltered(F_ && filter, C_ && container)
: filter(std::move(filter)), container(container) {}
Iterator begin() const Iterator begin() const
{ {
@ -114,12 +116,12 @@ struct RangeFiltered
protected: protected:
F filter; F filter;
const C & container; C & container;
}; };
template <typename F, typename C> template <typename F, typename C>
inline RangeFiltered<std::decay_t<F>, std::decay_t<C>> createRangeFiltered(F && filter, C && container) inline RangeFiltered<std::decay_t<F>, std::remove_reference_t<C>> createRangeFiltered(F && filter, C && container)
{ {
return {std::forward<F>(filter), std::forward<C>(container)}; return {std::forward<F>(filter), std::forward<C>(container)};
}; };