We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#include <concepts> auto foo(auto x) { if constexpr (std::same_as<int, decltype(x)>) { return 1; } return 2; } int main() { foo(1); foo(1.0); }
#include <concepts> auto foo(auto x) { if constexpr (std::same_as<int, decltype(x)>) { return 1; } return 2; } #ifdef INSIGHTS_USE_TEMPLATE template<> int foo<int>(int x) { if constexpr(std::same_as<int, int>) { return 1; } return 2; } #endif #ifdef INSIGHTS_USE_TEMPLATE template<> int foo<double>(double x) { if constexpr(std::same_as<int, double>) { } return 2; } #endif int main() { foo(1); foo(1.0); }
Why
if constexpr(std::same_as<int, int>) { return 1; }
But
if constexpr(std::same_as<int, double>) { }
If C++ Insights doesn't expand constexpr expressions into their values, then why does the second option look so strange?
The text was updated successfully, but these errors were encountered:
Hello @uselessgoddess,
thanks for reporting this issue :-) It made me (re-)discover ConstantExpr and its value. A fix is on its way.
ConstantExpr
Andreas
Sorry, something went wrong.
1c9b8f4
Merge pull request #401 from andreasfertig/fixIssue400
17bd8ff
Fixed #400: Show value of a `ConstantExpr` instead of the subexpr in
No branches or pull requests
Here is my code
Here is the C++ Insights translation
Why
But
If C++ Insights doesn't expand constexpr expressions into their values, then why does the second option look so strange?
The text was updated successfully, but these errors were encountered: