在工作中,经常会有c/c++的混合使用。但看到memcpy总是感觉不太安全,c++中有一个替代品std::copy,用起来还不错,而且std::copy不会有效率上的损失,放心用吧。迭代器的方式还安全些。
将int数组转换为vector
int inputArr[] = {1,2,3,4,5,6,7,8,9,10};
vector<int> outputVector(5);
copy(inputArr + 2, inputArr + 7, outputVector.begin());
std::copy和memcpy效率测试
[https://stackoverflow.com/questions/4707012/is-it-better-to-use-stdmemcpy-or-stdcopy-in-terms-to-performance]













![JSON.toJSONString/JSONObject.toJSONString将实体类对象转换成JSON字符串时,多出了params字符串[记录贴]](https://img-blog.csdnimg.cn/e4a3802a8cb9465bb8b6bc2973c1587b.png)






