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

iostream vs stdio

C++

結論としてiostream vs stdioではなく、ofstream vs fprintfの比較になってますもう過去に幾度と無くされてきた戦争な気がするのでドキュメントとして残す。iostreamはデフォルトでstdioより遅い。 ただし、http://homepage1.nifty.com/herumi/diary/0812.ht…

PLplotのexampleひどすww

PLplotのexample03があまりにもひどかった → https://plplot.svn.sourceforge.net/svnroot/plplot/trunk/examples/c++/x03.ccちなみにPLplotの使い方は https://sites.google.com/site/makeplplot/ がよくまとまっている。PLplot自体はいいライブラリだと思…

ぷよぷよの消去アルゴリズム

C++

元ネタ > http://okajima.air-nifty.com/b/2011/01/2011-ffac.html #include<iostream> #include<vector> #include<cstdio> #include<string> #include<valarray> typedef std::vector<std::vector<int> > Field; const int width=6; const std::string data = " GYRR" "RYYGYG" "GYGYRR" "RYGYRG" "YGYRYG" "GYRYRG" "YGYR</std::vector<int></valarray></string></cstdio></vector></iostream>…

optionalとbindとphoenix

C++

boost::optional::getをbindにかけたいと思っていろいろ試したメモ 結論はphoenix使え。以下いろいろ試したソース #include<iostream> #include<boost/optional.hpp> #include<boost/phoenix/phoenix.hpp> #include<boost/lambda/lambda.hpp> int main(const int argc,const char** argv) { using boost::phoenix::bind; using boost::phoenix::a</boost/lambda/lambda.hpp></boost/phoenix/phoenix.hpp></boost/optional.hpp></iostream>…