OpenMS
Loading...
Searching...
No Matches
hash< OpenMS::EmpiricalFormula > Struct Reference

Hash function for OpenMS::EmpiricalFormula. More...

#include <OpenMS/CHEMISTRY/EmpiricalFormula.h>

Public Member Functions

std::size_t operator() (const OpenMS::EmpiricalFormula &ef) const noexcept
 

Detailed Description

Hash function for OpenMS::EmpiricalFormula.

Computes a hash based on element symbols and their counts, plus the charge. The hash is consistent with operator==.

Design decisions:

  • Uses element symbols (not pointers) to distinguish isotopes like (13)C vs C
  • Sorts elements by symbol for reproducible hash across runs
  • FNV-1a based combining for good distribution
Note
Hash is reproducible across process runs on the same platform.

Member Function Documentation

◆ operator()()

std::size_t operator() ( const OpenMS::EmpiricalFormula ef) const
inlinenoexcept