Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename QubitBasis::add to ::index #252

Merged

Conversation

JonathonMisiewicz
Copy link
Contributor

Description

Renames a very misleadingly named function.

User Notes

  • QubitBasis.add() is now accessed as QubitBasis.index()

Checklist

  • Ready to go!

/// return the address of the state
size_t add() const { return state_; }
/// Convenience function to return state_ as an index.
size_t index() const { return static_cast<size_t>(state_); }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is probably a new feature for you: static_cast is a way of saying very very explicitly that we're doing a type conversion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange as it may sound, I knew of static_cast :-).

Copy link
Contributor

@imagoulas imagoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge.

@JonathonMisiewicz JonathonMisiewicz merged commit 77cb673 into evangelistalab:master May 16, 2024
1 check passed
@JonathonMisiewicz JonathonMisiewicz deleted the qubitbasis_add branch May 16, 2024 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants