C++ Logo

std-proposals

Advanced search

Re: Proposal: Pattern Matching: Auto-dereference

From: Михаил Найденов <mihailnajdenov_at_[hidden]>
Date: Fri, 7 Feb 2020 09:15:25 +0200
On Thu, Feb 6, 2020 at 11:18 AM Viktor Kireev via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Monday, 3 February 2020 12:47:23 MSK Михаил Найденов via Std-Proposals
> wrote:
> > Hello, I present a (draft) proposal, which argues auto-dereference is
> > preferred over the dereference pattern in current Pattern Matching.
>
>

> I think this is a useful and convenient feature.
> I have two questions:
> 1. Who will decide which types can be implicitly dereferenced and which
> cannot?
>

Same rules as current (*?) pattern - expr. must be convertible to bool and
have operator star


> 2. What about std::weak_ptr?
> std::weak_ptr<Rect> r;
> inspect(r) {
> ???
> }
>

Yeah, weak_ptr will not work out of the box. An extractor could certainly
be used though.


>
> --
> Victor Kireev
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-02-07 01:18:17