Is there a standalone implementation of std::function?

前端 未结 2 1412
盖世英雄少女心
盖世英雄少女心 2021-01-04 05:51

I\'m working on an embedded system, so code size is an issue. Using the standard library ups my binary size by about 60k, from 40k to 100k. I\'d like to use std::function, b

2条回答
  •  鱼传尺愫
    2021-01-04 06:43

    The 60k came from exception handling being added by the compiler, because exceptions were required for std::function. std::function only throws one exception, "bad_function_call". So I removed the code that threw the exception, now it seg faults if an empty function is called, and I saved myself 60k.

提交回复
热议问题