上一页 1 ··· 100 101 102 103 104 105 106 107 108 ··· 259 下一页
摘要: 元<极 为顺=1>空 基(){ 如 常式(为顺)...; 异 ...; } 空 A(){中 基<0>();} 空 B(){中 基<1>();} 元<极 为顺=1,极 为串=1>串 转(){ 如 常式(为顺)...; 异 ...; 如 常式(为串)...; 异 ...; ...//等等实现 } 然后, 阅读全文
posted @ 2022-01-06 10:35 zjh6 阅读(19) 评论(0) 推荐(0)
摘要: 这只是一种假想. 调用foo(x),在x有opArgs成员时,重写为foo(x.opArgs).同样,可对称的,如果定义foo(T x),T有opArgs成员时,重写为foo(typeof(T.opArgs)x). 该功能太强大,你可以这样: struct S { string opArgs; } 阅读全文
posted @ 2022-01-06 10:10 zjh6 阅读(26) 评论(0) 推荐(0)
摘要: 原文 我想出了个通用方法: 先写个验证器方法: bool testInputRange(T)() { static assert(is(typeof(T.init.empty))); static assert(is(typeof(T.init.front))); static assert(is( 阅读全文
posted @ 2022-01-05 21:00 zjh6 阅读(22) 评论(0) 推荐(0)
摘要: 原文 为什么不呢?给定如下签名: int fun(string s) pure nothrow; 可假定s为域,因为这里无逃逸通道.返回值无指针,纯确保不访问全局,无其他赋值参数. 而签名为 int fun(string s) pure; 时,可赋值s给异常,如何避免/检测它? 阅读全文
posted @ 2022-01-05 20:45 zjh6 阅读(18) 评论(0) 推荐(0)
摘要: 主要是想模拟C++的int&/T&. import std.stdio:writeln; ref int func(return ref int a){ a = 6; // 修改a return a; } void main(){ int a = 5; auto c = func(a); // 期望 阅读全文
posted @ 2022-01-05 20:35 zjh6 阅读(21) 评论(0) 推荐(0)
摘要: 通过如下一个基模板来搞定函数实现. 元<极 为顺=1,极 为串=1>串 转项(串&s,串&e){ //... }//优先为左,//顺,逆,串,文.文件,e为后缀 然后,再顺转,逆转...来特化该模板: 元<极 为顺=1> 串 串转(串&s,串&e){中 转项<为顺,1>(s,e);} 元<极 为顺= 阅读全文
posted @ 2022-01-05 17:20 zjh6 阅读(18) 评论(0) 推荐(0)
摘要: fun! Qwf(l,c) "如果尾符为c,则去掉,否则不变 "这里l为行,不是列 let l=a:l let i=len(l)-1 if (i<0) return l endif let j='' if l[i]==a:c if i==0 return j endif let l=l[0:i-1] 阅读全文
posted @ 2022-01-05 16:01 zjh6 阅读(16) 评论(0) 推荐(0)
摘要: 原文 Paul Backus: 最简单方法是让解析器带输入区间模板参数,而不是File,然后,传入各种(文件,内存缓冲,即时生成数据类等)数据源.如下面的从输入区间解析整. import std.range; int parseInteger(Input)(Input input) if (isIn 阅读全文
posted @ 2022-01-05 09:49 zjh6 阅读(16) 评论(0) 推荐(0)
摘要: 原文 dmd主分支: 这里:正确(符合设计),很好=正确+更严格,错误(导致内存崩溃).错误表示可能会出现内存崩溃. 动作无有dip1000取局部变量地址很好,错误正确,无指针类型时允许用域造局部变量切片允许,错误正确,无指针类型时允许使用域取引用中地址允许,错误很好,无指针类型时允许使用域取引用中 阅读全文
posted @ 2022-01-04 20:47 zjh6 阅读(20) 评论(0) 推荐(0)
摘要: ffmpeg -i 000.asf 000.mp4,视频,就是慢得很. 阅读全文
posted @ 2022-01-04 16:09 zjh6 阅读(3) 评论(0) 推荐(0)
上一页 1 ··· 100 101 102 103 104 105 106 107 108 ··· 259 下一页