This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Phobos の branches/devel をうまく扱うためにやった git-svn の設定 | |
こうなるようにしたい: | |
% git br -a | |
master | |
remotes/branches/devel | |
remotes/branches/phobos-1.x | |
remotes/devel/applying_safe_system_trusted | |
remotes/devel/new-std-process | |
remotes/tags/... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ダミー左辺値 phony!T | |
* | |
* __traits(compiles, ...) とか typeof(...) で左辺値が必要なときに使う. | |
* 変数の実体は存在しないので,本当に使おうとするとリンクエラーになる. | |
*/ | |
void main() | |
{ | |
// alias typeof(foo( int.init)) A; // Error! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* DDoc の邪魔をせず,テンプレート引数を常に「正規化形式」で受け取る. | |
*/ | |
import std.typetuple : TypeTuple, NoDuplicates; | |
void main() | |
{ | |
Foo!(int, int, int, int[], int, int[], int) foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* プロパティかフィールドか分からないときはコンマ演算子を使う | |
*/ | |
void main() | |
{ | |
S s; | |
// s.func は関数なので,型は int でなく int() | |
static assert( is(typeof(s.field) == int)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.algorithm; | |
import std.exception; | |
import std.stdio; | |
import core.stdc.errno; | |
import core.stdc.stdlib; | |
void main() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
void main() | |
{ | |
auto p = &temporary!int(); | |
auto q = &temporary!int(); | |
auto r = &temporary!int(); | |
assert(p != q && q != r && r != p); | |
writeln(p); | |
writeln(q); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Handle + range I/O | |
* | |
-------------------- | |
% wine dmd -run test | |
Leading char = '/' | |
Read 1024 bytes | |
Read 1024 bytes | |
Read 1024 bytes | |
Read 1024 bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
auto a = new S[](8); | |
auto b = a; | |
a.length = 1024; | |
assert(a.ptr != b.ptr); | |
// コピーコンストラクタは呼ばれていないのに,コピーが出来てしまった! | |
// a[0..8] is b[0..8] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Handle+Range I/O | |
*/ | |
//----------------------------------------------------------------------------// | |
// Polymorphic range interface | |
//----------------------------------------------------------------------------// | |
interface InputRange(E) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.perf; | |
import core.stdc.stdio; | |
import core.thread; | |
extern(C) | |
{ | |
int flockfile(FILE*); | |
int funlockfile(FILE*); |
OlderNewer