c++ - Converting STL String, and STL Vector into void*? -
I've got some C ++ codes, which we arbitrarily serialize data and metadata as a Use to store in special image format.
Anyway, it takes it as zero *. Can I just do a simple memkpi? Or is there a better way to do this?
For std :: string, you can use c_str () to point to the internal string To get the four *.
The standard for std :: vector indicates that the elements are compatible in memory and therefore you can access the pointer at the beginning of the data & amp; V [0].
You definitely should be careful with them because you are basically handing over to the library, you are using an indicator in the internal data of objects. If necessary, you can make a copy of the source using the above source using memcpy, but clearly you have to keep in mind that you use the correct size. Without knowing the details of the function (s), you are passing this data, it is not possible to comment on whether such a copy is needed or not.
Comments
Post a Comment