Sending ste::vector
in Native
Hi,
Is it possible to send std::vector between the peers as a parameter inside raise event ?
Is it possible to send std::vector between the peers as a parameter inside raise event ?
0
Best Answer
-
Hi @GabrielKotev.
You can't directly pass the std::vector to Photon (at least not without registering it as a custom type) as it is not one of the types that Photons serialization supports out of the box (see http://doc-api.photonengine.com/en/cpp/current/html/a05589.html for the list of supported types).
However c-arrays are supported out of the box and std::vector internally stores its data in a c-array.
See the answers to https://stackoverflow.com/questions/1733143/converting-between-c-stdvector-and-c-array-without-copying for how to access the c-array of a std::vector prior to C++ 11 and also from C++ 11 onward.5
Answers
-
Hi @GabrielKotev.
You can't directly pass the std::vector to Photon (at least not without registering it as a custom type) as it is not one of the types that Photons serialization supports out of the box (see http://doc-api.photonengine.com/en/cpp/current/html/a05589.html for the list of supported types).
However c-arrays are supported out of the box and std::vector internally stores its data in a c-array.
See the answers to https://stackoverflow.com/questions/1733143/converting-between-c-stdvector-and-c-array-without-copying for how to access the c-array of a std::vector prior to C++ 11 and also from C++ 11 onward.5 -
Thanks a lot @Kaiserludi0