C++

続 std::basic_ostringstream

C++

id:fifth_moon:20061106:1162823847 に id:nevil さんからコメントいただいたので追試してみました。 まず簡単なソースをでっちあげて gdb にかけてみます。 typedef unsigned short unishort; typedef std::basic_string unistring; typedef std::basic_ost…

std::basic_ostringstream

C++

typedef unsigned short ushort; std::basic_ostringstream obuf; obuf こんなコードを g++*1 でコンパイルすると、obuf.str().size() が 0 を返す。なんでだ・・・ VC8 でコンパイルすると 4 を返す。1 じゃないのが微妙にアレだが char_traits をちゃんと…

std::ostream_iterator

C++

GCC の stdc++ の ostream_iterator には value_type が定義されてない*1。継承元の iterator には void が渡っているので value_type を参照すると void になる。なので template void func(Iter iter) { std::iterator_traits::value_type hoge; ... } な…

Boost.Spirit scanner_list

id:fifth_moon:20060711:1152633511 のもうひとつの解。 boost::spirit::scanner_list を使う ちゃんと http://www.boost.org/libs/spirit/doc/faq.html#lexeme_and_rules にも書いてあるし、http://www.boost.org/libs/spirit/doc/techniques.html#multiple…

Boost.Spirit

スキップパーサで blank_p を指定して空白を飛ばしているときに、空白込みの文字レベル解析するには lexeme_d ディレクティブを使う。 が、lexeme_d[*(print_p)] はコンパイル通るのに lexemed[*(print_p | utf8_multi_char)] みたいに自分定義のパーサ被せ…

Building Qt4 with Visual Studio 2005 Express Edition

Open Source 版は Visual Studio を公式にはサポートしてないとは知らなんだ。Commercial 版はサポートしてるようだけど。Visual Studio で Qt4 をビルドするには http://sourceforge.net/projects/qtwin/ とか http://qtnode.net/wiki/Qt4_with_Visual_Stud…

boost::static_visitor

static_visitor の operator() には const を付けないとエラーになる。 struct : public boost::static_visitor<> { template void operator()(T& v) const { v.somothing(); } };