...ing logging 4.0

はてなブログに移行しました。D言語の話とかいろいろ。

2009-06-13から1日間の記事一覧

std.range.chainが返すRangeの要素型

import std.stdio; import std.algorithm; import std.range; void main() { f(chain("a".dup, "b")); // int } void f(Range)(Range r) { writeln(typeid(ElementType!(Range))); } intってなんやねん (´・ω・`)

Rangeを出力するwriteln

import std.stdio; import std.algorithm; import std.range; template writeln(R) if (isInputRange!(R)) { void writeln(R r) { foreach (e; r) std.stdio.write(e); std.stdio.writeln(); } } void main() { { auto res = chain("a", "b"); std.stdio.wri…

「以下について教えてあげよう♪」(2)

「以下について教えてあげよう♪」 - ...ing logging 3.0 より import std.stdio; import std.algorithm; import std.range; import std.string; char f(char x) { if ( x >= '0' && x <= '9' ) return '9' - x + '0'; if ( x >= 'A' && x <= 'Z' ) return x …