[Bug c++/95100] xxx_view adaptors don't work with pipeline operator

2020-05-16 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95100

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from Jonathan Wakely  ---
No, it's not a rewriting rule. It says that the library implementation needs to
give range adaptor objects an overloaded operator| that allows them to be used
that way.

There's no magical rewriting going on, just operator overloading. You can't
overload an operator to take a class template as an argument.

Class templates are not objects and objects are not class templates.

Not a bug and not a defect.

[Bug c++/95100] xxx_view adaptors don't work with pipeline operator

2020-05-15 Thread rhalbersma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95100

--- Comment #2 from rhalbersma  ---
OK, so the rewriting rules [range.adaptors]/4, that make views::xxx(R)
equivalent to R | views::xxx, do not allow to rewrite the expression equivalent
xxx_view{R} as R | xxx_view? That would be rather finicky, perhaps even a
defect in the Standard?

[Bug c++/95100] xxx_view adaptors don't work with pipeline operator

2020-05-15 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95100

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka  ---
(In reply to rhalbersma from comment #0)
> 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 

Hmm, I don't see anything in the spec that would imply views::xxx should be
expression-equivalent to xxx_view.  What I see is that views::xxx(E) is, for
some values of E, expression-equivalent to xxx_view{E}.

For instance [range.reverse.overview] says:

   Given a subexpression E, the expression views​::​reverse(E) is
expression-equivalent to: 
   [...]
   - Otherwise, equivalent to reverse_­view{E}.

Could you point me to the relevant bits of the spec that would imply this
stronger expression-equivalence?