C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] Allow '.' to behave like '->' where it is currently an error

From: J Decker <d3ck0r_at_[hidden]>
Date: Fri, 28 Feb 2020 04:43:31 -0800
On Fri, Feb 28, 2020 at 2:24 AM Florian Weimer <fweimer_at_[hidden]> wrote:

> * J. Decker via Liaison:
>
> > that behavior does not generate an error; and it was mentioned all the
> > other `_ptr` types (unique_ptr) being part of that.
>
> The problem is that with the proposal, it becomes a clearly
> backwards-incompatible change to add any (maybe even private) member to
> smart pointer classes such as std::unique_ptr. I'm not sure if that
> is what we want.
>

again, `unique_ptr<char>` declares an instance of a class, and '.' operator
really doesn't have any special meaning, it's that these classes also
provide `operator->` overload so they can return their content...

>
> I think it would possible to add new functionality to smart pointer
> classes using argument-dependent lookup instead of member functions,
> so there is a way out.
>

smart pointers are not available to C code, so this is no solution for that.


>
> Thanks,
> Florian
>
>

Received on 2020-02-28 06:46:27