2010-09-01から1ヶ月間の記事一覧

boost エントリ一覧

エントリした boost 関連の一覧 概要はこちら [boost] ver 1.44.0 テストしたバージョンに統一性がないので個別に記述されているものを見てください。 boost::lambda Boost.Lambda で、switch case を行う boost::mpl boost::mpl::sort で任意のソート boost…

boost::chrono

chrono ライブラリ使えば問題なくミリ秒単位で取得できました。 車輪の再発明もいいところ。 #include <assert.h> #include <boost/chrono.hpp> #include <boost/chrono/timer.hpp> #include <Windows.h> int main(){ namespace chrono = boost::chrono; boost::chrono::timer<> t; Sleep(16); chrono::milliseconds ms = chr</windows.h></boost/chrono/timer.hpp></boost/chrono.hpp></assert.h>…

ミリ秒単位のタイマ

boost::timer が秒単位しか対応していなかったので自作した。 時間の取得は、QueryPerformanceCounter() を使用しているので、 Windows 以外だと動きません。 Linux?ナニソレ美味しいの。 #include <assert.h> #include <windows.h> #include "timer.hpp" int main(){ kmt_ex::ms</windows.h></assert.h>…

boost::thread

スレッド処理自体、そんなに書いたことがないのでさわり程度に。 boost の場合、環境によって内部で切り替えを行っているので、 環境に依存しないコードを書く事ができるので便利。 使い勝手もそんなに難しくなかったかな。 #include <iostream> #include <fstream> #include <string> #</string></fstream></iostream>…

開発環境

PCスペック WindowsXP Home Edition Service Pack 3 GPU :NVIDIA GeForce GTS250 CPU :Intel Core 2 Duo E8400(3.00GHz) メモリ:2GB 開発環境 VisualStudio2010 Express Edition バージョン管理:Git ライブラリ boost :ver 1.45.0 pstade:ver 1.04.3

boost::serialization

簡単に言うとデータのシリアル化(直列化)を行うライブラリ。 データを文字列(一直線に並べる)に変換するイメージだと分かりやすいか。 ファイルに保存したり、ネットワークでデータのやり取りを行う際に利用します。 今回はデータをテキストファイルに書…

range の定義

この条件を満たしていれば、基本的に使用できる。 下記のメンバを持つクラス iterator 型 iterator begin(); iterator end(); const_iterator begin() const; const_iterator end() const; 配列型(T[N])である iterator の値を保持している std::pair 型で…

pstade::oven 機能一覧

基本的に、pstade::oven にしかない機能のみ抜粋。 [pstade] ver 1.04.3 http://p-stade.sourceforge.net/oven/doc/html/index.html pstade::oven::steps(n) iterator を移動する際のステップ数を設定。 #include <pstade/oven/steps.hpp> int array[] = {0, 1, 2, 3, 4, 5, 6, 7, 8</pstade/oven/steps.hpp>…

boost::range 機能一覧

使った機能の覚書。 間違いや分かりづらい部分があったらツッコミをお願いします。 [boost] ver 1.44.0 Chapter 1. Range 2.0 boost::adaptors::transformed range を走査する際に、操作を行う #include <boost/range/algorithm/transform.hpp> int to_double(int n){ return n + n; } int array[]</boost/range/algorithm/transform.hpp>…

ダブルディスパッチ

なにやら難しい言葉だがやってる事は簡単である。 struct Zaku{}; struct Char_zaku : public Zaku{}; struct Gundam{ void say(const Zaku&) const{ std::cout << "相手がザクなら!人間じゃないんだ、ぼくだって" << std::endl; } void say(const Char_zak…

複数条件の boost::adaptors::filtered

C++スレに絞り込み検索がどうのこうのとレスが付いてたので試しにやってみた。 #include <vector> #include <iostream> #include <boost/foreach.hpp> #include <boost/range/adaptor/filtered.hpp> namespace filter{ namespace detail{ template< typename T, typename U > struct or_impl{ or_impl(const T& lhs, const U& rhs) : </boost/range/adaptor/filtered.hpp></boost/foreach.hpp></iostream></vector>…

BOOST_PP

BOOST_PP 覚え書き。 本家:http://www.boost.org/doc/libs/1_44_0/libs/preprocessor/doc/ref.html BOOST_PP_ENUM と BOOST_PP_ENUM_SHIFTED の違い。 BOOST_PP_ENUM は、0からカウントを始め、BOOST_PP_ENUM_SHIFTED は、1からカウントを始めます。 BOOST_…