C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Let constructor know if object is const or volatile

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sat, 30 Sep 2023 12:08:30 +0100
On Fri, Sep 29, 2023 at 7:15 PM Edward Catmur <ecatmur_at_[hidden]> wrote:
>
> Why not propose overloading the constructor on an explicit object parameter?
>
> Monkey::Monkey(this Monkey& self);
> Monkey::Monkey(this Monkey const& self);
>
> But you still haven't provided motivation.


I don't know how that didn't cross my mind. Another simple possibility:

Monkey::Monkey(void) { /* stuff in here */ }
Monkey::Monkey(void) const { /* stuff in here */ }
Monkey::Monkey(void) volatile { /* stuff in here */ }
Monkey::Monkey(void) const volatile { /* stuff in here */ }

Received on 2023-09-30 11:08:43