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] |
On 16 March 2017 at 00:31, Jonathan Wakely <jwakely@redhat.com> wrote: >> emplace(_Args&&... __args) >> { >> __do_emplace<_Decay<_ValueType>> >> (std::forward<_Args>(__args)...); >> + return *(std::any_cast<_Decay<_ValueType>>(this)); > > > Can we avoid the branch in any_cast to check the stored type? > We know it's the right type, because we just stored it. While I would hope the compiler to be smart enough to realize some of that (we are passing in this), the other branches might not be so easy. But certainly, we can axe every one of the extraneous branches, like in the attached amendment.
Attachment:
lwg2857_nobranches.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |