usefulness of passing const references to RPCs
Maybe it's a stupid idea, but I was wondering if there was a real interest to declare a parameter for an RPC as const reference, as I guess internally the data is copied anyway to be passed on the network. I guess this is still useful to avoid one extra copy of the data, but i was wondering if you guys had an idea on the matter.
asked Feb 22 '19 at 09:56 AM in C++ Programming
By using reference, you probably save a copy: the data is transmitted to the server through the network, the server constructs the struct, then passes it to your function. If you don't use a reference, then I believe one more copy is created on the server side.
So yes, I think most usually you'll want to have a const reference in RPCs.
answered Feb 22 '19 at 10:41 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here