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 smt_function_application_termt::indices using C++17 feature #8035

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

thomasspriggs
Copy link
Contributor

With C++17's if constexpr feature we can now remove two alternate function templates and just put the alternate implementations in line. This puts the specialisation into the outer function, so that it is specialised with the correct implementation for the given functiont, rather than dispatching based on the std::true_type / std::false_type overloads.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Sorry, something went wrong.

With C++17's `if constexpr` feature we can now remove two alternate
function templates and just put the alternate implementations in line.
This puts the specialisation into the outer function, so that it is
specialised with the correct implementation for the given `functiont`,
rather than dispatching based on the `std::true_type` /
`std::false_type` overloads.
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3db3e49) 79.09% compared to head (f0a290e) 79.10%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8035   +/-   ##
========================================
  Coverage    79.09%   79.10%           
========================================
  Files         1699     1699           
  Lines       196508   196505    -3     
========================================
+ Hits        155430   155443   +13     
+ Misses       41078    41062   -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +161 to +164
if constexpr(has_indicest<functiont>::value)
return function.indices();
else
return {};
Copy link
Contributor

Choose a reason for hiding this comment

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

That's the change that I wanted to do had I the time for it 🥇

@esteffin esteffin added the Version 6 Pull requests and issues requiring a major version bump label Nov 14, 2023
@thomasspriggs thomasspriggs merged commit 31207f8 into diffblue:develop Nov 14, 2023
@thomasspriggs thomasspriggs deleted the tas/constexpr_indices branch November 14, 2023 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Version 6 Pull requests and issues requiring a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants