Cannot use vector::iterator in rootcint

I cannot use std containers and algorithms in cint interpreter due to iterator operations not functioning (among other problems).
I freshly compiled and installed root 5.22b with gcc 4.3.3 on kubuntu Jaunty, installed to a $ROOTSYS under my home directory.

This is my test macro:

[code]#include
using namespace std;

vector v;

void test1() {
if( v.begin() == v.end() ) { cout<< “A”<<endl; }
}

void test2() {
v.push_back(1);
for( vector::iterator i=v.begin(); i!=v.end(); ++i ) {
cout<< “B” <<endl;
}
}
[/code]

This is the error:

root [0] .L test.C root [1] test1() Internal error: template function call operator== failed test.C:8: *** Interpreter error recovered *** root [2] test2() Error: operator!= not defined for vector<int,allocator<int> >::iterator test.C:13: *** Interpreter error recovered ***

Could you help with the problem? Thanks in advance.

Hi,

see root.cern.ch/phpBB2/viewtopic.php?t=8237
Can you use v[0] etc?

Cheers, Axel.

Thanks, I could use v[] instead. Perhaps it is due to similar dictionary problems, I’ve also found
std::map<TTree*,int>
std::map<TCut,int>
etc not working in cint ( “.L mac.C” gives errors ) . Are these fixed in newer release?

Cheers

Hi,

that’s a different issue; you will need to generate dictionaries for these types. See e.g. root.cern.ch/phpBB2/viewtopic.php?t=7691 how to create dictionaries for an arbitrary STL class.

Cheers, Axel.