我从另一个零碎问题中借了这个问题,但我不赞成这个问题。 我更担心我根本不理解这一职能。 类型和数据寿命:
同一数据由以下几个方面构成:探测器(带有内部元数据的动态射线型)、该数据所载示意图器(回归参数)和申报的回归类型,后者是一个 st脚石。
QUESTIONS: How does the data get safely out of the function when the std::vector is going to be destroyed? Is it implicitly copied? Is the dynamic array of char in the vector detached from the vector and returned as a std::string type so that no bulk copy is required? Sometimes, I think that C++ and the std library is trying to get me...
I ve been using C++ for some while but stuff like this does my ed in.
std::string TestFragmentation()
{
std::vector<char> buffer(500);
SomeCApiFunction( &buffer[0], buffer.size() ); // Sets buffer to null-terminated string data
return &buffer[0];
}