Call insert function statement

Newbie Member
22Oct2007,19:16   #1
aquarius2236's Avatar
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
}
Go4Expert Founder
22Oct2007,19:21   #2
shabbir's Avatar
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.
Go4Expert Member
24Oct2007,16:23   #3
dharmaraj.guru's Avatar
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 |