上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 259 下一页
摘要: 原文 @safe: void main() { import std.stdio : writeln; writeln(ubyte(4).toHexDigit); } ubyte toHexDigit(ubyte decimal) pure nothrow @nogc { if (decimal < 阅读全文
posted @ 2022-10-27 09:20 zjh6 阅读(25) 评论(0) 推荐(0)
摘要: 原文 可定义enum INLINE=true, 并使用pragma(inline,INLINE),而不是pragma(inline,true).这样,当不希望编译器内联时,可切换INLINE为false. 阅读全文
posted @ 2022-10-26 14:43 zjh6 阅读(27) 评论(0) 推荐(0)
摘要: 原文 改变结构位置会怎样?所以在main()时,X结构一定在栈中,而下面的一定在堆中,是吧? import std; //void main() { struct X { struct Y { int i = 10; alias i this; } Y[] y = [Y.init];//.1 str 阅读全文
posted @ 2022-10-26 11:22 zjh6 阅读(17) 评论(0) 推荐(0)
摘要: 原文 struct A { int[] i; } struct B { A[] a = [A.init]; } A和B如上,代码: auto b1 = B.init; b1.a[0].i ~= 1; b1.a ~= A.init; b1.a[0].i ~= 11; b1.a[1].i ~= 12; 阅读全文
posted @ 2022-10-26 10:21 zjh6 阅读(15) 评论(0) 推荐(0)
摘要: 原文 auto screen = executeShell(cmdLine); auto s;//这样声明? //无法推导`"s"`的类型. //从`getPath`的返回类型来看,可能是`string[]`. //应该这样 string[] s; ... { s = screen.output.f 阅读全文
posted @ 2022-10-26 09:17 zjh6 阅读(18) 评论(0) 推荐(0)
摘要: #include <常用> 元<类 M>构 A{ 空 f(){M::g();} }; 构 C{ 单 串 首,尾; 静 空 切换(串&a,串&b){首=a;尾=b;} 静 空 g(){ 打印(首,尾); } }; 空 ff(){ 串 a{"ab"},b{"cde"}; C c;c.切换(a,b); A 阅读全文
posted @ 2022-10-25 17:36 zjh6 阅读(21) 评论(0) 推荐(0)
摘要: 原文 void foo() @trusted { static struct T { Exception ex; ubyte[] buf; } scope buffer = new ubyte[100]; T t; t.ex = new Exception("hello"); t.buf = buf 阅读全文
posted @ 2022-10-25 15:18 zjh6 阅读(16) 评论(0) 推荐(0)
摘要: function ff(){ var a=q('.jiu-content.card-bleed.mb-3.shadow-light.p-3.p-md-5.p-sm-3.bg-white.rounded').parentNode; jl0(a,'col-md-8'); } //setTimeout(" 阅读全文
posted @ 2022-10-25 13:55 zjh6 阅读(13) 评论(0) 推荐(0)
摘要: 策略思想不仅可应用至类,还应可应用至函数,甚至可以是变量! C++没有函数模板作为插件的功能,非常不方便! 但是,D中是有的!这样策略类思想不仅可应用至类,还可应用至函数! 导入 标.标口; 整 h(整 I,T)(T b){中 I*b.长度;} 空 g(用 h,整 I,T...)(T t){ 每一( 阅读全文
posted @ 2022-10-25 11:19 zjh6 阅读(124) 评论(0) 推荐(0)
摘要: 原文 如何实现迭代构/类?这样: foreach (k, v; T.init) { ... } T.byKeyValue没用. 参考在此 你应该用opApply.示例: struct A { static int[string] impl; static this() { impl = [ "a": 阅读全文
posted @ 2022-10-25 10:52 zjh6 阅读(27) 评论(0) 推荐(0)
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 259 下一页