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

Refactor the code base to use std::string_view more #729

Merged
merged 14 commits into from
Mar 27, 2024
Merged

Refactor the code base to use std::string_view more #729

merged 14 commits into from
Mar 27, 2024

Conversation

Strilanc
Copy link
Collaborator

@Strilanc Strilanc commented Mar 27, 2024

  • Fix stim.CompiledDetectorSampler.sample_write not supporting pathlib.Path paths
  • Fix "~Hyz" not being included in exported quirk URLs when the gate was only used in a decomposition
  • Switch a lot of pybind code over to std::string_view to reduce copies
    • Methods taking const std::string & and const char * now take std::string_view, saving a copy
    • Most cases of casting to std::string now cast to std::string_view, saving a copy
  • Replace nearly all const std::string & arguments with std::string_view arguments
  • Switch many compiled-time-data maps from std::map<std::string, *> to std::map<std::string_view, *>
    • Arg parsing maps given to find_enum_argument
    • "Two qubit gate piece data" used in diagram drawing
    • SVG gate data and 3d gate data in diagram drawing
    • File format data
  • Move GateTarget::from_target_str to gate_target.h by moving several templated methods like read_single_target into that header
  • Switch stim::print_circuit from taking a string indent to a counted indent
  • Fix stim::Circuit and stim::DetectorErrorModel having implicit conversions from strings
  • Changed stim::Gate::name from const char * to std::string_view (and changed all the name hashing methods to work on string views)
  • Add a _c_str annotation to null-terminated string variables in most cases
  • Switch from .data() to .c_str() when needing a null terminated string in most cases
  • Delete unused SubCommandHelp::flag_set()

@Strilanc Strilanc merged commit c827882 into main Mar 27, 2024
54 checks passed
@Strilanc Strilanc deleted the gatedeps branch March 27, 2024 23:30
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.

1 participant