cds  2.3.2
cds::opt::compare< Functor > Struct Template Reference

[type-option] Option setter for key comparing More...

#include <cds/opt/compare.h>

Detailed Description

template<typename Functor>
struct cds::opt::compare< Functor >

[type-option] Option setter for key comparing

The option sets a type of a functor to compare keys. For comparing two keys k1 and k2 the functor must return:

  • 1 if k1 > k2
  • 0 if k1 == k2
  • -1 if k1 < k2

Functor is a functor with following interface:

template <typename T>
struct Comparator {
int operator ()(const T& r1, const T& r2)
{
// Comparator body
}
};

Note that the functor must return int, not a bool value.

There are predefined type for Functor:

You may implement your own comparing functor that satisfies Functor interface.

About relation between opt::less and opt::compare option setters see opt::less description.


The documentation for this struct was generated from the following file:

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:49 by Doxygen 1.8.13