摘要:
import std.format; import std.stdio; struct SomeId { invariant { } ref SomeId write(string fmt, string value)return { return this; } ref SomeId write( 阅读全文
posted @ 2022-11-19 13:48
zjh6
阅读(23)
评论(0)
推荐(0)
摘要:
原文 import std.traits : isCallable; struct MyStruct { auto foo() { return MyStruct(); } static if (isCallable!foo) pragma(msg, "GOOD"); else pragma(msg 阅读全文
posted @ 2022-11-19 13:32
zjh6
阅读(16)
评论(0)
推荐(0)
摘要:
/** * std::bitset example. * * Build with: * $ ldc2 -L-lstdc++ bitset.d */ modmap (C++) "bitset"; import std.stdio; import (C++) std.bitset; void main 阅读全文
posted @ 2022-11-19 12:38
zjh6
阅读(10)
评论(0)
推荐(0)
摘要:
Calypso工具,地址 它的工作方式与htod.exe类似,Calypso生成extern(C++). 它与clang++绑定在一起. 这不是Calypso现在的工作方式,它通过'modmap(C++)"dll头文件.h"',直接从D模块导入C++头文件,而不生成中间的D绑定模块: 这里,基础c+ 阅读全文
posted @ 2022-11-19 12:13
zjh6
阅读(47)
评论(0)
推荐(0)
摘要:
原文 借助cppnew.d.地址 // ab.cpp #include <iostream> class Test { public: Test(int); ~Test(); void set(int); void print(); private: int a; }; Test::Test(int 阅读全文
posted @ 2022-11-19 10:57
zjh6
阅读(35)
评论(0)
推荐(0)
摘要:
原文 不混杂类型名,有个包,模块,父构成的全名. 示例: module mypack.mymod; import std.stdio; struct S { struct Is {} } void main() { writeln(typeid(S)); writeln(typeid(S.Is)); 阅读全文
posted @ 2022-11-19 10:05
zjh6
阅读(18)
评论(0)
推荐(0)
摘要:
import core.stdcpp.vector; import std.stdio; void main() { vector!double v = [1.0, 2.1]; //double[] a = []; vector!string vs = ["33","44"]; writeln(v[ 阅读全文
posted @ 2022-11-18 23:38
zjh6
阅读(24)
评论(0)
推荐(0)
摘要:
原文 enum F_Type{ CONS, STRN, NMBR, EROR, BOOL, FUNC, } struct Atom{ F_Type kind; Atom* car; Atom* cdr; double num; string str; bool bul; F_Error err = 阅读全文
posted @ 2022-11-18 10:52
zjh6
阅读(33)
评论(0)
推荐(0)
摘要:
原文 T transitivity(T : PosetRelation)(T R, T S) { if (R.op == S.op) { if (R.right is S.left) return new T(R.left, S.right); } return null; } 阅读全文
posted @ 2022-11-18 10:16
zjh6
阅读(25)
评论(0)
推荐(0)
摘要:
元<整 I>静 常式 整 f(整 i){整 k=I*i;中 k;} 元<动 F,整...I>常式 动 M(){ 中 序列<F<I>(3)...>(); } 空 主(){ 常式 动 t=M<f,3,4,5>(); 打印序列(t); } 函数模板不能作模板参数 阅读全文
posted @ 2022-11-18 10:00
zjh6
阅读(12)
评论(0)
推荐(0)
浙公网安备 33010602011771号