예제 #1
0
파일: k_heap.hpp 프로젝트: pkambadu/GWAS
  /**
   * Add an element to the heap conditionally:
   * (1) Add the element if we are not on full capacity.
   * (2) If we are on full capacity, add the element only after comparison.
   */
 bool add (const value_type& value) {
   if (size<K) { heap.push(value); ++size; return true; }
   else if (false==compare(heap.top(),value)) {
     heap.pop ();
     heap.push (value);
     return true;
   } else {
     return false;
   }
 }
예제 #2
0
파일: k_heap.hpp 프로젝트: pkambadu/GWAS
 void pop () { if (0<size) { heap.pop(); --size; } }