Template Function Pennylane::Util::reverse_lookup

Function Documentation

template<typename Key, typename Value, std::size_t size>
constexpr auto Pennylane::Util::reverse_lookup(const std::array<std::pair<Key, Value>, size> &arr, const Value &value) -> Key

Reverse lookup value in array of pairs. For a constexpr map-like behavior.

Template Parameters
  • Key – Type of keys

  • Value – Type of values

  • size – Size of std::array

Parameters
  • arr – Array to lookup

  • value – Value to find