/*
* This file is part of DisOrder.
- * Copyright (C) 2007 Richard Kettlewell
+ * Copyright (C) 2007, 2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifndef HEAP_H
#define HEAP_H
+#include "vector.h"
+
/** @brief Binary heap template.
* @param NAME name of type to define
* @param ETYPE element type
} \
\
static inline NAME##_element NAME##_first(struct NAME *heap) { \
- assert(heap->nvec > 0); \
+ assert(heap->nvec > 0 && "_first"); \
return heap->vec[0]; \
} \
\
int n = 0; \
NAME##_element r; \
\
- assert(heap->nvec > 0); \
+ assert(heap->nvec > 0 && "_remove"); \
r = heap->vec[0]; \
heap->vec[0] = heap->vec[--heap->nvec]; \
while(2 * n + 1 < heap->nvec) { \