2 ms·
If they are passed by value or move, you are doing complicated things with ownership that deserve to be encapsulated in a named type. If you are passing them by
by ncmncm 6y ago
If they are passed by value or move, you are doing complicated things with ownership that deserve to be encapsulated in a named type. If you are passing them by const reference, you would usually better pass a regular pointer or reference to the pointed-to type. If you are passing them by non-const reference, you have bigger problems.
In practice, the new type usually starts out as a PIMPL class with just a std::unique_ptr<impl> member. But often, once the type is named, you discover it is a good place to park more operations.