This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/81000] std::any improvement
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Jun 2017 22:54:54 +0000
- Subject: [Bug ipa/81000] std::any improvement
- Auto-submitted: auto-generated
- References: <bug-81000-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81000
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #2)
> (Of course, a different implementation of std::any might be easier to
> optimize)
>From a quick test, if instead of storing a pointer to _S_manage we store a
pointer to an array of function pointers (or a tuple so the types don't have to
be identical) where each function does only one of the tasks (clone, xfer,
etc), then with __attribute__(flatten) on f we manage to optimize to return 10.
I am not claiming that would be a better implementation, it is the first time I
take a look at std::any.