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

Func的构造函数 requires的条件限定 #9

Open
bizehao opened this issue Dec 30, 2023 · 1 comment
Open

Func的构造函数 requires的条件限定 #9

bizehao opened this issue Dec 30, 2023 · 1 comment

Comments

@bizehao
Copy link

bizehao commented Dec 30, 2023

目前的实现Func的构造函数的概念限定是正确的,但是不知道为啥vs2022这块飘红
image

然后我改成下面的实现就可以了


std::is_convertible_v<decltype(std::declval<C>()(std::declval<TArgs>()...)), R>
改成
std::is_convertible_v<std::invoke_result_t<C, TArgs...>, R>
就不飘红了

@vczh
Copy link
Member

vczh commented Jan 1, 2024

我还不知道有这个type trait呢,正好最近来看看,如果能用的话我就不declval了。

简单来说,VC++我记得intellisense用的是Edison Design Group的C++编译器,细节上跟cl和clang不一样的地方还不少,不过一般我只要这两个编译器都能编译我就满足了。

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

No branches or pull requests

2 participants