摘要:
可以试试:这里方法 将文件夹设置在单独进程中打开. 阅读全文
posted @ 2022-09-04 10:55
zjh6
阅读(40)
评论(0)
推荐(0)
摘要:
// 声明模板 template<class T> struct container { container(T t) {} template<class Iter> container(Iter beg, Iter end); }; // 附加推导 template<class Iter> con 阅读全文
posted @ 2022-09-03 20:49
zjh6
阅读(29)
评论(0)
推荐(0)
摘要:
原文 struct biig { int[1024 * 1024] biig = 0; } biig biig; 你用的是哪个版本的dmd?我用2.098(旧的gitmaster)编译上面的代码,总的可执行文件大小只有900KB. 记得大概一两年前有一个bug,dmd会生成1024*1024存储指令 阅读全文
posted @ 2022-09-03 10:47
zjh6
阅读(25)
评论(0)
推荐(0)
摘要:
原文 无间接的不变表达式不转换为可变. void main() { const i = 42; // 常,所以T应为常. foo(i); } void foo(T)(T value) { T result; ++result; // 编译错误,但是否应工作? } 我觉得它应可工作,因为"结果"是局部 阅读全文
posted @ 2022-09-03 09:53
zjh6
阅读(13)
评论(0)
推荐(0)
摘要:
原文 struct Time { public int hours, minutes, seconds; this(int h, int m, int s) { hours = h; minutes = m; seconds = s; } Time opBinary(string op : "=") 阅读全文
posted @ 2022-09-03 09:19
zjh6
阅读(16)
评论(0)
推荐(0)
摘要:
原文 import std.stdio; import std.string; import std.array; import std.range.primitives; string mwrite(string str) @safe pure { size_t istart; bool inwo 阅读全文
posted @ 2022-09-03 08:43
zjh6
阅读(30)
评论(0)
推荐(0)
摘要:
原文 struct S(T, size_t memberCapacity = size_t.max) { static if (memberCapacity != size_t.max) { // 用户想要成员数组 T[memberCapacity] arr; void initMemberArra 阅读全文
posted @ 2022-09-02 14:32
zjh6
阅读(21)
评论(0)
推荐(0)
摘要:
原文 对栈与16字节对齐的64位编译中,float8(AVX,32字节对齐)尤其如此.注意,理论上AVX也可以在32位中使用,但目前dmd既不公开内联内置函数也不公开YMM0-YMM7,因此不能在那里遇到这个问题. 据我所知,gcc,icc,llvm等主要编译器支持对齐正确堆栈对齐>=16的任何内容 阅读全文
posted @ 2022-09-01 15:39
zjh6
阅读(32)
评论(0)
推荐(0)
摘要:
原文 auto assign(ref scope int* x, return ref int y) @safe { x = &y; } auto assign(ref scope int* x, return scope int* y) @safe { x = y; } y赋值给生命期更长的x 更 阅读全文
posted @ 2022-09-01 11:12
zjh6
阅读(29)
评论(0)
推荐(0)
摘要:
按期望编译: int* f()(int* p) { static int g; g = 0; return new int; } int* g() @safe { int x; return f(&x); } 如下不是,但应该: int* f()(int* p) { static int g; g 阅读全文
posted @ 2022-09-01 11:05
zjh6
阅读(14)
评论(0)
推荐(0)
浙公网安备 33010602011771号