摘要:
#IfWinActive ahk_class Vim CapsLock::send {F7} RAlt::NumpadAdd RWin::NumpadSub AppsKey::NumpadMult RCtrl::NumpadDiv ;仅针对vim键,借助小键盘,来控制 ;<kPlus><kMinus 阅读全文
posted @ 2022-06-12 17:41
zjh6
阅读(16)
评论(0)
推荐(0)
摘要:
原文 import std.stdio; import std.format; struct indexedPair { size_t x, y; } struct MyArray { bool[3][3] elements; ref opIndex(indexedPair i) { return 阅读全文
posted @ 2022-06-12 10:10
zjh6
阅读(17)
评论(0)
推荐(0)
摘要:
原文 可直接构造,不用先转为串: import std.digest.sha, std.bigint; ubyte[32] hash = sha256Of(whatever); auto t = BigInt(false, hash[]); // sign + magnitude 这样不行: aut 阅读全文
posted @ 2022-06-12 08:06
zjh6
阅读(18)
评论(0)
推荐(0)
摘要:
原文 D的@nogc注解非常重要,但很少宣传. @nogc的主函数可编译时保证程序永远不会分配垃集内存. 从std.experimental.allocator这里分配. 这里的分配器可满足认为垃集不合适的,其他内存分配需求.通过I分配器接口,可运行时根据需要在垃集和自定义分配策略间切换. auto 阅读全文
posted @ 2022-06-11 23:40
zjh6
阅读(23)
评论(0)
推荐(0)
摘要:
原文 1,用接口. D有匿名类,可内联定义它们,来简单包装函数列表来实现接口. 2,用闭包 是,语言打包的数据指针和函数.可取方法地址,从对象创建它们,也可从其他函数创建它们,或可用匿名函数内联定义它们.函数接受闭包,实现多态. 主要区别在,无需要共享的静态名. module a; void a(v 阅读全文
posted @ 2022-06-11 23:10
zjh6
阅读(15)
评论(0)
推荐(0)
摘要:
原文 import std.traits; // 从函数或闭包类型中转换`@nogc` auto assumeNoGC(T) (T t) if (isFunctionPointer!T || isDelegate!T) { enum attrs = functionAttributes!T | Fu 阅读全文
posted @ 2022-06-11 22:44
zjh6
阅读(16)
评论(0)
推荐(0)
摘要:
原文 __gshared const TEST = import(`onlineapp.d`); extern(C) void main(){ __gshared bin_ptr = TEST.ptr; } 试试这个: __gshared bin_ptr; shared static this() 阅读全文
posted @ 2022-06-11 22:09
zjh6
阅读(18)
评论(0)
推荐(0)
摘要:
fun! Ecpp(a,c=' ') let[a,b,c]=split(a:a,a:c) "分隔,分成3串,第1串为首条件,用单个符来分割 "第2串"二次匹配.f为函数名串,m为模式 let b=Wjxt(b,'"') let c=Wjxt(c,'"') let gs='%s/{}/\=TH(sub 阅读全文
posted @ 2022-06-11 11:12
zjh6
阅读(14)
评论(0)
推荐(0)
摘要:
原文 转换为可空: @safe Nullable!Item getItem(int _id) { import std.algorithm : filter; with (items.filter!(item => item.id == _id)) { if (empty) return Nulla 阅读全文
posted @ 2022-06-11 09:59
zjh6
阅读(11)
评论(0)
推荐(0)
摘要:
import std; void main() { int[3] arr; arr.each!(e => e); // 编译 // arr.map!(e => e); // 失败 arr[].map!(e => e); // 编译 } 阅读全文
posted @ 2022-06-11 08:45
zjh6
阅读(17)
评论(0)
推荐(0)
浙公网安备 33010602011771号