I m looking for an efficient method for appending multiple strings.
The way it should work is C++ std::string::append or JAVA StringBuffer.append.
我写了一种功能,实际上真实地真实了原发源人,确实是cat。
我认为,这不是一种有效的方法,因为汇编者可以实施这种免费的小型活动。
Other way I could think of (like std::vector) is allocate memory in bulk (1KB for eg) and do strcpy. In that case every append call will check if the total required allocation is more than (1200 bytes) the amount allocated in bulk, realloc to 2KB. But in that case there will be some memory wasted.
我期望在以上两点之间取得平衡,但优先选择是业绩。
还有其他可行的办法。 建议。