B-Trees
B-tree implementation in C++ to index documents based on numerical id's and title strings.
IdealBTree.hpp
Go to the documentation of this file.
1 #ifndef _IDEALBTREE_HPP_INCLUDED_
2 #define _IDEALBTREE_HPP_INCLUDED_
3 
4 #include "BTree.hpp"
5 
7 
23 template <typename T, unsigned int BlockSize>
24 constexpr auto maxBTreeOrder() {
25  constexpr auto c = 3 * sizeof(long) + sizeof(bool) + sizeof(std::size_t) + sizeof(T);
26  static_assert(c < BlockSize, "B-tree order will be negative, consider increasing blockSize");
27 
28  constexpr auto M = (BlockSize - c) / (2 * (sizeof(T) + sizeof(long)));
29  static_assert(M >= 1, "Type T too big, consider increasing blockSize");
30 
31  return M;
32 }
33 
35 
41 template <typename T, unsigned int BlockSize = BLOCK_SIZE>
43 
44 #endif //_IDEALBTREE_HPP_INCLUDED_
constexpr auto maxBTreeOrder()
Auxiliary function to calculate the max order of a BTree to store T-type values.
Definition: IdealBTree.hpp:24
B-tree class.
Definition: BTree.hpp:43