Simplify _Rb_tree instantiation

Jonathan Wakely jwakely@redhat.com
Fri May 25 19:16:00 GMT 2018


On 25/05/18 21:35 +0300, Ville Voutilainen wrote:
>On 25 May 2018 at 19:50, François Dumont <frs.dumont@gmail.com> wrote:
>> Hi
>>
>> As we are at working on associative containers I'd like to propose this last
>> patch to remove the copy constructible constraint on the _Compare functor
>> when it is supposed to be default constructed.

The type is required to be CopyConstructible, so copying it into place
is confirming. But avoiding that copy might be more efficient, so
seems worthwhile.

>> This way the _Compare is built directly at its final place.
>
>Why is this patch removing _Compare() calls? That changes the initialization
>of _Compare from value-initialization to default-initialization, which
>is a breaking change.

The _Rb_tree_key_compare base class will still value-initialize it:

      _Rb_tree_key_compare()
      _GLIBCXX_NOEXCEPT_IF(
	is_nothrow_default_constructible<_Key_compare>::value)
      : _M_key_compare()
      { }



More information about the Libstdc++ mailing list