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

Update bell_inequalities.cpp #180

Merged
merged 2 commits into from
Feb 12, 2025
Merged

Update bell_inequalities.cpp #180

merged 2 commits into from
Feb 12, 2025

Conversation

umer066
Copy link
Contributor

@umer066 umer066 commented Feb 5, 2025

The std::array provides bounds checking and safer indexing than raw arrays

Reduces unnecessary std::cout calls

The std::array provides bounds checking and safer indexing than raw arrays

Reduces unnecessary std::cout calls
Copy link
Member

@vsoftco vsoftco left a comment

Choose a reason for hiding this comment

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

Thanks! Need a slight change (see lines below, starting around line 74), otherwise disp won't work (as before, we were using pointer manipulators, and now we need Container manipulators). Also, please #include <array> at top of file.

std::cout << "QS: "
              << disp(statistics[0], IOManipContainerOpts{}.set_sep(" ")) << " "
              << E[0] << '\n';
    std::cout << "QT: "
              << disp(statistics[1], IOManipContainerOpts{}.set_sep(" ")) << " "
              << E[1] << '\n';
    std::cout << "RS: "
              << disp(statistics[2], IOManipContainerOpts{}.set_sep(" ")) << " "
              << E[2] << '\n';
    std::cout << "RT: "
              << disp(statistics[3], IOManipContainerOpts{}.set_sep(" ")) << " "
              << E[3] << '\n';

Added #include<array>, removing pointer manipulators and added container manipulators to use in the code which are designed for printing standard containers. So, the disp() works correctly.
@umer066
Copy link
Contributor Author

umer066 commented Feb 11, 2025

Hi
I added the changes. Please check it

@umer066
Copy link
Contributor Author

umer066 commented Feb 11, 2025

Thanks for reviewing and approving my PR! Since I don't have merge permissions, could you please merge it when convenient? Let me know if any further changes are needed.

@vsoftco vsoftco merged commit 07bcd10 into softwareQinc:main Feb 12, 2025
2 checks passed
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