上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 259 下一页
摘要: dchar dstrValue = '5'; dchar ch = '0' + intValue; dchar ch = cast(dchar) intValue; 阅读全文
posted @ 2022-10-06 10:30 zjh6 阅读(25) 评论(0) 推荐(0)
摘要: 谷哥不能翻译了,怎么办? 114.250.66.34 translate.googleapis.com 203.208.40.66 translate.google.com 203.208.40.66 translate.googleapis.com 上面加入C:\Windows\System32\ 阅读全文
posted @ 2022-10-05 20:17 zjh6 阅读(53) 评论(0) 推荐(0)
摘要: 原文 与GC按需分配和释放串速度相比,人类阅读速度非常慢. FormatSpec只在toString实现中用做有用事情时,才用它.要提供默认说明符的方便重载. struct A { string message; int enthusiasm; void toString(DG)(scope DG 阅读全文
posted @ 2022-10-05 16:19 zjh6 阅读(25) 评论(0) 推荐(0)
摘要: 原文 我希望可存储类实例到关联数组中,供以后使用,最小示例: interface PathConverter { T toD(T)(string value); } class NumberConverter(T) : PathConverter { T toD(T)(string value) { 阅读全文
posted @ 2022-10-05 15:47 zjh6 阅读(16) 评论(0) 推荐(0)
摘要: 原文 //extern (C) public int registerDDelegate(alias Func,...) class C { string s; void foo() { import std.stdio : writeln; writeln("看", s, "用D!"); } } 阅读全文
posted @ 2022-10-05 15:34 zjh6 阅读(16) 评论(0) 推荐(0)
摘要: 原文 void main() { import std.range; import std.stdio: write, writeln, writef, writefln; int[] arr1 = [ 1, 2, 3, 4 ]; int t = 0; writeln(arr1); for (int 阅读全文
posted @ 2022-10-05 15:12 zjh6 阅读(22) 评论(0) 推荐(0)
摘要: 原文 传递λ给纤程构造器. void fiberFunc(int i) { writeln(i); } void main() { auto fiber = new Fiber(() => fiberFunc(5)); fiber.call(); } 还可创建与对象一起存储的Fiber子类. 阅读全文
posted @ 2022-10-05 13:43 zjh6 阅读(13) 评论(0) 推荐(0)
摘要: 原文 struct pair { float x; float y; } pair[10] values; import std.conv; auto valuesInCStyle = to!(const float*)(values); 现在不行,可这样: cast(float*) values. 阅读全文
posted @ 2022-10-05 13:38 zjh6 阅读(18) 评论(0) 推荐(0)
摘要: 原文 是否可在不丢失容量下从区间中删除元素? void main() { import std.algorithm.mutation : remove, SwapStrategy; import std.stdio : writeln; int[] arr = [1, 2, 3, 2, 4, 2, 阅读全文
posted @ 2022-10-05 13:31 zjh6 阅读(48) 评论(0) 推荐(0)
摘要: 原文 import std.stdio: writeln; struct MyObject { int id; this(int id) @nogc { this.id = id; } ~this() { writeln("Object destructor ..."); } } void main 阅读全文
posted @ 2022-10-05 13:15 zjh6 阅读(19) 评论(0) 推荐(0)
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 259 下一页