Hi Edward, hi Frederick,

 

about the first syntax:

Using a const explicit object parameter for the constructor would be strange, if the this pointer is actually non-const during construction, even if the object is const.

 

Best,

Sebastian
 

-----Ursprüngliche Nachricht-----
Von: Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Sa 30.09.2023 13:08
Betreff: Re: [std-proposals] Let constructor know if object is const or volatile
An: Edward Catmur <ecatmur@googlemail.com>;
CC: Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>; std-proposals@lists.isocpp.org;
On Fri, Sep 29, 2023 at 7:15 PM Edward Catmur <ecatmur@googlemail.com> 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 */  }
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals