I'm writing a branch predictor simulator for my architecture class and I'm having some trouble with getting output working between multiple classes. I'm trying to open up one main ofstream in my main.cpp and the pass it to the constructor of each class for use by the objects. I'm getting a whole bunch of errors in my header file such as:
In file included from main.cpp:4:0:
predictors.h: In constructor â?~ATPred::ATPred(std::ofstream&)â?T:
predictors.h:14:18: error: use of deleted function â?~std::basic_ofstream<char>& std::basic_ofstream<char>::operator=(
const std::basic_ofstream<char>&)â?T
So the errors seem to be in my header file:
#ifndef PREDICTORS_H
#define PREDICTORS_H
#include <string>
// Always Taken
class ATPred{
private:
std::ofstream outputFile;
public:
// Constructor
ATPred(std::ofstream& file)
{ outputFile = file; }
// Deconstructor
~ATPred()
{}
// Member Functions
void parseResults(std::string filename);
};
// Always Non-Taken
class ANTPred{
private:
std::ofstream outputFile;
public:
// Constructor
ANTPred(std::ofstream& file)
{ outputFile = file; }
// Deconstructor
~ANTPred()
{}
// Member Functions
void parseResults(std::string filename);
};
#endif
I'm not sure where I'm going wrong here, so any help would be greatly appreciated.