Hi,
Is it possible to use STL in a template class? When I tried to compile
a template with a vector<Int_t> as a memeber, I get a long list of
errors, starting with:
--------------------------------------------------------------------
<**compiling**> TestClass_dict.o
"TestClass_dict.C", line 447: error: type name is not allowed
G__letint(result7,105,(long)((vector<int,allocator<int> >*)(G__getstructoffset()))->reverse_iterator(*(vector<int,allocator<int> >::reverse_iterator*)libp->para[0].ref));
^
"TestClass_dict.C", line 452: error: class
"std::vector<Int_t, std::allocator<Int_t>>" has no member "base"
G__letint(result7,73,(long)((vector<int,allocator<int> >*)(G__getstructoffset()))->base());
^
"TestClass_dict.C", line 458: error: class
"std::vector<Int_t, std::allocator<Int_t>>" has no member "operator*"
const int& obj=((const vector<int,allocator<int> >*)(G__getstructoffset()))->operator*();
^
"TestClass_dict.C", line 466: error: class
"std::vector<Int_t, std::allocator<Int_t>>" has no member
"operator++"
vector<int,allocator<int> >::reverse_iterator& obj=((vector<int,allocator<int> >*)(G__getstructoffset()))->operator++();
^
"TestClass_dict.C", line 474: error: class
"std::vector<Int_t, std::allocator<Int_t>>" has no member
"operator++"
vector<int,allocator<int> >::reverse_iterator *pobj,xobj=((vector<int,allocator<int> >*)(G__getstructoffset()))->operator++((int)G__int(libp->para[0]));
^
"TestClass_dict.C", line 484: error: class
"std::vector<Int_t, std::allocator<Int_t>>" has no member
"operator--"
vector<int,allocator<int> >::reverse_iterator& obj=((vector<int,allocator<int> >*)(G__getstructoffset()))->operator--();
^
--------------------------------------------------------------------
These are my sources:
====================================================================
= TestClass.h
====================================================================
#ifndef __TestClass__
#define __TestClass__
#include "TObject.h"
#include <vector>
template<class Type>
class TestClass : public TObject
{
public:
TestClass();
~TestClass();
private:
Type *_tree;
vector<Int_t> vi;
ClassDefT(TestClass, 1)
};
template<class Type>
TestClass<Type>::TestClass()
{
_tree = new Type;
}
template<class Type>
TestClass<Type>::~TestClass()
{
}
#endif
====================================================================
= TestClass.C
====================================================================
#include "TestClass.h"
====================================================================
= TestClass.C
====================================================================
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class TestClass<Double_t>+;
#endif
--------------------------------------------------------------------
Thank you,
Jedong
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET