タグ

c++とcheckitoutに関するrawwellのブックマーク (7)

  • A Brief Look at C++0x

    Bjarne offers a sneak peek at the next version of standard C++ ("C++0x") which should be complete by 2009. A Brief Look at C++0x The work on C++0x has entered a decisive phase. The ISO C++ committee aims for C++0x to become C++09. It follows that the standard must be complete for ratification by the ISO member nations in 2008. The set of facilities offered will be chosen from those currently being

  • C++0x基礎文法最速マスター - Faith and Brave - C++で遊ぼう

    C++0xになると、C++03でごちゃごちゃした部分がだいぶ すっきり書けるようになるので、C++0xでの入門はこんな感じになるよー、 という気持ちで書きました。 1. Hello World C++0xでの入出力には、IOStreamというものを使用します。 <<演算子でどんどんつないでいきます。 以下のプログラムの読み方は 「標準出力(cout)に"Hello World"という文字列と、改行(endl)を出力する」 です。 #include <iostream> int main() { std::cout << "Hello World" << std::endl; return 0; } Hello World coutとendlを使用するには、 #include <iostream> のように、という標準ライブラリのファイルを読み込む必要があります。 2. コメント 行コメント

    C++0x基礎文法最速マスター - Faith and Brave - C++で遊ぼう
  • C++がPythonより重い… @ 7bit

    GUI grepツールの調査過程は一応一段落し、当初のもくろみ通り製作に入ろうとしています。 今は特に苦もなく使えそうなPython, C++, C#のどれを用いるか検討中。 大量のファイルへのアクセスと正規表現のマッチは割と重い処理になりそうなので、実際にコードを書いて比較しています。 まず生grep。find | xargs grep '...'。直接Cで書かれていることを考えると、最速の基準として考えて良さそうです。日英対訳文対応付けデータ [1]をデータセットとして実験していますが、1.1秒くらいで2000ファイル近くのスキャンが終わる。 次に、書きやすそうなところでPython (re)でやってみました。所詮LLだし、結果には全然期待していません。 ところがところが、何故かこれが滅茶苦茶速い。 特に最適化したコードの書き方でもないんですが、1.6秒くらいで終わる。殆どC同等の速さ

    rawwell
    rawwell 2009/06/27
    "正規表現はboost.regex、Unicodeのエンコーディング変換はICU。"
  • zip の解凍 - Cube Lilac

    zip の解凍クラスが必要になったので作成.C/C++zip を扱う場合,zlib のサンプルコードの 1 つである minizip を使うのが一番楽そうなので,このライブラリを利用したラッパクラスを作成することを考えます. zip は,複数のファイル/ディレクトリをひとまとめにしてアーカイブ化できる機能があるので,この複数のファイルへの操作方法が問題となってきます.試行錯誤した結果,zip アーカイブ内の各要素(ファイル/ディレクトリ)を順に走査できるような iterator を用意して,通常はこの iterator を通して各ファイルにアクセスするような実装としました. サンプルプログラムは以下のようになります.unzip オブジェクトを生成した後は,begin() や find() メソッドを用いて zip アーカイブ内の処理を行いたいファイルへアクセスします.これらのメソッド

    zip の解凍 - Cube Lilac
    rawwell
    rawwell 2009/06/08
    "zip の解凍クラスが必要になったので作成.C/C++ で zip を扱う場合,zlib のサンプルコードの 1 つである minizip を使うのが一番楽そうなので,このライブラリを利用したラッパクラスを作成することを考えます. zip は,複数
  • 配列やコンテナをストリームとして扱う - Cube Lilac

    手元に配列や(string, vector, deque, などの)コンテナと言う形でデータを保持してるけれども,使用したい関数(メソッド)のインターフェース(引数)は istream と言うケースに遭遇することがあります.このとき,簡単な解決策として stringstream を利用することが挙げられるのですが,元のデータサイズが大きくなるとコピーのコストが高くなります.そこで,配列やコンテナをストリームとして扱うためのクラスを作成してみました. namespace clx { template < class CharT, class Traits = std::char_traits<CharT> > class basic_ivstream : public std::basic_istream<CharT, Traits> { public: typedef basic_ivst

    配列やコンテナをストリームとして扱う - Cube Lilac
    rawwell
    rawwell 2009/06/08
    "手元に配列や(string, vector, deque, などの)コンテナと言う形でデータを保持してるけれども,使用したい関数(メソッド)のインターフェース(引数)は istream と言うケースに遭遇することがあります.このとき,簡単な解
  • More C++ Idioms - Wikibooks, collection of open-content textbooks

    The latest reviewed version was checked on 8 September 2023. There are template/file changes awaiting review. C++ has indeed become too "expert friendly" -- Bjarne Stroustrup, The Problem with Programming, Technology Review, Nov 2006. Stroustrup's saying is true because experts are intimately familiar with the idioms in the language. With the increase in the idioms a programmer understands, the la

    More C++ Idioms - Wikibooks, collection of open-content textbooks
    rawwell
    rawwell 2009/05/28
    "The world is invited to catalog reusable pieces of C++ knowledge (similar to the book on design patterns by GoF). The goal here is to first build an exhaustive catalog of modern C++ idioms and later evolve it into an idiom language, just like a pattern language."
  • The Boost.Iterator Library Boost - 1.39.0

    rawwell
    rawwell 2009/05/25
    "The iterator categories defined in C++98 are extremely limiting because they bind together two orthogonal concepts: traversal and element access. For example, because a random access iterator is required to return a reference (and not a proxy) when dereferenced, it is impossible to capture the capa
  • 1