当前位置:网站首页>D extend CTFE at compile time
D extend CTFE at compile time
2022-07-22 10:23:00 【fqbqrr】
original text
Yes :
//main.d
import std;
void main()
{
enum x = iota(1, 5).reduce!"a * b";
x.writeln();
}
Through something like :
dmd --expand-ctfe main.d -o expanded.d
cat expanded.d
obtain :
//expanded.d
import std;
void main()
{
24.writeln();
}
Try -vcg-ast
sign :
import object;
import std;
void main()
{
enum int x = 24;
writeln(24);
return 0;
}
// A pile of template instances
Or so :
template printEnum(alias x, string file = __FILE__, size_t line = __LINE__)
{
enum printEnum = x;
pragma(msg, file, "(", int(line), "): ", printEnum);// Print .
}
enum x = printEnum!(iota(1, 5).reduce!"a * b");
But this is it :
debug template printEnum(...) {
... // The above content is only used for debugging .
}// add -debug sign .
else
enum printEnum(alias x) = x;
Reference resources
Large memory , use 64 position
compile :
dmd -m64 -run test.d
边栏推荐
- Collection (properties)
- Energy principle and variational method note 05: examples of natural boundary conditions
- 东方财富开户安全吗,要什么证件呢
- IO异常处理
- Smart phone antenna tuning
- UOB camera registers the detailed configuration of easycvr platform through gb28181 protocol
- ABAQUS Chinese English conversion
- 梨花带雨音乐播放器3.91源码开源(网站添加背景音乐)
- Energy principle and variational method note 06: variational problems of higher-order derivatives (including higher-order derivatives of functions)
- day02-2
猜你喜欢
Std:: thread combined with class object
HD06-ASEMI贴片整流桥HD06
能量原理与变分法笔记03:证明两点之间直线最短
基于卡尔曼滤波的微电网调度(Matlab代码实现)
Unity Scrollview scroll to the specified position
Smart phone antenna tuning
Unity C: use this keyword to expand class functions
能量原理与变分法笔记10:虚位移原理
Execution failed for task ‘:app:kaptDevDebugKotlin‘.
HCIP(10)
随机推荐
C # and CAD secondary development, 20220721 essay code
洗衣店小程序源码-增加对接第三方跑腿
Login prompt ora-28000 the account is locked
Execution failed for task ‘:app:kaptDevDebugKotlin‘.
[gestionnaire de projet du système d'information] chapitre IV Structure globale des connaissances en gestion
Explanation of fast SCNN and implementation using tensorflow 2.0
2022开源PHP留言反馈管理系统 v2.0
一些个人理解
黑客赏金猎人平台之Immunefi
Suppose overflow:hidden is set in the div, and there is a select box in it. What if it is covered?
In only 3 hours, how to use AI to do scene mapping and complete scene production? AI creation workflow exploration
Short video live source code, uniapp jump page carries Id
[Basic] Pointer in C
Energy principle and variational method note 06: variational problems of higher-order derivatives (including higher-order derivatives of functions)
【信息系統項目管理師】第四章 複盤整體管理知識架構
Energy principle and variational method note 03: prove the shortest straight line between two points
三层架构完成增删改查篇章一
Initialize weights with the distribution rules of weights
使用cpolar建立一个商业网站(3)
能量原理与变分法笔记09: 虚功原理的例子