摘要:
原文 Jan:在D中有个extern(C++)类: extern(C++) class A { ~this(); // ... } 及一个带const引用A的函数: void CppFunc(const A& arg); 我该如何在D中绑定它? extern(C++) void CppFunc(A 阅读全文
posted @ 2021-12-16 11:26
zjh6
阅读(12)
评论(0)
推荐(0)
摘要:
如下代码: import std.stdio:writeln; struct S{ @disable this(); ~this(){ writeln("dtor!"); } } void main(){ S s = void; } RazvanN: 过去出现过,人们同意,如果用void初化,则由你 阅读全文
posted @ 2021-12-15 21:01
zjh6
阅读(23)
评论(0)
推荐(0)
摘要:
原文 Steven Schveighoffer: 提问者想:给定从限定值隐式转换为非限定值的值类型,生成仅接受非限定值函数. 可这样包装: void foo2(T)(T v) if (!is(Unqual!T == T)) { foo(Unqual!T(t)); } 如果直接调用则会内联. 但D目前 阅读全文
posted @ 2021-12-15 15:51
zjh6
阅读(14)
评论(0)
推荐(0)
摘要:
原文 rumbu:想理解编译器行为: struct SimpleStruct { int x;} struct ComplexStruct { int[] x; } void main() { SimpleStruct[] buf1; immutable(SimpleStruct)[] ibuf1; 阅读全文
posted @ 2021-12-15 11:02
zjh6
阅读(20)
评论(0)
推荐(0)
摘要:
原文 vit:为什么这段代码无法编译? struct Foo(T){ this(Rhs, this This)(scope Rhs rhs){ } this(ref scope typeof(this) rhs){ } } struct Bar{ Foo!int foo; } void main() 阅读全文
posted @ 2021-12-15 09:52
zjh6
阅读(17)
评论(0)
推荐(0)
摘要:
void main() { import std.stdio: write, writeln, writef, writefln; class A { int i = 2; } class B : A { int j= 3; } void incr(ref A a) { writeln(a.i); 阅读全文
posted @ 2021-12-15 09:24
zjh6
阅读(29)
评论(0)
推荐(0)
摘要:
目前有几个坑: 1,可能有文件不存在的问题,加上防护: 如(!存在(d)){打印("不存在",d);中;} 2,可能会有不知道的怪问题: 试{g=p.路径();h=g.串();}抓(...){下;} 用异常来处理它. 3,可能有文件路径太深的问题,这里我直接删掉目录了,未写进代码: 4,文件名可能无 阅读全文
posted @ 2021-12-14 21:56
zjh6
阅读(11)
评论(0)
推荐(0)
摘要:
有时,居然删不了文件,说什么拒绝访问. 这个时候,可以用del /f来强制删文件. 删了2G垃圾,还是值得的. 阅读全文
posted @ 2021-12-14 21:46
zjh6
阅读(28)
评论(0)
推荐(0)
摘要:
#include <常用> #include "路径.cpp" 空 f(串&d){ 打印("哈哈",d); 如(!存在(d))打印("不存在"); 试{ 动 t=递归目录步(d); }抓(异常&e){打印(e.什么());} 打印("这里",d); } 空 主(){ 串 a{"e:\\桌面下载\\" 阅读全文
posted @ 2021-12-14 17:53
zjh6
阅读(29)
评论(0)
推荐(0)
摘要:
#include <常用> #include "路径.cpp" 空 f(串&d){ 动 t=递归目录步(d); 打印("这里",d); } 空 主(){ 串 a{"e:\\桌面下载"},b{"d:\\"}; f(a); 打印("啊"); f(b); } 阅读全文
posted @ 2021-12-14 17:21
zjh6
阅读(15)
评论(0)
推荐(0)
浙公网安备 33010602011771号