From fb25143685df32ed91b84da9fb7f2e821ed7daaf Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Fri, 26 Mar 2021 07:11:32 +0100 Subject: Changed cpque declaration to using_cpque(X, Value, valueCompare), and valueCompare optional: more consistent with STC conventions. --- docs/cpque_api.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/cpque_api.md b/docs/cpque_api.md index 313a0e92..822b4ad5 100644 --- a/docs/cpque_api.md +++ b/docs/cpque_api.md @@ -10,13 +10,12 @@ See the c++ class [std::priority_queue](https://en.cppreference.com/w/cpp/contai ```c #include -using_cpque(X, ctype); // default dir = `<` : max-heap -using_cpque(X, ctype, dir); // uses valueCompare from ctype -using_cpque(X, ctype, dir, valueCompare); +using_cpque(X, ctype); // uses valueCompare from ctype +using_cpque(X, ctype, valueCompare); ``` The macro `using_cpque()` must be instantiated in the global scope. **cpque** uses normally **cvec_X** -or **cdeq_X** as underlying implementation, specified as `ctype`. The *dir* must be given as -`<` or `>`, specifying *max-heap* or *min-heap* for the priority queue. +or **cdeq_X** as underlying implementation, specified as `ctype`. The *valueCompare* can be specified +to control the order in the priority queue. By default, the function *`ctype`_value_compare(x, y)* from the underlying vector type is used for comparing values (priorities). `X` is a type tag name and will affect the names of all cpque types and methods. @@ -61,7 +60,7 @@ cpque_X_value_t cpque_X_value_clone(cpque_X_value_t val); #include using_cvec(i, int64_t); -using_cpque(i, cvec_i, >); // adaptor type, '>' = min-heap +using_cpque(i, cvec_i, -c_default_compare); // min-heap int main() { -- cgit v1.2.3