2005-03-01から1ヶ月間の記事一覧

Boost.Xpressiveの落書き

boost::regexとboost::spiritをまとめて置きかえるライブラリであるらしい ヘッダーのみのライブラリでビルドは必要ない 正規表現を文字からではなく、オブジェクトから組み立てる(文字列の正規表現も扱える) []#include[][] "stdafx.h"[][]#include[][] <sstream>[] </sstream>…

Boost.Functionの実装の概要

コンパイラにとって、「関数(invoke)」の方が「仮想関数を含むクラス(holder)」よりも実装が簡単なのでコードサイズが小さくなる 対象が関数のみであるということを利用して汎用的な解決策である仮想関数の利用を避けることができる []#include[][] <iostream>[] []#in</iostream>…

Loki.StaticDispatcherをBoost.MPLで書ける

boost::python::type_infoはLoki::TypeInfoに相当する(ここでは使わない) []// multimethods.cpp : コンソール アプリケーションのエントリ ポイントを定義します。[] []//[][]#include[][] "stdafx.h"[][]#include[][] <boost/mpl/reverse_fold.hpp>[] []#include[][] <boost/mpl/vector.hpp>[] []#include[][] <boost/mpl/sort.hpp></boost/mpl/sort.hpp></boost/mpl/vector.hpp></boost/mpl/reverse_fold.hpp>…

Loki::AbstractFactoryをBoost.MPLで書く

[]// abstract_factory.cpp : コンソール アプリケーションのエントリ ポイントを定義します。[] []//[][]#include[][] "stdafx.h"[][]#include[][] <boost/mpl/identity.hpp>[] []#include[][] <boost/mpl/inherit.hpp>[] []#include[][] <boost/mpl/inherit_linearly.hpp>[] []#include[][] <boost/mpl/bind.hpp>[]</boost/mpl/bind.hpp></boost/mpl/inherit_linearly.hpp></boost/mpl/inherit.hpp></boost/mpl/identity.hpp>

Template Argumentの個数と順番を任意にする

C++

boost::spirit::ruleで使われている Named Template Argumentsのように名前を書かなくてもよい []// pst_20050314.cpp : コンソール アプリケーションのエントリ ポイントを定義します。[] []//[][]#include[][] "stdafx.h"[][]#include[][] <iostream>[] []#include[]</iostream>…

標準出力でのpause

C++

cin.ignore, cin.get, getcharなどが使える []// reg_sp_tok.cpp : コンソール アプリケーションのエントリ ポイントを定義します。[] []//[][]#include[][] "stdafx.h"[][]#include[][] <iostream>[] []#include[][] <vector>[] []#include[][] <string>[]</string></vector></iostream>