This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for stl_tree.h and cpp_type_traits.h.


Hi Dhruv,

I think your proposed changes to stl_tree.h can go a little bit further to
simplifying things...

The _Rb_tree_impl class constructor can be added to so that the
_M_empty_initialize() function can be removed entirely.

This will allow the copy constructor can be simplified to something like:
_Rb_tree(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x)
 : _M_impl(__x.get_allocator(), __x._M_impl._M_key_compare())
{
  if (__x._M_root() != 0)
  {
    _M_root() = _M_copy(__x._M_begin(), _M_end());
    _M_leftmost() = _S_minimum(_M_root());
    _M_rightmost() = _S_maximum(_M_root());
    _M_impl._M_node_count = __x._M_impl._M_node_count;
  }
}

Cheers,

Gawain



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]