This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: Simplify _Rb_tree instantiation


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()
     { }


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