So I am having some trouble with creating a variable that will hold a temporary string conversion. I am getting compiler errors telling me that no conversion is possible between a std::string iterator and a std:: basic string. This is my pertinent code thus far.
#include <algorithm>
#include <deque>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
#include <cctype>
class toLower {public: char operator()(char c) const {return tolower(c);}};
struct Email
{
string email;
};
bool duplicateCheck(deque<Email>& email, Email anEmail)
{
bool duplicate;
Email tempA;
Email tempB;
tempA.email = transform(anEmail.email.begin(), anEmail.email.end(), anEmail.email.begin(), toLower());
for (int i = 0; i < email.size(); i++)
{
tempB.email = transform(email[i].email.begin(), email[i].email.end(), email[i].email.begin(), toLower());
if (tempA.email == tempB.email) duplicate = true;
else
duplicate = false;
}
return duplicate;
}
This is for my final project in a C++ class and I am reading an input file, extracting valid emails, and then testing them to make sure there are no duplicates before being added to an output file. I can transform them PERMANENTLY, but that is going to get me docked points and I can't figure out what variable would hold the transformed text. I'm not an expert in c++ (yet!

New Topic/Question
Reply



MultiQuote







|