This is an implementation of the miss ratio curve online construction technique SHARDS in C++. It is heavily inspired in SHARDS-C, a fanmade implementation in C.
include_subdirectory(path/to/SHARDS-cpp)
# or find_package(Shards REQUIRED) if you instead installed Shards in your system
target_link_libraries(your_target Shards)
After including the header file, you can use SHARDS by using a building function for the desired strategy: Fixed Rate or Fixed Size. Example code:
#include <cstdint>
#include <Shards/Shards.h>
int main() {
Shards * shards = Shards::fixedSize(...);
// or Shards * shards = Shards::fixedRate(...);
// On lookups
std::string const key = ...;
shards->feed(key);
// Generate Miss Ratio Curve
std::map<uint32_t, double> mrc = shards->mrc();
// Reset internal state if desired
shards->clear();
delete shards;
return 0;
}