-
Notifications
You must be signed in to change notification settings - Fork 362
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
template parameter #793
Comments
Hi @wichtounet you are our template expert here. Playing around with this I saw that they also changed the sample here: http://en.cppreference.com/w/cpp/types/enable_if. Which one is valid? Is the above one valid? Asking this because the new sample is working also with our parser: // #4, enabled via a template parameter
template<class T,
typename std::enable_if<
!std::is_trivially_destructible<T>{} &&
(std::is_class<T>{} || std::is_union<T>{}),
int>::type = 0>
void destroy(T* t)
{
std::cout << "destroying non-trivially destructible T\n";
t->~T();
} |
Hi @guwirth, Both are correct. Although, I would say the second (the new one your just posted) is a bit better because it uses int = 0 instead of void* = nullptr. In practice, for SFINAE, we can use any type that has constant expression values (integral types and pointer types). The first one should still work with your parser, but if the second works it's already great :) I guess that the problem with the first one is that you don't support pointers as non-type template parameter ? |
@ametselaar we need your help. We have a hard grammar nut to crack. |
- C++/CLI ...::typeid - close SonarOpenCommunity#793 - fix parametersAndQualifiers / trailingReturnType - declaratorId - assignmentExpression - parametersAndQualifiers - parse & print grammar
Leftover from #743, use case below is still not supported:
The text was updated successfully, but these errors were encountered: