[ROOT] stl and root

From: Colin Bernet (bernet@hep.saclay.cea.fr)
Date: Mon Dec 10 2001 - 16:08:59 MET


Dear all, 

First of all, I apologize if you already received this email. I subscribed
to the list today, and I'm not sure somebody got this mail (at least I
didn't get it back !).

Maybe the CINT version I'm using is too old (root 3.00/06), but the
following macro doesn't work : 

#include <map> 
#include <vector> 
#include <string> 

void TestMap() {
  map<int, const char*> m;
  m[1]="colin";
  m[2]="bernet";
  cout<<m[1]<<" "<<m[2]<<endl; 
} 

void TestVector() {
  vector< const char* > m;
  m.push_back("hello");
  m.push_back("world");
  cout<<m[0]<<" "<<m[1]<<endl; 
} 

void TestString() {
  string s="Hello ";
  s += "world";
  cout<<s<<endl; 
}

only the function TestString doesn't lead to an error. 

TestVector() gives : 
Error: Illegal pointer operation (tovalue)
FILE:TestMap.C LINE:19 Error: << Illegal operator for pointer 3
FILE:TestMap.C LINE:19
*** Interpreter error recovered ***

TestMap() gives : 
Error: No symbol map in current scope FILE:TestMap.C
LINE:6 Error: No symbol int,constchar in current scope FILE:TestMap.C
LINE:6 Error: G__getvariable: expression FILE:TestMap.C LINE:6 Error: No
symbol m in current scope FILE:TestMap.C LINE:6 (const int)0 ***
Interpreter error recovered ***


Which version of root should I use ?
Thanks !

Colin



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:11 MET