Help with vectors and pointers

Hey guys, I'm getting 2 errors that I don't know how to fix in my program. This is the code, the errors are in comments. Thanks




IntegerSet.cpp file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "stdafx.h"
#include <iostream>
using namespace std;
#include "IntegerSet.h"

IntegerSet::IntegerSet()
{
	vector<bool> set (101);
	for (int i = 0; i <= 100; i += 1)
	{
		set[i] = false;
	}
}
IntegerSet::IntegerSet(int a[], const int size)
{
	vector<bool> b (size);
}
void IntegerSet::printSet()
{
	bool empty = true;

	for (int i = 0; i <= 100; i += 1)
	{
		if (set[i] == true) /* I'm getting an error here saying "	6	IntelliSense: expression must have pointer-to-object type	c:\users\etb318\desktop\lab5exerb\lab5_exerb\lab5_exerb\integerset.cpp	24	7	Lab5_ExerB"*/

		{
			empty = false;
		}
		if (empty == true)
		{
			cout << "---" <<endl;
		}
		else if (empty == false)
		{
			cout << i << " ";
		}
	}

}
void IntegerSet::insertElement(int a)
{
	set[a] = true; /* I'm getting this error "	6	IntelliSense: expression must have pointer-to-object type	c:\users\etb318\desktop\lab5exerb\lab5_exerb\lab5_exerb\integerset.cpp	41	2	Lab5_ExerB
*/
}
void IntegerSet::deleteElement(int b)
{

}
IntegerSet IntegerSet::unionOfSets(IntegerSet setA)
{

}
IntegerSet IntegerSet::intersectionOfSets(IntegerSet setA)
{

}
bool IntegerSet::isEqualTo(IntegerSet setA)
{

}


Integer.h file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "stdafx.h"
#include <iostream>
#ifndef IntegerSet_h
#define IntegerSet_h
#include <vector>
using namespace std;

class IntegerSet
{
public:
	IntegerSet();
	IntegerSet(int a[], int i);
	void printSet();
	void insertElement(int a);
	void deleteElement(int b);
	IntegerSet unionOfSets(IntegerSet setA);
	IntegerSet intersectionOfSets(IntegerSet setA);
	bool isEqualTo(IntegerSet setA);




private:
	vector<bool> set (101);


};
#endif 
integer.h line 24:
vector<bool> is a template specialization. It does not support a size constructor.
http://www.cplusplus.com/reference/vector/vector-bool/
Topic archived. No new replies allowed.