Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有类似于内置 bsearch 的东西,如果相同的元素不存在,则返回立即较小的元素,仅当元素已经小于所有其他元素时返回 NULL。这将要求用户检查返回值的键是否与函数参数相同,但它本身就非常有用。谢谢。
它不以你想要的方式存在。你需要实现它。
据我所知,标准库中没有这样的功能。但是你自己做这件事或找一个图书馆应该不难。