The point here is that we can only tell at run time if a class has an associated collection proxy.
For compile time, in the first iteration of this PR we had an extra template argument that acted as a "tag" to differentiate the RField specialization for classes with an associated collection proxy (inherits RProxiedCollectionField
) from the RField primary template definition (RClassField
-derived), as in:
That is convenient only for non-nested types, i.e. it doesn't work with, e.g. RField<std::vector<MyClass>, ROOT::Experimental::TagIsCollectionProxy>
, as the tag is not forwarded to the instantiation of the inner RField (that for the value type of the vector). The following two possible solutions were considered:
ntuple/v7/inc/ROOT/RNTupleUtil.hxx:49
), that helps to differentiate both cases. There we would have: IsCollectionProxy<T>
type, that can be used in a similar way to those in the <type_traits>
header. We found this more convenient and is the implemented thing below. Here, classes can be marked as a collection proxy with either of the following two forms (whichever is more convenient for the user): Of course, there is another possible solution which is to have a single RClassField
that implements both the regular-class and the collection-proxy behaviors, and always chooses appropriately at run time. We found that less clean and probably has more overhead, as most probably it involves an additional branch + call in each of the member functions.
Definition at line 1305 of file RField.hxx.
#include <ROOT/RField.hxx>