タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

programmingとC++に関するmitsuki_engawaのブックマーク (3)

  • reflection.cc - 兼雑記

    http://shinh.skr.jp/koneta/reflection_cpp.tar.gz 以下のように、 Test クラス内の test ではじまっているメソッドをイテレートして呼び出せます。 #include "reflection.h" #include <iostream> #include <cstring> using namespace std; class Test { void test_func1(); void test_func2(); void ignore(); }; void Test::test_func1() { cout << "func1" << endl; } void Test::test_func2() { cout << "func2" << endl; } void Test::ignore() { cout << "error" <<

    reflection.cc - 兼雑記
    mitsuki_engawa
    mitsuki_engawa 2005/11/17
    メソッドを名前で列挙する。
  • C の qsort と STL の sort の速度比較 - bkブログ

    STL は知れば知るほどよくできていると感心します。Effective STL の46項には今回と同様の実験が取り上げられています。 Effective STL には他にも、イテレータの無効化やコンテナ操作の性能など、 STL を使う上で注意すべき点が詳しく解説されています。 実験に使ったプログラムは以下の通りです。 $((2**24)) はコマンドラインで 2の24乗を計算する表記です。bash や zsh で使えます。 実行結果 % g++ -O2 -o sort sort.cpp % ./sort $((2**24)) qsort: 9.22 stl-sort-func: 5.62 stl-sort-functor: 2.56 % icc -O2 -o icc-sort sort.cpp % ./icc-sort $((2**24)) qsort: 8.82 stl-sort-fun

  • 1