函数指针 Vs std::function,一个追求零开销,一个拥抱灵活性。 前者是 C 的遗产,后者是 C++ 的契约。 选错一个,轻则多花几毫秒,重则触发堆分配,拖垮整个低延迟系统。 接下来我就详细的给你好好拆解一下,它们的区别到底在哪里。 一、一句话说清本质区别 函数指针:C ...
In the first part of this series, we covered the basics of pointers in C, and went on to more complex arrangements and pointer arithmetic in the second part. Both times, we focused solely on pointers ...