[ROOT] CINT: vector<...> as argument of a function

From: Daniel Barna (Daniel.Barna@cern.ch)
Date: Sun Oct 22 2000 - 00:01:14 MEST


Hello Rooters,

Sorry if this has been already discussed.
The stl vector seems to work fine, until I don't want to use
it as an argument of a function. The following works:

// macro1.C
#include <vector>
void myfunc()
{
    cerr<<v[0]<<endl;
}

root [0] .L macro1.C
root [1] vector<int> v;
root [2] v.push_back(3);
root [3] myfunc();

But if I want to pass the vector as an argument:

//macro2.C
#include <vector>
void myfunc(vector<int> &v)
{
  cerr<<v[0]<<endl;
}

root [0] .L macro2.C
root [1] vector<int> v;
root [2] v.push_back(3);
root [3] myfunc(v);

Error: No symbol myfunc(v) in current scope  FILE:/tmp/25209daa_cint
LINE:1
Possible candidates are...
filename       line:size busy function type and name  

How could I make the second example work?
Thanks
Daniel



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET