vector refuses to work

Sorry about this noob post but vector is seriously pissing me off and it's such a stupid problem because I've been using it; but check out this code.



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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <cstdlib>
#include <iostream>
#include <vector>

template <typename Comparable>
class minHeap
{

    //Name: minHeap
    
    //Description: Stores Edge objects in descending order based on their cost. 
    
public:

    //Member Functions:
    
    
    //Name: explicit constructor
    //Prototype: explicit minHeap(int size = 0) : heap(size+1), current(0){}
    //Description: creates a minHeap for edges to be stored in
    //Preconditions: accepts integer for number of elements to be stored
    //Postconditions: creates a heap of size+1, default = 0; sets currentSize = 0
    //Cost Analysis: O(n) n = size+1
    //Visibility: Public
    explicit minHeap(int size = 0) : heap(size+1), currentSize(0){}

    
    //Name: insert
    //Prototype: void insert(Comparable & inEdge);
    //Description: inserts edge into the heap
    //Preconditions: accepts reference to the Edge to be inserted
    //Postconditions: inserts inEdge into appropriate position; currentSize++
    //Cost Analysis: O(log(n)) ; n = current size of heap
    //Visibility: Public
    void insert(Comparable & inEdge);
    
    
    //Name: delete
    //Prototype: void deleteMin(Comparable & minEdge);
    //Description: makes reference to cheapest edge and deletes it
    //Preconditions: accepts reference to Edge
    //Postconditions: minEdge = cheapest edge ; cheapest edge deleted; currentSize--
    //Cost Analysis: O(log(n)) ; n = current size of heap
    //Visibility: Public
    void deleteMin(Comparable & minEdge);
    
    
    //Name: is empty
    //Prototype: bool isEmpty() const;
    //Description: decides if the heap is empty
    //Preconditions: 
    //Postconditions: returns true if the heap is empty
    //Cost Analysis: O(1) constant time
    //Visibility: Public
    bool isEmpty() const;
    
    
    
    //Name: percolate down
    //Prototype: void percolateDown(int hole);
    //Description: sorts the array after a deletion
    //Preconditions: accepts index of heap where new hole exists
    //Postconditions: places new item in hole when possible
    //Cost Analysis: O(log(n)) ; n = current size of heap
    //Visibility: Public
    void percolateDown(int hole);

    
    private:
        
        //Data members:
        
        //Name: current size
        //Description: keeps track of current size of the heap
        //Type: int
        int currentSize;
        
        //Name: heap
        //Description: structure to hold templated type
        //Type: vector<Comparable>
        vector<Comparable> heap;

};



error: vector doesn't name a type.... I literally copied a class I've already written which is going to be used for another project but vector just says: "no" any idea? I still refuse to respect netbeans on windows to be honest it always does crazy bullshit like this.
vector is in the std namespace, so you need to put std:: in front of it:
std::vector<Comparable> heap;
Topic archived. No new replies allowed.