上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 259 下一页
摘要: #include <常用> 空 f(符 m){ 静 常 符 c{'c'},d{'d'}; 猜(m){ 若 c:若 d:打印(m);断; 默认:打印("啊啊"); } } 空 主(){ 符 c{'c'},d{'o'};f(c);f(d); } 阅读全文
posted @ 2022-08-04 23:39 zjh6 阅读(7) 评论(0) 推荐(0)
摘要: 原文 static struct S(E, T) { private T flags; private enum mask(string name) = 1 << __traits(getMember, E, name); pure nothrow @nogc @safe final { bool 阅读全文
posted @ 2022-08-04 13:23 zjh6 阅读(14) 评论(0) 推荐(0)
摘要: 原文 不要直接用.toString,用std.format.format. import std; void main() { auto x = BigInt("123123123123123123123123123123123123"); string s = format("%s", x); / 阅读全文
posted @ 2022-08-04 11:00 zjh6 阅读(10) 评论(0) 推荐(0)
摘要: 概述 更好可读的函数 ●八进制字面 ●0结尾无需分配的串 ●隐藏类型 ●避免内存分配的链 ●避免返回错误 ●替换goto的嵌套函数 已有技术 ● 半浮点数 ● 用CTFE初化数组 ● 用枚举生成域名列表 ● 从C对接D 八进制字面 ●0755 ●18位字的PDP-10 今天仅用于文件权限,但它们仍然 阅读全文
posted @ 2022-08-03 10:08 zjh6 阅读(14) 评论(0) 推荐(0)
摘要: 原文 ubyte[] data = ...; File f = File("dbfile", "w"); f.rawWrite(data[]); 要用rawWrite.而不用write. 阅读全文
posted @ 2022-08-03 08:50 zjh6 阅读(8) 评论(0) 推荐(0)
摘要: 原文 串不好,应用变量.很容易创建新类型.如std.algorithm中管道一样,隐式实例化模板的返回值. 我构建了arsd.exception模块,新异常重点是改进enforce. 用法 import exception2; enum MyError; enum OtherError; void 阅读全文
posted @ 2022-08-02 11:05 zjh6 阅读(20) 评论(0) 推荐(0)
摘要: 原文 module combinejsonv3; import std.file; import std.stdio; import std.json; import std.array; import std.algorithm.searching; void main() { // 保存位置 J 阅读全文
posted @ 2022-08-02 09:04 zjh6 阅读(12) 评论(0) 推荐(0)
摘要: #include <常用> 构 A{ 整 i;串 b; }; 构 B{ 整 左,右; }; 构 C:公 B,公 A{ 整 k; 空 显示(){ 打印(左,右,i,b,k); } }; 空 主(){ 整 a=1,b=2,c=3;串 d{"哈哈"}; C e{b,c,a,d,4}; e.显示(); } 阅读全文
posted @ 2022-07-30 16:22 zjh6 阅读(11) 评论(0) 推荐(0)
摘要: 原文 import std.stdio; import std.string; import std.conv; import dcollect; import std.math; import std.algorithm; int main(string[] args) { int[] x=[23 阅读全文
posted @ 2022-07-30 09:13 zjh6 阅读(14) 评论(0) 推荐(0)
摘要: 原文 import std; struct S { string s; void delegate(string s) update; } void func(const S* s) {//函数接收S常引用,它不能修改S writeln(*s); s.update("func");//函数调用闭包的 阅读全文
posted @ 2022-07-30 09:07 zjh6 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 259 下一页