What I am trying to do is to save multiple different pointers to unique wchar_t
strings into a vector. My current code is this:
std::vector<wchar_t*> vectorOfStrings;
wchar_t* bufferForStrings;
for (i = 0, i > some_source.length; i++) {
// copy some string to the buffer...
vectorOfStrings.push_back(bufferForStrings);
}
This results in bufferForStrings
being added to the vector again and again, which is not what I want.
RESULT:
[0]: (pointer to buffer)
[1]: (pointer to buffer)
...
What I want is this:
[0]: (pointer to unique string)
[1]: (pointer to other unique string)
...
From what I know about this type of string, the pointer points to the beginning of an array of characters which ends in a null terminator.
So, the current code effectively results in the same string being copied to the buffer again and again. How do I fix this?