fourdst::libcomposition v2.0.1 Robust atomic species information library

Loading...
Searching...
No Matches
Public Member Functions | List of all members
std::hash< fourdst::atomic::Species > Struct Reference

Specialization of `std::hash` for `fourdst::atomic::Species`. More...

`#include <atomicSpecies.h>`

## Public Member Functions
size_t | operator() (const fourdst::atomic::Species &s) const noexcept
| Computes the hash for a Species object.

## Detailed Description

Specialization of `std::hash` for `fourdst::atomic::Species`.

This allows `fourdst::atomic::Species` objects to be used as keys in unordered associative containers like `std::unordered_map` and `std::unordered_set`. The hash is computed based on the species' name (`m_name`), as it is expected to be a unique identifier for each species.

Usage Example
  #include "fourdst/composition/atomicSpecies.h"
  #include <unordered_map>
  #include <string>
  int main() {
  std::unordered_map<fourdst::atomic::Species, double> abundance;
  fourdst::atomic::Species h1("H1", ...);
  abundance[h1] = 0.999;
  return 0;
  }
  fourdst::atomic::Species
  Represents an atomic species (isotope) with its fundamental physical properties.
  Definition atomicSpecies.h:51

Definition at line 428 of file atomicSpecies.h.

## Member Function Documentation

## ◆ operator()()

size_t std::hash< fourdst::atomic::Species >::operator() | ( | const fourdst::atomic::Species & | s | ) | const
| inline noexcept

Computes the hash for a Species object.

Parameters

  s | The Species object to hash.

Returns
  The hash value of the species' name.

Definition at line 434 of file atomicSpecies.h.

The documentation for this struct was generated from the following file:

- src/composition/include/fourdst/atomic/atomicSpecies.h