Hi,
I’ve got a little library that I compile (if necessary) and load when ROOT starts up. I’m trying to define a templated function but can’t seem to make it visible from the interpreter:
#ifndef BLAH_H
#define BLAH_H
/* ... */
template<class T> void set_lc(std::vector<T*>& v, Color_t x);
template<class T> void set_lc(std::vector<T*>& v, Color_t x){
for(uint i=0; i<v.size(); i++) v[i]->SetLineColor(x);
}
#endif
The library compiles but the function doesn’t show up in the interpreter. I tried adding:
#pragma link C++ function set_lc<TH1>(std::vector<TH1*>,Color_t);
which also doesn’t work. I’ve tried a number of variations on this theme, some of which fail to compile. Is the use of templated functions supported under my version of ROOT (4.04.02f)? If so, can someone find my error or suggest the necessary changes? I looked in the user manual and at the CINT site but cannot seem to find the necessary information.
As an aside, I have a number of pragmas in the library:
#pragma link C++ class vector<TH1*>;
#pragma link C++ class vector<TAttLine*>;
#pragma link C++ class vector<TAttFill*>;
/* ... */
when I compile the library (with rootcint) I get a message:
/home/kordosky/macros/blah.h:23: warning: ignoring #pragma link C
But, obviously it is not ignoring the pragmas because with them I can instantiate the corresponding classes and without them I cannot. Thus, I presume the warning is spurious and if so I wonder if it can please be turned off.
mike