Re: [ROOT] map, vector, set, list,...

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Sat May 03 2003 - 04:07:55 MEST


Hello Martina,

This is a Cint limitation.  You can not interpret whole STL
container except for very simple case with vector.  You need
to pre-compile those container classes with rootcint or makecint.
Then you can use them. For example,

//  user.h
#include <vector>
#include <map>
#include <set>
#ifdef __MAKECINT__
#pragma link C++ class vector<int>;   //  *1
#pragma link C++ class map<int,int>;
#pragma link C++ class set<int>;        //  *1
#endif
//  *1 :  If you build cintdlls , those classes are automatically
//          built-in. In that case, you can omit those lines.

  $  makecint -mk makefile -dl user.dll -H user.h
  $  make -f makefile
  $  cint user.h
  cint> .
  cint>  map<int,int> m
  cint>
      ....

Please refer to documentation for more detail.

Thank you
Masa Goto




----- Original Message -----
From: "Schaefer Martina" <schaefer@lpsc.in2p3.fr>
To: <roottalk@pcroot.cern.ch>
Sent: Friday, May 02, 2003 8:57 PM
Subject: [ROOT] map, vector, set, list,...


> Hi,
>
> i have another question, I want to use maps and vectors in a root macro.
>
> For my vector everything is fine:
> root [0] #include<vector>
> root [1] vector<int> v
> root [2] v.push_back(5)
> root [3] v[0]
> (vector<int>::reference)5
>
> For the list also.
>
> but for my map:
> root [0] #include<map>
> root [1] map<int,int>m
> Error: Symbol map is not defined in current scope
> FILE:/tmp/file9Stzio_cint LINE:1
> Error: Symbol int,int is not defined in current scope
> FILE:/tmp/file9Stzio_cint LINE:1
> Error: Symbol m is not defined in current scope  FILE:/tmp/file9Stzio_cint
> LINE:1
> (const int)0
> *** Interpreter error recovered ***
>
> and for the set:
> root [0] #include<set>
> root [1] set<int> s
> this gives a segmentation violation!
>
> Can you help me?
>
> Thank you,
>
> Martina
>
>



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET