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;
This archive was generated by hypermail 2.2.0 : Sun Mar 21 2010 - 17:50:01 CET