ROOT & STL

Alexander Zvyagin (zvyagin_at_mx.ihep.su)
Tue, 26 Jan 1999 14:40:55 GMT+03:00


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.

------------------------------------
#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.