Skip to content

polish zig cpp #24

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

Merged
merged 2 commits into from
Apr 8, 2024
Merged

polish zig cpp #24

merged 2 commits into from
Apr 8, 2024

Conversation

jiacai2050
Copy link
Member

No description provided.

@jiacai2050 jiacai2050 requested a review from xnhp0320 April 8, 2024 13:55

```C++
Fn<sizeof(A) > sizeof(B), A, B>::OutputType
```

这就是比较类型的 size 大小,如果 A 大,OutputType 就是 A,如果 B 大,OutputType 就是 B。
这就是比较类型的大小,如果 A 大,OutputType 就是 A,如果 B 大,OutputType 就是 B。这种类型生成的方式对于开发者来说完全是黑盒的,需要依赖编译器的特殊支持,有种声明式语言的特点,即:结果导向,不关心具体实现逻辑
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里只是解释Fn这个模板类的含义。算是标准做法,感觉不能说是依赖编译器的特殊支持。。。建议把增加的句子删掉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实就是C++本意只是做模板,但是有人用模板的生成实现了某种编程。。。模板元编程是一个被发现的技术,而不是一个被发明的技术。。。

@jiacai2050 jiacai2050 merged commit 4223e60 into main Apr 8, 2024
@jiacai2050 jiacai2050 deleted the feat-polish branch April 8, 2024 15:07
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.

2 participants