2010-05-11から1日間の記事一覧

ftmplでfold

C++

コンパイル通すのに1時間くらいかかった。 結局、type_tが邪魔なので外すメタ関数が必要になった。 あと、decltype( ( T ) )忘れがち。 #include <iostream> #include <cxxabi.h> #include "vector.hpp" #include "type.hpp" #include "unwrap.hpp" #include "id.hpp" #include "</cxxabi.h></iostream>…

ftmpl::vectorでpush_backしてみた。

C++

/sandbox/ftmpl 本日、BoostCon '09でこれの発表があったそうです。 テンプレートメタプログラミングが<>から()になりました。 decltypeばんざい。 #include <iostream> #include <cxxabi.h> #include "vector.hpp" #include "type.hpp" #include "unwrap.hpp" #include "id.hpp"</cxxabi.h></iostream>…

RangeEx Rangeアダプタ適用結果をMutable Algorithmに渡せない

C++

【Range】 invalid initialization of non-const type with adaptors これがコンパイル通らない。 (一時オブジェクトを左辺値参照に束縛できてしまうVC++では言語拡張をOFFにすること) #include <vector> #include <boost/range/algorithm/fill.hpp> #include <boost/range/adaptor/reversed.hpp> int main() { std::vector<int> v(10); boost</int></boost/range/adaptor/reversed.hpp></boost/range/algorithm/fill.hpp></vector>…