C++ Logo

std-proposals

Advanced search

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

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Sat, 30 Sep 2023 15:27:14 +0200
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_at_[hidden]> Gesendet:Sa 30.09.2023 13:08 Betreff:Re: [std-proposals] Let constructor know if object is const or volatile An:Edward Catmur <ecatmur_at_[hidden]>; CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>; std-proposals_at_[hidden]; 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 */  } -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-09-30 13:27:17