Call insert function statement

aquarius2236's Avatar, Join Date: Oct 2007
Newbie Member
Code:
template <class T>
class BasicMinMaxHeap {
public:
void insert(const T& elt);}
--------------------------------------
template <class T>
void BasicMinMaxHeap<T>::insert(const T& elt) {
   if(lastindex == maxsize) grow();

   cerr << "insert: " << elt << endl;

  lastindex++;
  A[lastindex] = elt;
  bubbleUp(lastindex);
}

void main(){

// if i want to call the above insert function, what is the statement look like??     <--------- Question
}
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.
0
dharmaraj.guru's Avatar
Go4Expert Member
Try this out..
Code:
class SomeClass {
};

void main() {
    BasicMinMapHeap<int> integer_heap;
    BasicMinMapHeap<SomeClass> SomeClass_heap;
    SomeClass obj;
 
   integer_heap.insert(3);
   integer_heap(10);
    SomeClass_heap.insert(object);
}
Correct me if I am wrong somewhere..

| Dharma |