Hi Alessandro,
Currently CINT does have some difficulty with the notation double (*)[4]
The most elegant work-around would be to use nested vectors. For example:
unsigned int size(10);
vector<vector<double> > *dummy = new vector<vector<double > >(size);
fVector.push_back(dummy);
with
std::vector< std::vector< std::vector<double> > * > fVector;
or
unsigned int size(10);
vector<vector<double> > dummy(size);
fVector.push_back(dummy);
with
std::vector< std::vector< std::vector<double> > > fVector;
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of
Alessandro.Thea@ge.infn.it
Sent: Thursday, June 10, 2004 7:08 AM
To: Root Mailinglist
Subject: [ROOT] rootcint and not-so-standard vectors
Hello rooters,
I noticed the following problem with vector< double(*)[4] > structure and rootcint:
it nicely complies:
g++ -c MyClass.cxx
However rootcint does not like this structure with vectors:
rootcint -f MyClassDict.cxx -c MyClass.h LinkDef.h
Error: unrecognized language construct FILE:prec_stl/vector LINE:302
Error: unrecognized language construct FILE:prec_stl/vector LINE:306
Error: unrecognized language construct FILE:prec_stl/vector LINE:308
Error: unrecognized language construct FILE:prec_stl/vector LINE:318
Error: unrecognized language construct FILE:prec_stl/vector LINE:360
Syntax Error: * FILE:prec_stl/vector LINE:362
Error: unrecognized language construct FILE:prec_stl/vector LINE:368
Error: unrecognized language construct FILE:prec_stl/vector LINE:369
Error: Too many '}' FILE:prec_stl/vector LINE:584
Error: Unexpected EOF G__exec_statement() FILE:prec_stl/iterator LINE:38
Advice: You may need to use +P or -p option
Error: Unexpected EOF G__fgetname():2 FILE:prec_stl/iterator LINE:38
Advice: You may need to use +P or -p option
Error: Unexpected EOF G__fgetvarname():2 FILE:prec_stl/iterator LINE:38
Advice: You may need to use +P or -p option
Error: Unexpected EOF G__fgetstream():2 FILE:prec_stl/iterator LINE:38
Advice: You may need to use +P or -p option
Syntax Error: Maybe missing ';' FILE:prec_stl/iterator LINE:38
Warning: Error occured during reading source files
Warning: Error occured during dictionary source generation
!!!Removing MyClassDict.cxx MyClassDict.h !!!
Error: rootcint: error loading headers...
None of these options +P, -P, -p helps...
It is possible to fix the problem addind the following lines:
#ifndef __MAKECINT__
vector< Double_t(*)[4] > fVector; // vector of bidimensional tables
#endif
I eager to know if this problem can be fixed in a legal and more elegant way?
Please find below three simple files MyClass.h and MyClass.cxx and linkDef.h
Thanks,
Alessandro
--------
MyClass.h:
#ifndef __MYCLASS__
#define __MYCLASS__
#include <vector>
class MyClass {
public:
MyClass();
virtual ~MyClass();
std::vector< double(*)[4] > fVector;
};
#endif
MyClass.cxx:
--------
#include "MyClass.h"
MyClass::MyClass() {
unsigned int size(10);
double (*dummy)[4] = new double[size][4];
fVector.push_back(dummy);
}
MyClass::~MyClass() {
}
--------
LinkDef.h:
---------
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class MyClass+;
#endif
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET