On Mon, 9 Dec 2024, 06:05 François Dumont, <frs.dum...@gmail.com> wrote:
> > On 04/12/2024 22:48, Jonathan Wakely wrote: > > On 04/12/24 19:27 +0100, François Dumont wrote: > >> Hi > >> > >> I've completed the synchronization with your equivalent PR for > >> std::list so here is the updated patch. > >> > >> PR updated a couple of days ago. > >> > >> Note that I've started to rework the patch for the same in _Hashtable. > > > > Great, thanks. > > > >> > >> #if __cplusplus < 201103L > >> void > >> - _M_construct_node(_Link_type __node, const value_type& __x) > >> + _M_construct_node(_Base_ptr __p, const value_type& __x) > > > > And can this be left as _Node_ptr instead of changed to _Base_ptr? > > Then it wouldn't need the static_cast, and the callers wouldn't need > > to use _M_base_ptr(). > > > > Logically, it has to be a _Node_ptr or the cast isn't valid anyway. > > > > There seem to be several places like this where we're giving up > > valuable type information by using _base_ptr instead of _Node_ptr. > > > > Is that really necessary? If we have a _Node_ptr we can always get a > > _Base_ptr easily by calling _M_base_ptr(). > > > > Is it a constness thing, because _M_begin() const was changed to > > return _Base_ptr instead of _Const_link_ptr? > > > No, just me being lazy and considering that as we store _Base_ptr we can > also use it everywhere. > > In this new version I've preserved _Node_ptr almost everywhere. > > But _M_begin() is still returning a _Base_ptr and I've introduced > _M_begin_node() for rare occasions when a _Node_ptr is needed. > > Note that I've hesitated to add a _S_nullptr() to get a _Base_ptr null > pointer. Is default constructor on fancy pointer type mandatory ? Yes, but default construction can give a singular value (like an uninitialized int*) so you want to use value initialization. So: pointer p = pointer(); Or in C++11: pointer p{}; And not just: pointer p; I fear > that only constructor from nullptr is mandatory. > Value init is required to work by the Cpp17NullablePointer requirements. > I've forced push on: > > https://forge.sourceware.org/gcc/gcc-TEST/pulls/27 Thanks, I'll take another look.