Looking at the fmod_studio.hpp file, it looks like the FMOD Studio API is using the CRTP technique for Handle objects. And possibly using some kind of ref-counting?
Is it safe to copy these objects by value? Either by passing to a function or storing in other containers?
//[ get the eventDescription from the system via its event ID]
ERRCHECK (eventDescription.createInstance (&eventInstance));
void startEventInstance(EventInstance eventInstance) // copy here
I know I could a reference or a pointer here but the question is whether its safe to copy (and assign, and use move semantic I suppose in C++11).
The actual problems is that I’m using JUCE and I’m trying to track down a problem storing EventInstance objects in a Juce Array (similar but different from a std::vector).
Thanks for the clarification. There must have been some other problem. 1.2 style handles were safe to copy by value but I’ve seen differences in some compilers (I don’t remember which versions of GCC and LLVM) in terms of which copy constructor is called if not defined in the Dervied class.
Also (perhaps more likely) Juce Arrays copy objects around using the equivalent of memcpy when reordering elements (rather than using assignment).