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

Add a helper class to check if a type is complex #510

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

IvanaGyro
Copy link
Collaborator

Many refactoring works including #504, #508, and #509 use this change.

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.78%. Comparing base (72453ca) to head (fca444d).
Report is 40 commits behind head on dev-master.

Additional details and impacted files
@@              Coverage Diff               @@
##           dev-master     #510      +/-   ##
==============================================
+ Coverage       16.60%   16.78%   +0.17%     
==============================================
  Files             221      221              
  Lines           48490    53173    +4683     
  Branches        20272    19822     -450     
==============================================
+ Hits             8053     8923     +870     
- Misses          36143    39940    +3797     
- Partials         4294     4310      +16     

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

@manuschneider
Copy link
Collaborator

manuschneider commented Nov 14, 2024

Why not call the function to use is_complex directly? So I would suggest
is_complex_v -> is_complex
is_complex -> is_complex_type
or something similar. This would affect #508 and #509 as well.

Generally, a short comment for functions and classes about what they do or how they are used is always welcome. Like

// is_complex checks if a data type is of type std::complex
// usage: is_complex<T> returns true or false for a data type T

@ianmccul
Copy link
Contributor

ianmccul commented Nov 14, 2024

The terminology is_complex<T> for the structure and is_complex_v<T> for the value matches the C++ convention of the type_traits, eg is_integral -> is_integral_v, is_pointer -> is_pointer_v etc. It is perhaps slightly unfortunate naming, but the structure metafunctions were added (and got the nice name) in C+11, before template variables were added in C++14, so we got the variables with the _v suffix. For the same reason, metafunctions that return a type conventionally have a helper template alias that adds _t suffix.

The terminology @IvanaGyro has used also matches a proposal to add is_complex and is_complex_v to the C++ standard library, and the boost version.

@manuschneider manuschneider merged commit 50c0553 into dev-master Nov 14, 2024
4 checks passed
@manuschneider manuschneider deleted the is-complex branch November 14, 2024 05:57
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.

3 participants