11

C++如何在编译期 同一constexpr函数返回递增值?

 3 years ago
source link: https://www.zhihu.com/question/432305232/answer/1599864864
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

C++如何在编译期 同一constexpr函数返回递增值?

想为一些类分配独立的id,运行期分配倒是很容易,一个函数返回++i就行了,但是这工作能在编译期完成吗? 起因主要是想实现类似java的.class功能…
7
461

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK