B-Trees
B-tree implementation in C++ to index documents based on numerical id's and title strings.
|
#include "BTree.hpp"
Go to the source code of this file.
Typedefs | |
template<typename T , unsigned int BlockSize = BLOCK_SIZE> | |
using | IdealBTree = BTree< T, maxBTreeOrder< T, BlockSize >(), BlockSize > |
BTree with ideal pre-calculated M order based on sizeof(T) More... | |
Functions | |
template<typename T , unsigned int BlockSize> | |
constexpr auto | maxBTreeOrder () |
Auxiliary function to calculate the max order of a BTree to store T-type values. More... | |
using IdealBTree = BTree<T, maxBTreeOrder<T, BlockSize>(), BlockSize> |
constexpr auto maxBTreeOrder | ( | ) |
Auxiliary function to calculate the max order of a BTree to store T-type values.
The calculation is done based on BlockSize, the result being the max order you can have for your tree without having your node exceed BlockSize in bytes.
We arrived at it through the following initial formula:
BlockSize = sizeof(long) + sizeof(bool) + sizeof(std::size_t) + (2 * M + 1) * sizeof(T) + (2 * M + 2) * sizeof(long)
This formula takes into account the size of members of a BTree::BNode.
T | Type that will be stored in BTree |
BlockSize | Size in bytes |