souffle  2.0.2-371-g6315b36
Public Member Functions
souffle::detail::binary_search Struct Reference

A binary search strategy for looking up keys in b-tree nodes. More...

#include <BTree.h>

Inheritance diagram for souffle::detail::binary_search:
Inheritance graph
Collaboration diagram for souffle::detail::binary_search:
Collaboration graph

Public Member Functions

 binary_search ()=default
 Required user-defined default constructor. More...
 
template<typename Key , typename Iter , typename Comp >
Iter lower_bound (const Key &k, Iter a, Iter b, Comp &comp) const
 Obtains a reference to the first element in the given range that is not less than the given key. More...
 
template<typename Key , typename Iter , typename Comp >
Iter operator() (const Key &k, Iter a, Iter b, Comp &comp) const
 Obtains an iterator pointing to some element within the given range that is equal to the given key, if available. More...
 
template<typename Key , typename Iter , typename Comp >
Iter upper_bound (const Key &k, Iter a, Iter b, Comp &comp) const
 Obtains a reference to the first element in the given range that such that the given key is less than the referenced element. More...
 

Detailed Description

A binary search strategy for looking up keys in b-tree nodes.

Definition at line 141 of file BTree.h.

Constructor & Destructor Documentation

◆ binary_search()

souffle::detail::binary_search::binary_search ( )
default

Required user-defined default constructor.

Referenced by souffle::detail::linear_search::upper_bound().

Member Function Documentation

◆ lower_bound()

template<typename Key , typename Iter , typename Comp >
Iter souffle::detail::binary_search::lower_bound ( const Key &  k,
Iter  a,
Iter  b,
Comp &  comp 
) const
inline

Obtains a reference to the first element in the given range that is not less than the given key.

Definition at line 181 of file BTree.h.

188  {
189  Iter c;
190  auto count = b - a;
191  while (count > 0) {
192  auto step = count >> 1;
193  c = a + step;
194  if (comp(k, *c) >= 0) {
195  a = ++c;

◆ operator()()

template<typename Key , typename Iter , typename Comp >
Iter souffle::detail::binary_search::operator() ( const Key &  k,
Iter  a,
Iter  b,
Comp &  comp 
) const
inline

Obtains an iterator pointing to some element within the given range that is equal to the given key, if available.

If multiple elements are equal to the given key, an undefined instance will be obtained (no guaranteed lower or upper boundary). If no such element is present, a reference to the first element not less than the given key will be returned.

Definition at line 156 of file BTree.h.

167  {
168  Iter c;
169  auto count = b - a;
170  while (count > 0) {
171  auto step = count >> 1;
172  c = a + step;
173  if (comp(*c, k) < 0) {
174  a = ++c;

◆ upper_bound()

template<typename Key , typename Iter , typename Comp >
Iter souffle::detail::binary_search::upper_bound ( const Key &  k,
Iter  a,
Iter  b,
Comp &  comp 
) const
inline

Obtains a reference to the first element in the given range that such that the given key is less than the referenced element.

Definition at line 202 of file BTree.h.

212  {
213  using type = S;
214 };
215 
216 struct linear : public strategy_selection<linear_search> {};

The documentation for this struct was generated from the following file:
S
#define S(x)
Definition: test.h:179
souffle::test::count
int count(const C &c)
Definition: table_test.cpp:40
k
var k
Definition: htmlJsChartistMin.h:15
b
l j a showGridBackground &&c b raw series this eventEmitter b
Definition: htmlJsChartistMin.h:15
std::type
ElementType type
Definition: span.h:640