Dear Greg,

 

standardization is done by a lot of people in their free time or paid by their employers beside their normal work.

So your task will be more of convincing people and putting effort into your proposals (writing the paper, researching motivations, opinions, solutions, previous efforts).

"We all" are "C++ customers". This list will give you feedback and guidance. The decisions are made by ISO groups consisting of the same and other people according to your written proposal.

 

If you give good reasons, it could be that other people help with your proposal or (in rare cases) even take the task of writing it over from you.

 

 

You quickly wrote about two ideas, but did not give further details. It is quite difficult to understand, what you are exactly *proposing* (as you wrote in your first message to the list), how it would work in detail and what the difference (and advantages) is to solutions already possible.

 

For the class instace-re-use/re-init proposal:

- The constructors are not doing the memory operations. This comes before and depends:

   *automatic (local) variables

   * new

   * placement new

   * std::construct_at

   * std::allocator_traits::construct

   * std::unitialized_default/value_construct

  The current constructor is independent of those. It works with all ways. It just fills the memory, it resides in. Whether it was newly allocated or it is replacing existing content. What would your special function do different than an existing constructor, so that a new function is needed?

 - There are also move- and copy assignment operators as special member functions, which reset an existing object without destructing it first

 - What do you mean by "once-and-done"?

 - How and when would it be called? Manually? Or by the language? In what cases?

 - Everybody is free to create reset()-like functions for their classes. Would you make it mandatory? For all or certain classes? Would there be a default implementation? Which just destructs and constructs the object at the same place?

 

const-after-first-init could be solved with a setter member-function, which only accepts data, as long as the object is not initialized yet. Or with std::optional again or with factory functions. Or with views or with Facade patterns.


Best,

Sebastian


 

-----Ursprüngliche Nachricht-----
Von: Greg McPherran via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: So 14.08.2022 23:17
Betreff: Re: [std-proposals] Class Instance Re-Use/Re-Init
So, in summary, the two features that I am requesting as a C++ customer are:
  • Ctor-like re-init once-and-done special functions that are not available as normal functions after init just as ctor is not available as a normal function on an object.
  • const after first init
Thank You,
Greg McPherran