C++ Templates

USearch Templates

find_package(usearch CONFIG REQUIRED) 8122c932

Ask your coding agent about this page, or add the docs server to it

curl -s 'https://www.unum.cloud/docs/usearch/templates.md' | claude -p "How would this fit my code?"

include/usearch/ holds the core C++ 23 templates and containers USearch's engine is built from: graph indexes over any payload, metric and key, the dense kernel kits, and the RAM, VRAM and NVMe residencies of every modality.

They serve advanced users who build their own indexes, metrics or file formats rather than calling the engine. These headers carry no stability promise: their names, layouts and signatures change with the engine in any release, while the C ABI of c/usearch/*.h and the C++ SDK of cpp/usearch/*.hpp are versioned. Pin a commit, not a version, when building on them. Every subfolder usearch/<dir>/ opens unum::usearch::<dir>, and every header is spelled <usearch/<dir>/...>.

Topics

Installationusearch::header is the in-RAM basic tier: basic/ram_index.hpp, basic/ram_indexes.hpp and the eight utilities/ headers under them, over the standard library and the C types of usearch::abi, with nothing to compile.
QuickstartA single basic::ram_index is a complete index on its own.
MetricsA metric is a builder that scores one round of candidates against one query at a time, so an expensive metric can batch, pack or upload its candidates before scoring them all at once.
SerializationPayloads are arbitrary objects, so save and load take a codec that encodes each value into its own slice and back.
ConcurrencyThe leading template parameter of insert and search is the caller's synchronization contract.
Platform NotesDetails specific to one language, runtime or operating system.