上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 259 下一页
摘要: 原文 我设法制作了可保存常性的通用getParent()函数.对inout也可以. 但可对所有父输入区间生产函数这样做吗? 在常区间实现中,内部存储是非常的,只是在front()属性中隐式转换为常. 它提供了我需要的保护,但可更漂亮吗? import std; class A{ inout(A) g 阅读全文
posted @ 2022-08-23 09:32 zjh6 阅读(18) 评论(0) 推荐(0)
摘要: U().func!0不是调用吗? 这可行,但看起来很奇怪,我正在检查UDA表达式的类型: @(U().func!0) int b; pragma(msg,__traits(getAttributes,b));//tuple(U().func) pragma(msg,typeof(__traits(g 阅读全文
posted @ 2022-08-22 23:29 zjh6 阅读(17) 评论(0) 推荐(0)
摘要: 元<极 降序=0,整数 F,整数 T>极 有序一(F&f,T&t){ 如 常式(降序){ 中(f>=t); }异{ 中(f<=t); } } 元<极 降序=0,整数 F,整数 G,整数...T> 极 有序(F&f,G&g,T&...t){ 静 常式 整 I=型长...(T); 极 i=有序一<降序> 阅读全文
posted @ 2022-08-22 17:03 zjh6 阅读(19) 评论(0) 推荐(0)
摘要: 原文 struct U { auto ref func(int i)() { return this; } } void main() { { alias type = typeof(U().func!0); pragma(msg, type); // pure nothrow @nogc ref 阅读全文
posted @ 2022-08-22 14:45 zjh6 阅读(17) 评论(0) 推荐(0)
摘要: 原文 正确使用受者 异网受者有通过端点构造的重载函数,创建受者之后就可以接受了,代码如下: 用 异网::ip::传控; 传控::受者 受者(io环境,传控::端点(传控::v4(),端口)); 受者.异步接受(套接字,[](异网::错误码 ec){}); 该代码一般情况下没问题,但是如果端口被占用就 阅读全文
posted @ 2022-08-22 10:39 zjh6 阅读(60) 评论(0) 推荐(0)
摘要: 原文 strand,锁+发送队列和提交+发送队列,哪种方法更好呢?性能说话.答案是提交+发送队列>锁+发送队列>strand. 提交方法连续发送数据的另一个好处是,内部io线程需要连续发送数据时是无锁的,只有提交那里有锁,锁的范围很小,同时也影响io线程发数据的效率,它的效率无疑是最高的. 另一个场 阅读全文
posted @ 2022-08-22 10:03 zjh6 阅读(30) 评论(0) 推荐(0)
摘要: 原文 通用,hashOf函数: override size_t toHash() const { return hashOf(y, hashOf(x)); } 这里: enum defaultClassConstructor = q{ this(typeof(this.tupleof) params 阅读全文
posted @ 2022-08-22 09:37 zjh6 阅读(15) 评论(0) 推荐(0)
摘要: 原文 import std.checkedint; Checked!(int, WithNaN) n; assert(n.isNaN); assert((123 * n).isNaN); assert((123 / n).isNaN); assert((123 + n).isNaN); assert 阅读全文
posted @ 2022-08-21 22:01 zjh6 阅读(18) 评论(0) 推荐(0)
摘要: 可这样: static assert(float() is float.nan); 这仅适合float.init,但如果操作它并返回nan,那不一定是真的,因为nans有几种位模式. static assert(float() is real.nan); static assert(double() 阅读全文
posted @ 2022-08-21 09:52 zjh6 阅读(23) 评论(0) 推荐(0)
摘要: 原文 import std; void doSomething(int i, string s) { writeln("%s-%s".format(i, s)); } void main() { foreach (t; cartesianProduct(iota(1, 4), ["abc", "de 阅读全文
posted @ 2022-08-21 09:00 zjh6 阅读(20) 评论(0) 推荐(0)
上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 259 下一页