public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95100] New: <ranges> xxx_view adaptors don't work with pipeline operator
@ 2020-05-13  8:37 rhalbersma at gmail dot com
  2020-05-15 14:10 ` [Bug c++/95100] " ppalka at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rhalbersma at gmail dot com @ 2020-05-13  8:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95100

            Bug ID: 95100
           Summary: <ranges> xxx_view adaptors don't work with pipeline
                    operator
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rhalbersma at gmail dot com
  Target Milestone: ---

Combining the std::ranges::xxx_view adaptors with the pipeline operator does
not compile, in contrast to the supposedly expression equivalent
std::ranges:views::xxx 

#include <iostream>
#include <ranges> 
#include <vector>

int main() {
    auto v = std::vector { 1, 2, 3, 4, 5, 6 };

    // OK
    for (auto elem : std::ranges::views::reverse(v)) {
        std::cout << elem << ',';
    }

    // OK    
    for (auto elem : std::ranges::reverse_view(v)) {
        std::cout << elem << ',';
    }

    // OK
    for (auto elem : v | std::ranges::views::reverse) {
        std::cout << elem << ',';
    }

    // error: missing template arguments before ')' token
    for (auto elem : v | std::ranges::reverse_view) {
        std::cout << elem << ',';
    }

    // OK
    for (auto elem : v | std::ranges::views::transform([](auto e) { return e +
1; })) {
        std::cout << elem << ',';
    }    

    // error: class template argument deduction failed:
    for (auto elem : v | std::ranges::transform_view([](auto e) { return e + 1;
})) {
        std::cout << elem << ',';
    }
}

See online example on Wandbox here:
https://wandbox.org/permlink/E6ScFmm8DdmkFo74

Tested this also for drop_view, take_view, filter_view etc., with similar
results (not shown for brevity in the code snippet).

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-16  9:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13  8:37 [Bug c++/95100] New: <ranges> xxx_view adaptors don't work with pipeline operator rhalbersma at gmail dot com
2020-05-15 14:10 ` [Bug c++/95100] " ppalka at gcc dot gnu.org
2020-05-15 22:54 ` rhalbersma at gmail dot com
2020-05-16  9:02 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).