Bug 56551 - A faster implementation of std::function
Summary: A faster implementation of std::function
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.8.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ABI
: 106871 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-03-06 15:22 UTC by Marton
Modified: 2022-09-07 12:28 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marton 2013-03-06 15:22:57 UTC
It would be great if the clever implementation of std::function presented on the following page could find its way into libstdc++.

http://probablydance.com/2013/01/13/a-faster-implementation-of-stdfunction/

> The code is in the public domain (I want all library writers to start using it)
> and here is a download link: http://dl.dropbox.com/u/27990997/function.h
Comment 1 Jonathan Wakely 2013-03-06 16:24:20 UTC
I've only glanced at the code but it's good to see you support passing an Allocator to the constructor (though it should use std::allocator_traits to support C++11 allocators)

I was thinking of making some big changes to our std::function for GCC 4.9 in order to support custom allocators.
Comment 2 malteskarupke 2013-03-09 23:17:03 UTC
I've uploaded a new version that uses std::allocator_traits. It's behind the same download link as before.
Comment 3 Jonathan Wakely 2022-09-07 11:59:23 UTC
*** Bug 106871 has been marked as a duplicate of this bug. ***
Comment 4 Jonathan Wakely 2022-09-07 12:01:23 UTC
As I just wrote on the duplicate bug:

I've looked into this and I don't think it can be done without an ABI break. Objects constructed in old code compiled by an older GCC would still have a null pointer, so code compiled by a new GCC can't assume that the pointer is never null.