Template class derived from std::vector

Hi,

I am trying to use a template class which inherits from std::vector. Unfortunately the class uses some partial template specialization, which is unavailable according to the CINT limitations page. Is there some way around this?

I’d like to use this class in code called by a TSelector or TPySelector. I’ve attempted to call a TSelector from compiled C++, but apparently this still needs a dictionary for the derived TSelector, which I don’t know how to make without CINT.

Would cling make this any easier? I’m using ROOT 5.33/01 compiled with clang, so that might be doable.

Thanks for any help.

Chris

Hi Chris,

A priori, you can simply compile your derived TSelector using ACLiC ( you may have to hide some parts from CINT ).

[quote]Would cling make this any easier? I’m using ROOT 5.33/01 compiled with clang, so that might be doable.[/quote]Yes, it would … however we not yet at a point where it can be used in your case (dictionary, PyROOT, etc.)

Cheers,
Philippe.

PS. inheriting from std::vector is somewhat ‘bad C++ form’ as std::vector was not designed to be inherited from …

Hi Phillipe,

Thanks! I think I have this working with my TSelector. For anyone who stumbles on this post, I added

#ifndef __CINT__
...templated code...
#endif

everywhere that templated code was called. Please correct me if this is not the right thing to do, Phillipe.

I can now call the TSelector via TChain::Process(“mySelector.cxx+”), but I’m not sure how to link against the ACLiC-generated libraries. Could you point me to a howto?

Thanks,

Chris

PS. Thanks for the [-X hint Re: std::vector inheritance. It wasn’t strictly necessary, but I couldn’t resist the temptation…

Hi,

[quote]but I’m not sure how to link against the ACLiC-generated libraries. Could you point me to a howto?[/quote]Depending what you mean … If you do.L mySelector.cxx+then subsequent ACLiC invocations will also link against the resulting library. If you want to explicitly link against it you can use it full name (mySelector_cxx.so).

Cheers,
Philippe.