C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Proposal for Uniform Forward And Move

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 26 Jun 2023 14:37:49 +0100
On Mon, Jun 26, 2023 at 7:47 AM Kevin Schmidt via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> auto ptr = &&std::unique_ptr<int>(new int(3));


I was about to say to you that that will break existing code, but then
I realised that the following fails to compile:

class MyClass {
    int n;
public:
    int &operator&(void)
    {
        return n;
    }
};

int main(void)
{
    MyClass obj;

    auto monkey = &&obj; // This line doesn't compile because '&&' is
globbed as one token

    auto monkey = &(&obj); // This compiles fine
}

Received on 2023-06-26 13:38:02