Program Listing for File slotted_index.hpp

Return to documentation for file (SeQuant/core/slotted_index.hpp)

#ifndef SEQUANT_SLOTTED_INDEX_H
#define SEQUANT_SLOTTED_INDEX_H

#include <SeQuant/core/attr.hpp>
#include <SeQuant/core/index.hpp>

namespace sequant {

class SlottedIndex {
 public:
  SlottedIndex(Index idx, SlotType slot)
      : idx_(std::move(idx)), slot_(std::move(slot)) {}

  Index &index() { return idx_; }

  const Index &index() const { return idx_; }

  SlotType slot_type() const { return slot_; }

  friend bool operator==(const SlottedIndex &lhs, const SlottedIndex &rhs) {
    return lhs.index() == rhs.index() && lhs.slot_type() == rhs.slot_type();
  }

  friend bool operator!=(const SlottedIndex &lhs, const SlottedIndex &rhs) {
    return !(lhs == rhs);
  }

 private:
  Index idx_;
  SlotType slot_;
};

}  // namespace sequant

#endif