C++ Logo

std-proposals

Advanced search

Re: Proposal - Allow '.' operator to work on pointers (again sortof)

From: J Decker <d3ck0r_at_[hidden]>
Date: Thu, 5 Mar 2020 09:14:30 -0800
On Thu, Mar 5, 2020 at 9:06 AM Matthew Woehlke via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 05/03/2020 06.29, J Decker via Std-Proposals wrote:
> > Smart pointers continue to work as they do, because they are an object
> that
> > contains a pointer to an object, and are not 'pointers'. they are of a
> > class type 'smart pointer', they are not pointers to a class of type
> 'smart
> > pointer'.
>
> So... now when I go to refactor my code, replacing a raw pointer with a
> smart pointer, my code now breaks, or worse, silently changes behavior?
>
> And that's the other place I was going to mention and keep forgetting.
This code I'm recently working on I was using a local struct to read into,
and subsequently was refactoring to just use a pointer into the cache the
record really is, and it was quite annoying to have to adjust what operator
I was using to get the object member values.

I see your point if you had also previously refactored to use '.' operator
instead of ->. But then again, that's what one can expect while
refactoring?


> No, thanks.
>
> --
> Matthew
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-03-05 11:17:26