Re: Function not definen in current scope

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Sun, 21 Mar 2010 14:55:27 +0100


Hi Cedric,

standard aside - CINT is not going to be able to handle that. What about converting the overloads to this signature?

std::deque< float >* deCASSYfy( std::ifstream& inFile,const int* cols, size_t colcnt)

That will help CINT understand it at minimal cost.

Cheers, Axel.

On 2010-03-21 14:41, Cedric Sodhi wrote:
> I'm simply trying to include this (fully STD compliant) function, but
> deCASSYfy( ... ) is then not recognized as an available function:
>
> #include <deque>
> #include <sstream>
> #include <fstream>
> #include <algorithm>
>
> template< size_t colcnt >
> std::deque< float >* deCASSYfy( const char*,const int (&cols)[ colcnt ] );
> template< size_t colcnt >
> std::deque< float >* deCASSYfy( std::ifstream&,const int (&cols)[ colcnt
> ] );
>
> template< size_t colcnt >
> std::deque< float >* deCASSYfy( const char *inFile,const int (&cols)[
> colcnt ] ) {
> std::ifstream dataFile( inFile );
> return deCASSYfy( dataFile,cols );
> }
>
> template< size_t colcnt >
> std::deque< float >* deCASSYfy( std::ifstream& inFile,const int (&cols)[
> colcnt ] ) {
> if( !inFile.good( ) )
> throw "Filestram could not be read";
> std::cout << sizeof( cols );
> std::deque< float > *dataSet = new std::deque< float >( );
> std::string lastLine;
> float lastVal = 0;
> while( std::getline( inFile,lastLine ) ) {
> int fieldPos = 0;
> int j = 0;
> if( lastLine.find( "\t" )!= std::string::npos ) {
> for( int i = 0; j < colcnt; i++ )
> if( fieldPos != std::string::npos ) {
> std::istringstream lastField( lastLine.substr(
> fieldPos ) );
> fieldPos = lastLine.find( "\t",fieldPos + 1 );
> if( std::find( cols,cols + colcnt,i )!=( cols +
> colcnt ) ) {
> lastField >> std::scientific >> lastVal;
> dataSet->push_back( lastVal );
> j++;
> }
> } else {
> dataSet->push_back( 0.0 );
> j++;
> }
> }
> }
> return dataSet;
> }
>
>
Received on Sun Mar 21 2010 - 14:55:36 CET

This archive was generated by hypermail 2.2.0 : Sun Mar 21 2010 - 17:50:01 CET