ice icon indicating copy to clipboard operation
ice copied to clipboard

Pass one shot constructor movable parameters by value

Open pepone opened this issue 2 years ago • 0 comments

The generated C++ one-shoot constructor for a class looks like this:

MessageEvent(
    long long int timestamp,
    const ::std::string& name,
    const ::std::string& message) :
    Ice::ValueHelper<MessageEvent, ChatRoomEvent>(timestamp, name),
    message(message) {
}

It would be better to pass std::string by value and use std::move which will allow avoiding copies when the parameter is a lreference

pepone avatar Mar 09 '23 08:03 pepone