template makeConvMatrix(T...) { // wrapper added
string helper()
{
string result;
static foreach(t; T)
{
result ~= "\t" ~ t.stringof;
}
result ~= "\n";
static foreach(t1; T)
{
result ~= t1.stringof;
static foreach(t2; T)
{
result ~= "\t" ~ (is(t1:t2) ? "yes" : "no");
}
result ~= "\n";
}
return result;
}
enum makeConvMatrix = helper(); // eponymous call
}
extern(C) // for betterC
void main()
{
import core.stdc.stdio;
static immutable convMatrix = makeConvMatrix!(byte, ubyte, short, ushort, int, uint, long, ulong); // no more () there
printf("%s\n", convMatrix.ptr);
}
d的betterC版造转换矩
原创文章标签 makeConvMatrix 文章分类 代码人生
©著作权归作者所有:来自51CTO博客作者fqbqrr的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:如何提高代码复用性及重构原则
下一篇:d不需要分配
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
几何不变矩--Hu矩
几何不变矩--Hu矩
Python 机器学习 -
【OpenCV】-图像的矩
矩函数在图像分析中涉及很多地方,如模式识别、目标分类、目标识别与方位估计、图像编码与重构。一个从一幅数字图形中计算出来的矩集,通常描述了该图像的全局特征,并提供了大量的关于该图像不同类型的几何特性信息。
opencv 计算机视觉 人工智能 #include i++