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.
我正在将一个项目移植到 iPhone 上,它使用realloc但memcpy没有找到。要包含的标题是什么?
realloc
memcpy
这是一个混合了 Objective C 和 C++ 的项目,我开始迷路了。
在此先感谢您的帮助!
在 C 中:
#include <string.h> // memcpy #include <stdlib.h> //realloc
在 C++ 中,删除.h带有 . 的 and 前缀c。在 C++ 中,它们将被放置在std命名空间中,但也是全局的。
.h
c
std
std::copy在 C++ 中,它比 C更习惯使用memcpy,尽管后者也同样有效。要得到std::copy,你需要#include <algorithm>。
std::copy
#include <algorithm>
但是,没有直接的 C++ 等价于realloc。