diff --git a/cruft/util/ranges/adjacent.hpp b/cruft/util/ranges/adjacent.hpp index 5848940a..16934080 100644 --- a/cruft/util/ranges/adjacent.hpp +++ b/cruft/util/ranges/adjacent.hpp @@ -158,7 +158,7 @@ namespace cruft::ranges { decltype (auto) operator () (V &&v) const { - return adjacent_view ( + return adjacent_view, N> ( std::forward (v) ); } diff --git a/test/ranges/adjacent.cpp b/test/ranges/adjacent.cpp index 97cae2d6..15b95815 100644 --- a/test/ranges/adjacent.cpp +++ b/test/ranges/adjacent.cpp @@ -6,8 +6,8 @@ int main() { - static int constexpr INPUT[] = { 1, 1, 2, 3, 5, 8 }; - static int constexpr EXPECTED[][2] = { + static int const constexpr INPUT[] = { 1, 1, 2, 3, 5, 8 }; + static int const constexpr EXPECTED[][2] = { { 1, 1 }, { 1, 2 }, { 2, 3 }, @@ -17,8 +17,10 @@ int main() cruft::TAP::logger tap; + // Use a temporary in an attempt to trigger cvref related type errors when calling the range closure. + std::span input_span (INPUT); const bool same = std::ranges::equal ( - std::views::all (INPUT) | cruft::ranges::pairwise, + input_span | cruft::ranges::pairwise, EXPECTED, [] (auto const &a, auto const &b) { return std::ranges::equal (a, b); } );