2009-11-17から1日間の記事一覧

STL 入門 second step

英語で書かれているけれど、ほとんどがcodeなので読みやすい。 日本語でSTLの基礎を読んだ後は、 ここを読んでsecond stepとすればよいと思う。 とても分かりやすいし、美しい! http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=standardTemplate…

STL vector iterator

vector<int> v; // ... // Traverse all container, from begin() to end() for(vector<int>::iterator it = v.begin(); it != v.end(); it++) { // ... *it++; // Increment the value iterator is pointing to } for構文にキレイにiteratorをつめこんだタイプ。</int></int>

vimperator アドオン

入れてるVimperatorプラグインのセットアップに 書いてあるコマンドをそのまま試してみた。 $ cd Sites $ svn co http://svn.coderepos.org/share/lang/javascript/vimperator-plugins $ cd vimperator-plugins $ cp ubiquity.js auto_detect_link.js google…

STL vector 二次元配列

int[10][20]とかはもう書かないのかな?いや、書くだろう。 int N, N; // ... vector< vector<int> > Matrix(N, vector<int>(M, -1)); Here we create a matrix of size N*M and fill it with -1.</int></int>

STLでvectorを直接引数で渡すのは重すぎるのでやめてくれ

代わりに参照渡しをしましょう。 void some_function(vector<int> v) { // Never do it unless you’re sure what you do! // ... } Instead, use the following construction: void some_function(const vector<int>& v) { // OK // ... }</int></int>