Template Function Pennylane::Util::getElementIndexInVector

Function Documentation

template<typename T>
inline std::size_t Pennylane::Util::getElementIndexInVector(const std::vector<T> &vec, const T &element)

Get the index of an element in a vector.

Template Parameters

T – Data type.

Parameters
  • vec – Vector to check.

  • element – Element to find.

Throws

Error – if the element is not found in the vector.

Returns

std::size_t Index of the found element.