I have a problem in using a custom class streamer when the object is contained inside a std::vector. To reproduce the problem (code here) I have created two classes, MyClass and ContainedClass; the latter has a custom streamer function. When I place a ContainedClass object inside MyClass, and then write MyClass on file, then the custom streamer for ContainedClass is used
$ ./test
Register custom streamer for ContainedClass
ContainedClassStreamer
If instead I place a std::vector<ContainedClass> inside MyClass then I get this:
$ ./test
Register custom streamer for ContainedClass
so the custom streamer is not called. Is this the intended behavior? And if yes, why? I’d say that if a class has a custom streamer then it is necessary to serialize it in a non-trivial way, so the custom streamer should always be used…
ROOT Version: 6.14.04 Platform: Linux Compiler: gcc 9.1
Hi Philippe, sorry for the poorly-crafted reproducer; I don’t really understand what’s the problem so once I got the same error on the reproducer I didn’t bother to check further. I tested your solution also in my real code and it works, so thank you very much.
Just for information: is this “missing detection” issue a bug in Root? If yes, is it going to be fixed? Thanks.