Error when checking for char vector equality

Trying to compare two vectors but I'm getting an error.

IntelliSense: no operator "==" matches these operands
operand types are: std::vector<char, std::allocator<char>> [100] == std::vector<char, std::allocator<char>> c:\Users\Artur\Desktop\English-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  vector <char> englishWord[MAX_NUM_WORDS][MAX_WORD_LEN]; 
//Private class definition of vector


int wordCount = 0; // Function that compares the first vector to the other. 
	vector <char> engW[50];  //Error on the last line
	dictionary(Dictionary);
	for (int i = 0; i < strlen(s); i++)
	{
		char c = s[i]; 
		if (c !=' '||'\t'||'\n'||','||'.')
		{
			engW[wordCount].push_back(c);
		}
		if (c == ' ')
		{
			wordCount + 1;
		}
	}

	for (int i=0; i<numEntries; i++)									 //Looking up the words 
    {
		if (englishWord[i] == engW[wordCount]) //Error 
Last edited on
Where is englishWord declared?
Its declared in a private class header file....

#include <iostream>
#include <string>
using namespace std;
const int MAX_NUM_WORDS = 2000;
const int MAX_WORD_LEN = 100;
class Translator
{
public:
Translator(string dictName): Dictionary(dictName){ };
void dictionary(string Dictionary);
void toElvish(char out_s[], const char s[]);
void toEnglish(char out_s[], const char s[]);
private:
string Dictionary;
vector <char> englishWord[MAX_NUM_WORDS][MAX_WORD_LEN];
vector <char> elvishWord[MAX_NUM_WORDS][MAX_WORD_LEN];
int numEntries;

};
englishWord is a 2D array of vector<char>
engW is a 1D array of vector<char>

I think you're essentially comparing a vector<char> array to a vector<char>. I think your understanding of how vectors work is limited. Please read the documentation. http://en.cppreference.com/w/cpp/container/vector

I also advise you to use std::string instead of char.
That makes sense. Thank you.

Yeah, I would like to use string but my lecturer has seriously complicated our project by inserting a bit of code that forces us to use chars and we are not allowed to edit that bit of code.
Can't you use the constructor or assignment operator of std::string to turn the const char * into strings?
Topic archived. No new replies allowed.