Hi,
Thanks for your report, this problem is not solved yet but has a very simple
work around.
You need to actually use a vector<int> before defining a function taking one
as a parameter.
For example:
// macro2.C
#include <vector>
typedef vector<int> vector_int;
#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);
3
root [4]
Philippe.
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Daniel Barna
> Sent: Saturday, October 21, 2000 5:01 PM
> To: roottalk@pcroot.cern.ch
> Subject: [ROOT] CINT: vector<...> as argument of a function
>
>
> 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:36 MET