Hi everyone, the following snippet with views::filter has been building fine under v0.9.1, but it is not building under v0.10.0. For some reason, the std::vector is considered to be a predicate.
#include <range/v3/all.hpp>
#include <vector>
int main()
{
std::vector<long> xs;
ranges::views::filter(xs, [](long x) { return x < 5; });
}
The error is:
floop@pine /tmp g++ -std=c++17 filter.cpp
filter.cpp: In function ‘int main()’:
filter.cpp:7:59: error: call of ‘(const ranges::views::filter_fn) (std::vector<long int>&, main()::<lambda(long int)>)’ is ambiguous
7 | ranges::views::filter(xs, [](long x) { return x < 5; });
| ^
In file included from /usr/include/range/v3/view.hpp:41,
from /usr/include/range/v3/all.hpp:25,
from filter.cpp:1:
/usr/include/range/v3/view/filter.hpp:108:28: note: candidate: ‘constexpr auto ranges::views::filter_fn::operator()(Pred, Proj) const [with Pred = std::vector<long int>; Proj = main()::<lambda(long int)>]’
108 | constexpr auto operator()(Pred pred, Proj proj) const
| ^~~~~~~~
/usr/include/range/v3/view/filter.hpp:57:28: note: candidate: ‘constexpr concepts::return_t<ranges::filter_view<decltype (ranges::views::{anonymous}::all(declval<Rng>())), Pred>, typename std::enable_if<(((viewable_range<Rng> && input_range<Rng>) && indirect_unary_predicate<Pred, decltype (ranges::{anonymous}::begin(declval<Rng&>()))>) && concepts::detail::CPP_true(concepts::detail::Nil{})), void>::type> ranges::views::cpp20_filter_base_fn::operator()(Rng&&, Pred) const [with Rng = std::vector<long int>&; Pred = main()::<lambda(long int)>; concepts::return_t<ranges::filter_view<decltype (ranges::views::{anonymous}::all(declval<Rng>())), Pred>, typename std::enable_if<(((viewable_range<Rng> && input_range<Rng>) && indirect_unary_predicate<Pred, decltype (ranges::{anonymous}::begin(declval<Rng&>()))>) && concepts::detail::CPP_true(concepts::detail::Nil{})), void>::type> = ranges::filter_view<ranges::ref_view<std::vector<long int> >, main()::<lambda(long int)> >]’
57 | constexpr auto operator()(Rng && rng, Pred pred) const
|
Hi everyone, the following snippet with
views::filter
has been building fine under v0.9.1, but it is not building under v0.10.0. For some reason, thestd::vector
is considered to be a predicate.The error is:
gcc version 9.2.0 (GCC)
clang version 9.0.0 (tags/RELEASE_900/final)