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

Changes to As<>() function in Format and a new Is<>() function #186

Merged
merged 2 commits into from
Oct 2, 2022

Conversation

ardasener
Copy link
Contributor

This PR should resolved #130 and #131. It makes the following changes/additions:

  • A new templated Is<>() function that can check whether the Format pointer is of a particular concrete Format type.
if(format->Is<CSR<int,int,int>>()){
  // Do something
}
  • Some tests are also added for Is<>().

  • Both in the new Is<>() function and the old As<>() function, std::remove_pointer is used to handle calls with pointers correctly as well. This is done to avoid a common misunderstanding (where the user calls the function with the pointer type, not the base type) and also done in some other libraries we reviewed. Unlike what I suggested in Decay in As<>() #131, std::decay is not used as it actually works differently then I thought.

@ardasener ardasener added state: review needed type: feature Brand new functionality, features, workflows, endpoints, etc labels Oct 1, 2022
@ardasener ardasener added this to the Milestone 3 milestone Oct 1, 2022
This was linked to issues Oct 1, 2022
@ardasener ardasener added the priority: soon High priority label Oct 1, 2022
@AmroAlJundi AmroAlJundi self-requested a review October 2, 2022 10:22
@ardasener ardasener merged commit ef33413 into develop Oct 2, 2022
@ardasener ardasener deleted the feature/format_as_is branch October 2, 2022 11:02
SinanEkm pushed a commit that referenced this pull request Aug 19, 2024
Changes to As<>() function in Format and a new Is<>() function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: soon High priority state: review needed type: feature Brand new functionality, features, workflows, endpoints, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decay in As<>() Adding Is<>() function to Format
2 participants