https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106871
Bug ID: 106871
Summary: std::function should not check func ptr on each call
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: rockeet at gmail dot com
Target Milestone: ---
std::function should not check func ptr on each call, an optimization should
be:
define a 'default throw' function which just throws a std::bad_function_call.
in std::function constructor, set the function ptr to this 'default throw'
function. (assign nullptr also set this 'default throw' to std::function).
in this way, it is not needed to check the function ptr in each std::function
call. and the nullptr check can use any other 2 ptr-width fields of
std::function.