Re: ROOT & STL

Rene Brun (Rene.Brun@cern.ch)
Thu, 28 Jan 1999 22:43:25 +0100


Alexander Zvyagin wrote:
>
> IHEP, Protvino, Russia, 26-JAN-1999
>
> Dear ROOTers,
>
> Are there any recomendations on how to create ROOT class that uses STL?
> I plan to use class structure represented below, but may be somebody
> have found better solution?
>
> The problem "How to use STL with ROOT" was discussed many times
> in roottalk. It is time to create ROOT-STL HOWTO.
>

Hi Alexander,
Stefan Kluth has developped an extension to RootCint permitting
template support for the code generated for I/O.
This extension is about to be introduced in Root.
More info will be posted when this will become available.

Rene Brun

> ------------------------------------
> #ifndef RootSTL__include
> #define RootSTL__include
>
> #include "TObject.h"
>
> #ifndef __CINT__
> // --- STL ---
> #include <vector.h>
> #include <pair.h>
> #endif // __CINT__
>
> class RootSTL : public TObject
> {
> public:
> ~RootSTL(void) {}
> RootSTL(void) {}
>
> #ifndef __CINT__
> vector<int> fVInt; // STL vector
> pair<bool,int> Sum(vector<int> &v); //
> #define __CINT__
>
> ClassDef(RootSTL,1) // ROOT class that uses STL
> };
>
> #endif // RootSTL__include
> --------------------------------------
>
> With best wishes,
> Alexander.